Commit bec1f3b1 authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by Jakub Kicinski

selftests: mptcp: join: ability to invert ADD_ADDR check

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: 86e39e04 ("mptcp: keep track of local endpoint still available for each msk")
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-6-c8a9b036493b@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 85df533a
...@@ -1415,18 +1415,28 @@ chk_add_nr() ...@@ -1415,18 +1415,28 @@ chk_add_nr()
local add_nr=$1 local add_nr=$1
local echo_nr=$2 local echo_nr=$2
local port_nr=${3:-0} local port_nr=${3:-0}
local syn_nr=${4:-$port_nr} local ns_invert=${4:-""}
local syn_ack_nr=${5:-$port_nr} local syn_nr=$port_nr
local ack_nr=${6:-$port_nr} local syn_ack_nr=$port_nr
local mis_syn_nr=${7:-0} local ack_nr=$port_nr
local mis_ack_nr=${8:-0} local mis_syn_nr=0
local mis_ack_nr=0
local ns_tx=$ns1
local ns_rx=$ns2
local extra_msg=""
local count local count
local timeout local timeout
timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) if [[ $ns_invert = "invert" ]]; then
ns_tx=$ns2
ns_rx=$ns1
extra_msg="invert"
fi
timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout)
print_check "add" print_check "add"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtAddAddr") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtAddAddr")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
# if the test configured a short timeout tolerate greater then expected # if the test configured a short timeout tolerate greater then expected
...@@ -1438,7 +1448,7 @@ chk_add_nr() ...@@ -1438,7 +1448,7 @@ chk_add_nr()
fi fi
print_check "echo" print_check "echo"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtEchoAdd") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtEchoAdd")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$echo_nr" ]; then elif [ "$count" != "$echo_nr" ]; then
...@@ -1449,7 +1459,7 @@ chk_add_nr() ...@@ -1449,7 +1459,7 @@ chk_add_nr()
if [ $port_nr -gt 0 ]; then if [ $port_nr -gt 0 ]; then
print_check "pt" print_check "pt"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtPortAdd") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtPortAdd")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$port_nr" ]; then elif [ "$count" != "$port_nr" ]; then
...@@ -1459,7 +1469,7 @@ chk_add_nr() ...@@ -1459,7 +1469,7 @@ chk_add_nr()
fi fi
print_check "syn" print_check "syn"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortSynRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortSynRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$syn_nr" ]; then elif [ "$count" != "$syn_nr" ]; then
...@@ -1470,7 +1480,7 @@ chk_add_nr() ...@@ -1470,7 +1480,7 @@ chk_add_nr()
fi fi
print_check "synack" print_check "synack"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinPortSynAckRx") count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinPortSynAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$syn_ack_nr" ]; then elif [ "$count" != "$syn_ack_nr" ]; then
...@@ -1481,7 +1491,7 @@ chk_add_nr() ...@@ -1481,7 +1491,7 @@ chk_add_nr()
fi fi
print_check "ack" print_check "ack"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortAckRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$ack_nr" ]; then elif [ "$count" != "$ack_nr" ]; then
...@@ -1492,7 +1502,7 @@ chk_add_nr() ...@@ -1492,7 +1502,7 @@ chk_add_nr()
fi fi
print_check "syn" print_check "syn"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortSynRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortSynRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$mis_syn_nr" ]; then elif [ "$count" != "$mis_syn_nr" ]; then
...@@ -1503,7 +1513,7 @@ chk_add_nr() ...@@ -1503,7 +1513,7 @@ chk_add_nr()
fi fi
print_check "ack" print_check "ack"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortAckRx") count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortAckRx")
if [ -z "$count" ]; then if [ -z "$count" ]; then
print_skip print_skip
elif [ "$count" != "$mis_ack_nr" ]; then elif [ "$count" != "$mis_ack_nr" ]; then
...@@ -1513,6 +1523,8 @@ chk_add_nr() ...@@ -1513,6 +1523,8 @@ chk_add_nr()
print_ok print_ok
fi fi
fi fi
print_info "$extra_msg"
} }
chk_add_tx_nr() chk_add_tx_nr()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment