Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sleftests/net: convert icmp.sh to run it in unique namespace

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>

authored by

Hangbin Liu and committed by
Paolo Abeni
80b74bd3 c1516b35

+4 -6
+4 -6
tools/testing/selftests/net/icmp.sh
··· 18 18 # that address space, so the kernel should substitute the dummy address 19 19 # 192.0.0.8 defined in RFC7600. 20 20 21 - NS1=ns1 22 - NS2=ns2 21 + source lib.sh 22 + 23 23 H1_IP=172.16.0.1/32 24 24 H1_IP6=2001:db8:1::1 25 25 RT1=172.16.1.0/24 ··· 32 32 cleanup() 33 33 { 34 34 rm -f "$TMPFILE" 35 - ip netns del $NS1 36 - ip netns del $NS2 35 + cleanup_ns $NS1 $NS2 37 36 } 38 37 39 38 trap cleanup EXIT 40 39 41 40 # Namespaces 42 - ip netns add $NS1 43 - ip netns add $NS2 41 + setup_ns NS1 NS2 44 42 45 43 # Connectivity 46 44 ip -netns $NS1 link add veth0 type veth peer name veth0 netns $NS2