aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/net/pmtu.sh
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2019-06-06 22:15:09 +0200
committerDavid S. Miller <davem@davemloft.net>2019-06-11 11:39:31 -0700
commite28799e52a0a7188374679184a32ca24921ff40e (patch)
tree28e1ee67fad5caef896f636c178a2f396a296c07 /tools/testing/selftests/net/pmtu.sh
parentMerge branch 'net-Enable-nexthop-objects-with-IPv4-and-IPv6-routes' (diff)
downloadwireguard-linux-e28799e52a0a7188374679184a32ca24921ff40e.tar.xz
wireguard-linux-e28799e52a0a7188374679184a32ca24921ff40e.zip
selftests: pmtu: Introduce list_flush_ipv6_exception test case
This test checks that route exceptions can be successfully listed and flushed using ip -6 route {list,flush} cache. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/pmtu.sh')
-rwxr-xr-xtools/testing/selftests/net/pmtu.sh51
1 files changed, 50 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index 9e6d8b704186..269e839b747e 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -111,6 +111,10 @@
#
# - cleanup_ipv6_exception
# Same as above, but use IPv6 transport from A to B
+#
+# - list_flush_ipv6_exception
+# Using the same topology as in pmtu_ipv6, create exceptions, and check
+# they are shown when listing exception caches, gone after flushing them
# Kselftest framework requirement - SKIP code is 4.
@@ -151,7 +155,8 @@ tests="
pmtu_vti6_link_add_mtu vti6: MTU setting on link creation 0
pmtu_vti6_link_change_mtu vti6: MTU changes on link changes 0
cleanup_ipv4_exception ipv4: cleanup of cached exceptions 1
- cleanup_ipv6_exception ipv6: cleanup of cached exceptions 1"
+ cleanup_ipv6_exception ipv6: cleanup of cached exceptions 1
+ list_flush_ipv6_exception ipv6: list and flush cached exceptions 1"
NS_A="ns-A"
NS_B="ns-B"
@@ -1202,6 +1207,50 @@ run_test_nh() {
USE_NH=no
}
+test_list_flush_ipv6_exception() {
+ setup namespaces routing || return 2
+ trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \
+ "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \
+ "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \
+ "${ns_r2}" veth_R2-B "${ns_b}" veth_B-R2
+
+ dst1="${prefix6}:${b_r1}::1"
+ dst2="${prefix6}:${b_r2}::1"
+
+ # Set up initial MTU values
+ mtu "${ns_a}" veth_A-R1 2000
+ mtu "${ns_r1}" veth_R1-A 2000
+ mtu "${ns_r1}" veth_R1-B 1500
+ mtu "${ns_b}" veth_B-R1 1500
+
+ mtu "${ns_a}" veth_A-R2 2000
+ mtu "${ns_r2}" veth_R2-A 2000
+ mtu "${ns_r2}" veth_R2-B 1500
+ mtu "${ns_b}" veth_B-R2 1500
+
+ fail=0
+
+ # Create route exceptions
+ run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s 1800 ${dst1}
+ run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s 1800 ${dst2}
+
+ if [ "$(${ns_a} ip -6 route list cache | wc -l)" -ne 2 ]; then
+ err " can't list cached exceptions"
+ fail=1
+ fi
+
+ run_cmd ${ns_a} ip -6 route flush cache
+ sleep 1
+ pmtu1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})"
+ pmtu2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"
+ if [ -n "${pmtu1}" ] || [ -n "${pmtu2}" ]; then
+ err " can't flush cached exceptions"
+ fail=1
+ fi
+
+ return ${fail}
+}
+
usage() {
echo
echo "$0 [OPTIONS] [TEST]..."