aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/net/pmtu.sh68
1 files changed, 67 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index 89aec2fdf4fa..912b2dc50be3 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -103,6 +103,15 @@
103# and check that configured MTU is used on link creation and changes, and 103# and check that configured MTU is used on link creation and changes, and
104# that MTU is properly calculated instead when MTU is not configured from 104# that MTU is properly calculated instead when MTU is not configured from
105# userspace 105# userspace
106#
107# - cleanup_ipv4_exception
108# Similar to pmtu_ipv4_vxlan4_exception, but explicitly generate PMTU
109# exceptions on multiple CPUs and check that the veth device tear-down
110# happens in a timely manner
111#
112# - cleanup_ipv6_exception
113# Same as above, but use IPv6 transport from A to B
114
106 115
107# Kselftest framework requirement - SKIP code is 4. 116# Kselftest framework requirement - SKIP code is 4.
108ksft_skip=4 117ksft_skip=4
@@ -135,7 +144,9 @@ tests="
135 pmtu_vti6_default_mtu vti6: default MTU assignment 144 pmtu_vti6_default_mtu vti6: default MTU assignment
136 pmtu_vti4_link_add_mtu vti4: MTU setting on link creation 145 pmtu_vti4_link_add_mtu vti4: MTU setting on link creation
137 pmtu_vti6_link_add_mtu vti6: MTU setting on link creation 146 pmtu_vti6_link_add_mtu vti6: MTU setting on link creation
138 pmtu_vti6_link_change_mtu vti6: MTU changes on link changes" 147 pmtu_vti6_link_change_mtu vti6: MTU changes on link changes
148 cleanup_ipv4_exception ipv4: cleanup of cached exceptions
149 cleanup_ipv6_exception ipv6: cleanup of cached exceptions"
139 150
140NS_A="ns-$(mktemp -u XXXXXX)" 151NS_A="ns-$(mktemp -u XXXXXX)"
141NS_B="ns-$(mktemp -u XXXXXX)" 152NS_B="ns-$(mktemp -u XXXXXX)"
@@ -1006,6 +1017,61 @@ test_pmtu_vti6_link_change_mtu() {
1006 return ${fail} 1017 return ${fail}
1007} 1018}
1008 1019
1020check_command() {
1021 cmd=${1}
1022
1023 if ! which ${cmd} > /dev/null 2>&1; then
1024 err " missing required command: '${cmd}'"
1025 return 1
1026 fi
1027 return 0
1028}
1029
1030test_cleanup_vxlanX_exception() {
1031 outer="${1}"
1032 encap="vxlan"
1033 ll_mtu=4000
1034
1035 check_command taskset || return 2
1036 cpu_list=$(grep -m 2 processor /proc/cpuinfo | cut -d ' ' -f 2)
1037
1038 setup namespaces routing ${encap}${outer} || return 2
1039 trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \
1040 "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \
1041 "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B
1042
1043 # Create route exception by exceeding link layer MTU
1044 mtu "${ns_a}" veth_A-R1 $((${ll_mtu} + 1000))
1045 mtu "${ns_r1}" veth_R1-A $((${ll_mtu} + 1000))
1046 mtu "${ns_b}" veth_B-R1 ${ll_mtu}
1047 mtu "${ns_r1}" veth_R1-B ${ll_mtu}
1048
1049 mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000))
1050 mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000))
1051
1052 # Fill exception cache for multiple CPUs (2)
1053 # we can always use inner IPv4 for that
1054 for cpu in ${cpu_list}; do
1055 taskset --cpu-list ${cpu} ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${tunnel4_b_addr} > /dev/null
1056 done
1057
1058 ${ns_a} ip link del dev veth_A-R1 &
1059 iplink_pid=$!
1060 sleep 1
1061 if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then
1062 err " can't delete veth device in a timely manner, PMTU dst likely leaked"
1063 return 1
1064 fi
1065}
1066
1067test_cleanup_ipv6_exception() {
1068 test_cleanup_vxlanX_exception 6
1069}
1070
1071test_cleanup_ipv4_exception() {
1072 test_cleanup_vxlanX_exception 4
1073}
1074
1009usage() { 1075usage() {
1010 echo 1076 echo
1011 echo "$0 [OPTIONS] [TEST]..." 1077 echo "$0 [OPTIONS] [TEST]..."