From f736ff0213c52def1cf094056480d1d45b05e9c4 Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Sun, 1 Sep 2024 16:38:05 +0200 Subject: [PATCH 1/2] mptcp: mpc: check fallback to TCP in case of drop After 3 failed attempts, there is a fallback to TCP. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/477 Signed-off-by: Matthieu Baerts (NGI0) --- .../v1_mp_capable_connect_drop_fallback.pkt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt diff --git a/gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt b/gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt new file mode 100644 index 00000000..a72ebe6b --- /dev/null +++ b/gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt @@ -0,0 +1,27 @@ +--tolerance_usecs=100000 +`../common/defaults.sh` + +0.0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3 ++0.0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 ++0.0 getsockopt(3, SOL_TCP, TCP_IS_MPTCP, [1], [4]) = 0 ++0.0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 + +// Establish connection and verify that there is a fallback to TCP. + ++0 `nstat -n` ++0.0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) ++0.0 > S 0:0(0) ++1.0 > S 0:0(0) ++1.0 > S 0:0(0) + ++1.0 > S 0:0(0) ++0.01 < S. 0:0(0) ack 1 win 65535 ++0.0 > . 1:1(0) ack 1 + ++0.200 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 + +// Check for fallback ++0.0 getsockopt(3, SOL_TCP, TCP_IS_MPTCP, [0], [4]) = 0 ++0.01 `test $(nstat -zjs | jq '.kernel.MPTcpExtMPCapableSYNTXDrop') -eq 1` ++0.01 `test $(nstat -zjs | jq '.kernel.MPTcpExtBlackhole') -eq 1` From 7d345dd2f1c69aa0c1cb71d6f19127a077bbd0d2 Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Sun, 1 Sep 2024 16:41:54 +0200 Subject: [PATCH 2/2] mptcp: mpc: fallback if only MPTCP was dropped After 3 failed attempts, there is a fallback to TCP. If this "plain" TCP connection was a success, it likely means that MPTCP is blocked. The next connections now directly falls back to TCP. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/57 Signed-off-by: Matthieu Baerts (NGI0) --- .../v1_mp_capable_connect_drop_fallback.pkt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt b/gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt index a72ebe6b..bab7a960 100644 --- a/gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt +++ b/gtests/net/mptcp/mp_capable/v1_mp_capable_connect_drop_fallback.pkt @@ -25,3 +25,27 @@ +0.0 getsockopt(3, SOL_TCP, TCP_IS_MPTCP, [0], [4]) = 0 +0.01 `test $(nstat -zjs | jq '.kernel.MPTcpExtMPCapableSYNTXDrop') -eq 1` +0.01 `test $(nstat -zjs | jq '.kernel.MPTcpExtBlackhole') -eq 1` + ++0.01 close(3) = 0 ++0 > F. 1:1(0) ack 1 ++0.01 < F. 1:1(0) ack 2 win 92 ++0 > . 2:2(0) ack 2 + + +// Establish a new MPTCP connection and verify that there is directly a fallback to TCP. ++0.02 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 4 ++0.0 setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 ++0.0 getsockopt(4, SOL_TCP, TCP_IS_MPTCP, [1], [4]) = 0 ++0.0 fcntl(4, F_GETFL) = 0x2 (flags O_RDWR) ++0.0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0 ++0.0 connect(4, ..., ...) = -1 EINPROGRESS (Operation now in progress) + ++0.0 > S 0:0(0) ++0.01 < S. 0:0(0) ack 1 win 65535 ++0.0 > . 1:1(0) ack 1 + ++0.200 getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 + +// Check for fallback ++0.0 getsockopt(4, SOL_TCP, TCP_IS_MPTCP, [0], [4]) = 0 ++0.01 `test $(nstat -zjs | jq '.kernel.MPTcpExtMPCapableSYNTXDisabled') -eq 1`