]> git.itanic.dy.fi Git - linux-stable/commitdiff
sleftests/net: convert icmp.sh to run it in unique namespace
authorHangbin Liu <liuhangbin@gmail.com>
Sat, 2 Dec 2023 02:01:05 +0000 (10:01 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 5 Dec 2023 12:00:56 +0000 (13:00 +0100)
Here is the test result after conversion.

]# ./icmp.sh
OK

Acked-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/icmp.sh

index e4b04cd1644ad3d21da796b9b8fc6e03ae8f729b..824cb0e35eff6eab436491f9f2cbbdadd9974b7c 100755 (executable)
@@ -18,8 +18,8 @@
 # that address space, so the kernel should substitute the dummy address
 # 192.0.0.8 defined in RFC7600.
 
-NS1=ns1
-NS2=ns2
+source lib.sh
+
 H1_IP=172.16.0.1/32
 H1_IP6=2001:db8:1::1
 RT1=172.16.1.0/24
@@ -32,15 +32,13 @@ TMPFILE=$(mktemp)
 cleanup()
 {
     rm -f "$TMPFILE"
-    ip netns del $NS1
-    ip netns del $NS2
+    cleanup_ns $NS1 $NS2
 }
 
 trap cleanup EXIT
 
 # Namespaces
-ip netns add $NS1
-ip netns add $NS2
+setup_ns NS1 NS2
 
 # Connectivity
 ip -netns $NS1 link add veth0 type veth peer name veth0 netns $NS2