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

selftests/net: convert sctp_vrf.sh to run it in unique namespace

Here is the test result after conversion.

]# ./sctp_vrf.sh
Testing For SCTP VRF:
TEST 01: nobind, connect from client 1, l3mdev_accept=1, Y [PASS]
...
TEST 12: bind vrf-2 & 1 in server, connect from client 1 & 2, N [PASS]
***v6 Tests Done***

Acked-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
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
90e271f6 3e05fc0c

+3 -9
+3 -9
tools/testing/selftests/net/sctp_vrf.sh
··· 6 6 # SERVER_NS 7 7 # CLIENT_NS2 (veth1) <---> (veth2) -> vrf_s2 8 8 9 - CLIENT_NS1="client-ns1" 10 - CLIENT_NS2="client-ns2" 9 + source lib.sh 11 10 CLIENT_IP4="10.0.0.1" 12 11 CLIENT_IP6="2000::1" 13 12 CLIENT_PORT=1234 14 13 15 - SERVER_NS="server-ns" 16 14 SERVER_IP4="10.0.0.2" 17 15 SERVER_IP6="2000::2" 18 16 SERVER_PORT=1234 ··· 18 20 setup() { 19 21 modprobe sctp 20 22 modprobe sctp_diag 21 - ip netns add $CLIENT_NS1 22 - ip netns add $CLIENT_NS2 23 - ip netns add $SERVER_NS 23 + setup_ns CLIENT_NS1 CLIENT_NS2 SERVER_NS 24 24 25 25 ip net exec $CLIENT_NS1 sysctl -w net.ipv6.conf.default.accept_dad=0 2>&1 >/dev/null 26 26 ip net exec $CLIENT_NS2 sysctl -w net.ipv6.conf.default.accept_dad=0 2>&1 >/dev/null ··· 63 67 64 68 cleanup() { 65 69 ip netns exec $SERVER_NS pkill sctp_hello 2>&1 >/dev/null 66 - ip netns del "$CLIENT_NS1" 67 - ip netns del "$CLIENT_NS2" 68 - ip netns del "$SERVER_NS" 70 + cleanup_ns $CLIENT_NS1 $CLIENT_NS2 $SERVER_NS 69 71 } 70 72 71 73 wait_server() {