]> git.itanic.dy.fi Git - linux-stable/commitdiff
selftests/net: convert sctp_vrf.sh to run it in unique namespace
authorHangbin Liu <liuhangbin@gmail.com>
Sat, 2 Dec 2023 02:01:09 +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.

]# ./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>
tools/testing/selftests/net/sctp_vrf.sh

index c721e952e5f3019012405d6310f6c80d2cf78ba9..c854034b6aa1601d2ebda7fb9fb21d91e08da5fd 100755 (executable)
@@ -6,13 +6,11 @@
 #                                                  SERVER_NS
 #       CLIENT_NS2 (veth1) <---> (veth2) -> vrf_s2
 
-CLIENT_NS1="client-ns1"
-CLIENT_NS2="client-ns2"
+source lib.sh
 CLIENT_IP4="10.0.0.1"
 CLIENT_IP6="2000::1"
 CLIENT_PORT=1234
 
-SERVER_NS="server-ns"
 SERVER_IP4="10.0.0.2"
 SERVER_IP6="2000::2"
 SERVER_PORT=1234
@@ -20,9 +18,7 @@ SERVER_PORT=1234
 setup() {
        modprobe sctp
        modprobe sctp_diag
-       ip netns add $CLIENT_NS1
-       ip netns add $CLIENT_NS2
-       ip netns add $SERVER_NS
+       setup_ns CLIENT_NS1 CLIENT_NS2 SERVER_NS
 
        ip net exec $CLIENT_NS1 sysctl -w net.ipv6.conf.default.accept_dad=0 2>&1 >/dev/null
        ip net exec $CLIENT_NS2 sysctl -w net.ipv6.conf.default.accept_dad=0 2>&1 >/dev/null
@@ -67,9 +63,7 @@ setup() {
 
 cleanup() {
        ip netns exec $SERVER_NS pkill sctp_hello 2>&1 >/dev/null
-       ip netns del "$CLIENT_NS1"
-       ip netns del "$CLIENT_NS2"
-       ip netns del "$SERVER_NS"
+       cleanup_ns $CLIENT_NS1 $CLIENT_NS2 $SERVER_NS
 }
 
 wait_server() {