Commit fed61c4b authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

selftests: mptcp: make 2nd net namespace use tcp syn cookies unconditionally

check we can establish connections also when syn cookies are in use.

Check that
MPTcpExtMPCapableSYNRX and MPTcpExtMPCapableACKRX increase for each
MPTCP test.

Check TcpExtSyncookiesSent and TcpExtSyncookiesRecv increase in netns2.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9466a1cc
...@@ -196,6 +196,9 @@ ip -net "$ns4" link set ns4eth3 up ...@@ -196,6 +196,9 @@ ip -net "$ns4" link set ns4eth3 up
ip -net "$ns4" route add default via 10.0.3.2 ip -net "$ns4" route add default via 10.0.3.2
ip -net "$ns4" route add default via dead:beef:3::2 ip -net "$ns4" route add default via dead:beef:3::2
# use TCP syn cookies, even if no flooding was detected.
ip netns exec "$ns2" sysctl -q net.ipv4.tcp_syncookies=2
set_ethtool_flags() { set_ethtool_flags() {
local ns="$1" local ns="$1"
local dev="$2" local dev="$2"
...@@ -407,6 +410,11 @@ do_transfer() ...@@ -407,6 +410,11 @@ do_transfer()
sleep 1 sleep 1
fi fi
local stat_synrx_last_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableSYNRX | while read a count c rest ;do echo $count;done)
local stat_ackrx_last_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableACKRX | while read a count c rest ;do echo $count;done)
local stat_cookietx_last=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesSent | while read a count c rest ;do echo $count;done)
local stat_cookierx_last=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesRecv | while read a count c rest ;do echo $count;done)
ip netns exec ${listener_ns} ./mptcp_connect -t $timeout -l -p $port -s ${srv_proto} $extra_args $local_addr < "$sin" > "$sout" & ip netns exec ${listener_ns} ./mptcp_connect -t $timeout -l -p $port -s ${srv_proto} $extra_args $local_addr < "$sin" > "$sout" &
local spid=$! local spid=$!
...@@ -450,6 +458,45 @@ do_transfer() ...@@ -450,6 +458,45 @@ do_transfer()
check_transfer $cin $sout "file received by server" check_transfer $cin $sout "file received by server"
rets=$? rets=$?
local stat_synrx_now_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableSYNRX | while read a count c rest ;do echo $count;done)
local stat_ackrx_now_l=$(ip netns exec ${listener_ns} nstat -z -a MPTcpExtMPCapableACKRX | while read a count c rest ;do echo $count;done)
local stat_cookietx_now=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesSent | while read a count c rest ;do echo $count;done)
local stat_cookierx_now=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesRecv | while read a count c rest ;do echo $count;done)
expect_synrx=$((stat_synrx_last_l))
expect_ackrx=$((stat_ackrx_last_l))
cookies=$(ip netns exec ${listener_ns} sysctl net.ipv4.tcp_syncookies)
cookies=${cookies##*=}
if [ ${cl_proto} = "MPTCP" ] && [ ${srv_proto} = "MPTCP" ]; then
expect_synrx=$((stat_synrx_last_l+1))
expect_ackrx=$((stat_ackrx_last_l+1))
fi
if [ $cookies -eq 2 ];then
if [ $stat_cookietx_last -ge $stat_cookietx_now ] ;then
echo "${listener_ns} CookieSent: ${cl_proto} -> ${srv_proto}: did not advance"
fi
if [ $stat_cookierx_last -ge $stat_cookierx_now ] ;then
echo "${listener_ns} CookieRecv: ${cl_proto} -> ${srv_proto}: did not advance"
fi
else
if [ $stat_cookietx_last -ne $stat_cookietx_now ] ;then
echo "${listener_ns} CookieSent: ${cl_proto} -> ${srv_proto}: changed"
fi
if [ $stat_cookierx_last -ne $stat_cookierx_now ] ;then
echo "${listener_ns} CookieRecv: ${cl_proto} -> ${srv_proto}: changed"
fi
fi
if [ $expect_synrx -ne $stat_synrx_now_l ] ;then
echo "${listener_ns} SYNRX: ${cl_proto} -> ${srv_proto}: expect ${expect_synrx}, got ${stat_synrx_now_l}"
fi
if [ $expect_ackrx -ne $stat_ackrx_now_l ] ;then
echo "${listener_ns} ACKRX: ${cl_proto} -> ${srv_proto}: expect ${expect_synrx}, got ${stat_synrx_now_l}"
fi
if [ $retc -eq 0 ] && [ $rets -eq 0 ];then if [ $retc -eq 0 ] && [ $rets -eq 0 ];then
echo "$duration [ OK ]" echo "$duration [ OK ]"
cat "$capout" cat "$capout"
......
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