[SRU][J][PATCH 4/6] selftests/net: convert pmtu.sh to run it in unique namespace
Ian Whitfield
ian.whitfield at canonical.com
Thu Oct 1 20:39:46 UTC 2026
From: Hangbin Liu <liuhangbin at gmail.com>
BugLink: https://bugs.launchpad.net/bugs/2055473
pmtu test use /bin/sh, so we need to source ./lib.sh instead of lib.sh
Here is the test result after conversion.
# ./pmtu.sh
TEST: ipv4: PMTU exceptions [ OK ]
TEST: ipv4: PMTU exceptions - nexthop objects [ OK ]
TEST: ipv6: PMTU exceptions [ OK ]
TEST: ipv6: PMTU exceptions - nexthop objects [ OK ]
...
TEST: ipv4: list and flush cached exceptions - nexthop objects [ OK ]
TEST: ipv6: list and flush cached exceptions [ OK ]
TEST: ipv6: list and flush cached exceptions - nexthop objects [ OK ]
TEST: ipv4: PMTU exception w/route replace [ OK ]
TEST: ipv4: PMTU exception w/route replace - nexthop objects [ OK ]
TEST: ipv6: PMTU exception w/route replace [ OK ]
TEST: ipv6: PMTU exception w/route replace - nexthop objects [ OK ]
Signed-off-by: Hangbin Liu <liuhangbin at gmail.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 378f082eaf3760cd7430fbcb1e4f8626bb6bc0ae)
Signed-off-by: Ian Whitfield <ian.whitfield at canonical.com>
---
tools/testing/selftests/net/pmtu.sh | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index 33f4fb34ac9b2..b431e9a2d2115 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -204,8 +204,7 @@
# addresses have multipath routes to each other, b_r1 mtu = 1500.
# Check that PMTU exceptions are created for both paths.
-# Kselftest framework requirement - SKIP code is 4.
-ksft_skip=4
+source ./lib.sh
PAUSE_ON_FAIL=no
VERBOSE=0
@@ -275,16 +274,6 @@ tests="
pmtu_ipv6_route_change ipv6: PMTU exception w/route replace 1
pmtu_ipv4_mp_exceptions ipv4: PMTU multipath nh exceptions 1"
-NS_A="ns-A"
-NS_B="ns-B"
-NS_C="ns-C"
-NS_R1="ns-R1"
-NS_R2="ns-R2"
-ns_a="ip netns exec ${NS_A}"
-ns_b="ip netns exec ${NS_B}"
-ns_c="ip netns exec ${NS_C}"
-ns_r1="ip netns exec ${NS_R1}"
-ns_r2="ip netns exec ${NS_R2}"
# Addressing and routing for tests with routers: four network segments, with
# index SEGMENT between 1 and 4, a common prefix (PREFIX4 or PREFIX6) and an
# identifier ID, which is 1 for hosts (A and B), 2 for routers (R1 and R2).
@@ -552,13 +541,17 @@ setup_ip6ip6() {
}
setup_namespaces() {
+ setup_ns NS_A NS_B NS_C NS_R1 NS_R2
for n in ${NS_A} ${NS_B} ${NS_C} ${NS_R1} ${NS_R2}; do
- ip netns add ${n} || return 1
-
# Disable DAD, so that we don't have to wait to use the
# configured IPv6 addresses
ip netns exec ${n} sysctl -q net/ipv6/conf/default/accept_dad=0
done
+ ns_a="ip netns exec ${NS_A}"
+ ns_b="ip netns exec ${NS_B}"
+ ns_c="ip netns exec ${NS_C}"
+ ns_r1="ip netns exec ${NS_R1}"
+ ns_r2="ip netns exec ${NS_R2}"
}
setup_veth() {
@@ -848,7 +841,7 @@ setup_bridge() {
run_cmd ${ns_a} ip link set br0 up
run_cmd ${ns_c} ip link add veth_C-A type veth peer name veth_A-C
- run_cmd ${ns_c} ip link set veth_A-C netns ns-A
+ run_cmd ${ns_c} ip link set veth_A-C netns ${NS_A}
run_cmd ${ns_a} ip link set veth_A-C up
run_cmd ${ns_c} ip link set veth_C-A up
@@ -999,9 +992,7 @@ cleanup() {
done
socat_pids=
- for n in ${NS_A} ${NS_B} ${NS_C} ${NS_R1} ${NS_R2}; do
- ip netns del ${n} 2> /dev/null
- done
+ cleanup_all_ns
ip link del veth_A-C 2>/dev/null
ip link del veth_A-R1 2>/dev/null
--
2.43.0
More information about the kernel-team
mailing list