Skip to content

Commit 7e68d31

Browse files
matttbekuba-moo
authored andcommitted
selftests: mptcp: run mptcp_sockopt from a new netns
Not running it from a new netns causes issues if some MPTCP settings are modified, e.g. if MPTCP is disabled from the sysctl knob, if multiple addresses are available and added to the MPTCP path-manager, etc. In these cases, the created connection will not behave as expected, e.g. unable to create an MPTCP socket, more than one subflow is seen, etc. A new "sandbox" net namespace is now created and used to run mptcp_sockopt from this controlled environment. Fixes: ce99791 ("selftests: mptcp: add mptcp getsockopt test cases") Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: Matthieu Baerts <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 22b2955 commit 7e68d31

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/testing/selftests/net/mptcp/mptcp_sockopt.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ init()
3535

3636
ns1="ns1-$rndh"
3737
ns2="ns2-$rndh"
38+
ns_sbox="ns_sbox-$rndh"
3839

39-
for netns in "$ns1" "$ns2";do
40+
for netns in "$ns1" "$ns2" "$ns_sbox";do
4041
ip netns add $netns || exit $ksft_skip
4142
ip -net $netns link set lo up
4243
ip netns exec $netns sysctl -q net.mptcp.enabled=1
@@ -73,7 +74,7 @@ init()
7374

7475
cleanup()
7576
{
76-
for netns in "$ns1" "$ns2"; do
77+
for netns in "$ns1" "$ns2" "$ns_sbox"; do
7778
ip netns del $netns
7879
done
7980
rm -f "$cin" "$cout"
@@ -243,7 +244,7 @@ do_mptcp_sockopt_tests()
243244
{
244245
local lret=0
245246

246-
./mptcp_sockopt
247+
ip netns exec "$ns_sbox" ./mptcp_sockopt
247248
lret=$?
248249

249250
if [ $lret -ne 0 ]; then
@@ -252,7 +253,7 @@ do_mptcp_sockopt_tests()
252253
return
253254
fi
254255

255-
./mptcp_sockopt -6
256+
ip netns exec "$ns_sbox" ./mptcp_sockopt -6
256257
lret=$?
257258

258259
if [ $lret -ne 0 ]; then

0 commit comments

Comments
 (0)