Skip to content

Commit

Permalink
selftests: pmtu: Use namespace command prefix to fetch route mtu
Browse files Browse the repository at this point in the history
In 7af137b72131 ("selftests: net: Introduce first PMTU test") I
accidentally assumed route_get_* helpers would run from a single
namespace. Make them a bit more generic, by passing the
namespace command prefix as a parameter instead.

Fixes: 7af137b72131 ("selftests: net: Introduce first PMTU test")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stefano Brivio authored and David S. Miller committed Mar 18, 2018
1 parent 380e29a commit 822d2f8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tools/testing/selftests/net/pmtu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,17 @@ mtu() {
}

route_get_dst_exception() {
dst="${1}"
ns_cmd="${1}"
dst="${2}"

${ns_a} ip route get "${dst}"
${ns_cmd} ip route get "${dst}"
}

route_get_dst_pmtu_from_exception() {
dst="${1}"
ns_cmd="${1}"
dst="${2}"

exception="$(route_get_dst_exception ${dst})"
exception="$(route_get_dst_exception "${ns_cmd}" ${dst})"
next=0
for i in ${exception}; do
[ ${next} -eq 1 ] && echo "${i}" && return
Expand All @@ -125,22 +127,22 @@ test_pmtu_vti6_exception() {
${ns_a} ping6 -q -i 0.1 -w 2 -s 60000 ${vti6_b_addr} > /dev/null

# Check that exception was created
if [ "$(route_get_dst_pmtu_from_exception ${vti6_b_addr})" = "" ]; then
if [ "$(route_get_dst_pmtu_from_exception "${ns_a}" ${vti6_b_addr})" = "" ]; then
echo "FAIL: Tunnel exceeding link layer MTU didn't create route exception"
exit 1
fi

# Decrease tunnel MTU, check for PMTU decrease in route exception
mtu "${ns_a}" vti_a 3000

if [ "$(route_get_dst_pmtu_from_exception ${vti6_b_addr})" -ne 3000 ]; then
if [ "$(route_get_dst_pmtu_from_exception "${ns_a}" ${vti6_b_addr})" -ne 3000 ]; then
echo "FAIL: Decreasing tunnel MTU didn't decrease route exception PMTU"
exit 1
fi

# Increase tunnel MTU, check for PMTU increase in route exception
mtu "${ns_a}" vti_a 9000
if [ "$(route_get_dst_pmtu_from_exception ${vti6_b_addr})" -ne 9000 ]; then
if [ "$(route_get_dst_pmtu_from_exception "${ns_a}" ${vti6_b_addr})" -ne 9000 ]; then
echo "FAIL: Increasing tunnel MTU didn't increase route exception PMTU"
exit 1
fi
Expand Down

0 comments on commit 822d2f8

Please sign in to comment.