1 From 7a1b3490f47e88ec4cbde65f1a77a0f4bc972282 Mon Sep 17 00:00:00 2001
2 From: Davide Caratti <dcaratti@redhat.com>
3 Date: Fri, 29 Mar 2024 13:08:52 +0100
4 Subject: mptcp: don't account accept() of non-MPC client as fallback to TCP
6 From: Davide Caratti <dcaratti@redhat.com>
8 commit 7a1b3490f47e88ec4cbde65f1a77a0f4bc972282 upstream.
10 Current MPTCP servers increment MPTcpExtMPCapableFallbackACK when they
11 accept non-MPC connections. As reported by Christoph, this is "surprising"
12 because the counter might become greater than MPTcpExtMPCapableSYNRX.
14 MPTcpExtMPCapableFallbackACK counter's name suggests it should only be
15 incremented when a connection was seen using MPTCP options, then a
16 fallback to TCP has been done. Let's do that by incrementing it when
17 the subflow context of an inbound MPC connection attempt is dropped.
18 Also, update mptcp_connect.sh kselftest, to ensure that the
19 above MIB does not increment in case a pure TCP client connects to a
22 Fixes: fc518953bc9c ("mptcp: add and use MIB counter infrastructure")
23 Cc: stable@vger.kernel.org
24 Reported-by: Christoph Paasch <cpaasch@apple.com>
25 Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/449
26 Signed-off-by: Davide Caratti <dcaratti@redhat.com>
27 Reviewed-by: Mat Martineau <martineau@kernel.org>
28 Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
29 Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
30 Link: https://lore.kernel.org/r/20240329-upstream-net-20240329-fallback-mib-v1-1-324a8981da48@kernel.org
31 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
32 Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
33 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35 net/mptcp/protocol.c | 3 ---
36 net/mptcp/subflow.c | 2 ++
37 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 7 +++++++
38 3 files changed, 9 insertions(+), 3 deletions(-)
40 --- a/net/mptcp/protocol.c
41 +++ b/net/mptcp/protocol.c
42 @@ -3349,9 +3349,6 @@ static struct sock *mptcp_accept(struct
44 newsk = new_mptcp_sock;
45 MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEPASSIVEACK);
47 - MPTCP_INC_STATS(sock_net(sk),
48 - MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK);
52 --- a/net/mptcp/subflow.c
53 +++ b/net/mptcp/subflow.c
54 @@ -816,6 +816,8 @@ dispose_child:
59 + SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK);
60 mptcp_subflow_drop_ctx(child);
63 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
64 +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
65 @@ -439,6 +439,7 @@ do_transfer()
66 local stat_cookierx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesRecv")
67 local stat_csum_err_s=$(get_mib_counter "${listener_ns}" "MPTcpExtDataCsumErr")
68 local stat_csum_err_c=$(get_mib_counter "${connector_ns}" "MPTcpExtDataCsumErr")
69 + local stat_tcpfb_last_l=$(get_mib_counter "${listener_ns}" "MPTcpExtMPCapableFallbackACK")
71 timeout ${timeout_test} \
72 ip netns exec ${listener_ns} \
73 @@ -504,6 +505,7 @@ do_transfer()
74 local stat_cookietx_now=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesSent")
75 local stat_cookierx_now=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesRecv")
76 local stat_ooo_now=$(get_mib_counter "${listener_ns}" "TcpExtTCPOFOQueue")
77 + local stat_tcpfb_now_l=$(get_mib_counter "${listener_ns}" "MPTcpExtMPCapableFallbackACK")
79 expect_synrx=$((stat_synrx_last_l))
80 expect_ackrx=$((stat_ackrx_last_l))
81 @@ -548,6 +550,11 @@ do_transfer()
85 + if [ ${stat_ooo_now} -eq 0 ] && [ ${stat_tcpfb_last_l} -ne ${stat_tcpfb_now_l} ]; then
86 + printf "[ FAIL ]\nunexpected fallback to TCP"
90 if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then