Skip to content

Commit aedbd14

Browse files
matttbegregkh
authored andcommitted
selftests: mptcp: join: ability to invert ADD_ADDR check
commit bec1f3b upstream. In the following commit, the client will initiate the ADD_ADDR, instead of the server. We need to way to verify the ADD_ADDR have been correctly sent. Note: the default expected counters for when the port number is given are never changed by the caller, no need to accept them as parameter then. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 86e39e0 ("mptcp: keep track of local endpoint still available for each msk") Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-6-c8a9b036493b@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0f21cc2 commit aedbd14

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

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

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,18 +1415,28 @@ chk_add_nr()
14151415
local add_nr=$1
14161416
local echo_nr=$2
14171417
local port_nr=${3:-0}
1418-
local syn_nr=${4:-$port_nr}
1419-
local syn_ack_nr=${5:-$port_nr}
1420-
local ack_nr=${6:-$port_nr}
1421-
local mis_syn_nr=${7:-0}
1422-
local mis_ack_nr=${8:-0}
1418+
local ns_invert=${4:-""}
1419+
local syn_nr=$port_nr
1420+
local syn_ack_nr=$port_nr
1421+
local ack_nr=$port_nr
1422+
local mis_syn_nr=0
1423+
local mis_ack_nr=0
1424+
local ns_tx=$ns1
1425+
local ns_rx=$ns2
1426+
local extra_msg=""
14231427
local count
14241428
local timeout
14251429

1426-
timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout)
1430+
if [[ $ns_invert = "invert" ]]; then
1431+
ns_tx=$ns2
1432+
ns_rx=$ns1
1433+
extra_msg="invert"
1434+
fi
1435+
1436+
timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout)
14271437

14281438
print_check "add"
1429-
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtAddAddr")
1439+
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtAddAddr")
14301440
if [ -z "$count" ]; then
14311441
print_skip
14321442
# if the test configured a short timeout tolerate greater then expected
@@ -1438,7 +1448,7 @@ chk_add_nr()
14381448
fi
14391449

14401450
print_check "echo"
1441-
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtEchoAdd")
1451+
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtEchoAdd")
14421452
if [ -z "$count" ]; then
14431453
print_skip
14441454
elif [ "$count" != "$echo_nr" ]; then
@@ -1449,7 +1459,7 @@ chk_add_nr()
14491459

14501460
if [ $port_nr -gt 0 ]; then
14511461
print_check "pt"
1452-
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtPortAdd")
1462+
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtPortAdd")
14531463
if [ -z "$count" ]; then
14541464
print_skip
14551465
elif [ "$count" != "$port_nr" ]; then
@@ -1459,7 +1469,7 @@ chk_add_nr()
14591469
fi
14601470

14611471
print_check "syn"
1462-
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortSynRx")
1472+
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortSynRx")
14631473
if [ -z "$count" ]; then
14641474
print_skip
14651475
elif [ "$count" != "$syn_nr" ]; then
@@ -1470,7 +1480,7 @@ chk_add_nr()
14701480
fi
14711481

14721482
print_check "synack"
1473-
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinPortSynAckRx")
1483+
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinPortSynAckRx")
14741484
if [ -z "$count" ]; then
14751485
print_skip
14761486
elif [ "$count" != "$syn_ack_nr" ]; then
@@ -1481,7 +1491,7 @@ chk_add_nr()
14811491
fi
14821492

14831493
print_check "ack"
1484-
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortAckRx")
1494+
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortAckRx")
14851495
if [ -z "$count" ]; then
14861496
print_skip
14871497
elif [ "$count" != "$ack_nr" ]; then
@@ -1492,7 +1502,7 @@ chk_add_nr()
14921502
fi
14931503

14941504
print_check "syn"
1495-
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortSynRx")
1505+
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortSynRx")
14961506
if [ -z "$count" ]; then
14971507
print_skip
14981508
elif [ "$count" != "$mis_syn_nr" ]; then
@@ -1503,7 +1513,7 @@ chk_add_nr()
15031513
fi
15041514

15051515
print_check "ack"
1506-
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortAckRx")
1516+
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortAckRx")
15071517
if [ -z "$count" ]; then
15081518
print_skip
15091519
elif [ "$count" != "$mis_ack_nr" ]; then
@@ -1513,6 +1523,8 @@ chk_add_nr()
15131523
print_ok
15141524
fi
15151525
fi
1526+
1527+
print_info "$extra_msg"
15161528
}
15171529

15181530
chk_add_tx_nr()

0 commit comments

Comments
 (0)