]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/mptcp-don-t-account-accept-of-non-mpc-client-as-fallback-to-tcp.patch
fd53f0fa13d74e710dad9191dae92bfe718c9037
[thirdparty/kernel/stable-queue.git] / queue-6.6 / mptcp-don-t-account-accept-of-non-mpc-client-as-fallback-to-tcp.patch
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
5
6 From: Davide Caratti <dcaratti@redhat.com>
7
8 commit 7a1b3490f47e88ec4cbde65f1a77a0f4bc972282 upstream.
9
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.
13
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
20 MPTCP server.
21
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>
34 ---
35 net/mptcp/protocol.c | 2 --
36 net/mptcp/subflow.c | 2 ++
37 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 9 +++++++++
38 3 files changed, 11 insertions(+), 2 deletions(-)
39
40 --- a/net/mptcp/protocol.c
41 +++ b/net/mptcp/protocol.c
42 @@ -3911,8 +3911,6 @@ static int mptcp_stream_accept(struct so
43 mptcp_set_state(newsk, TCP_CLOSE);
44 }
45 } else {
46 - MPTCP_INC_STATS(sock_net(ssk),
47 - MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK);
48 tcpfallback:
49 newsk->sk_kern_sock = kern;
50 lock_sock(newsk);
51 --- a/net/mptcp/subflow.c
52 +++ b/net/mptcp/subflow.c
53 @@ -905,6 +905,8 @@ dispose_child:
54 return child;
55
56 fallback:
57 + if (fallback)
58 + SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK);
59 mptcp_subflow_drop_ctx(child);
60 return child;
61 }
62 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
63 +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
64 @@ -433,12 +433,14 @@ do_transfer()
65 local stat_cookierx_last
66 local stat_csum_err_s
67 local stat_csum_err_c
68 + local stat_tcpfb_last_l
69 stat_synrx_last_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableSYNRX")
70 stat_ackrx_last_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableACKRX")
71 stat_cookietx_last=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesSent")
72 stat_cookierx_last=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesRecv")
73 stat_csum_err_s=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtDataCsumErr")
74 stat_csum_err_c=$(mptcp_lib_get_counter "${connector_ns}" "MPTcpExtDataCsumErr")
75 + stat_tcpfb_last_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableFallbackACK")
76
77 timeout ${timeout_test} \
78 ip netns exec ${listener_ns} \
79 @@ -506,11 +508,13 @@ do_transfer()
80 local stat_cookietx_now
81 local stat_cookierx_now
82 local stat_ooo_now
83 + local stat_tcpfb_now_l
84 stat_synrx_now_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableSYNRX")
85 stat_ackrx_now_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableACKRX")
86 stat_cookietx_now=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesSent")
87 stat_cookierx_now=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtSyncookiesRecv")
88 stat_ooo_now=$(mptcp_lib_get_counter "${listener_ns}" "TcpExtTCPOFOQueue")
89 + stat_tcpfb_now_l=$(mptcp_lib_get_counter "${listener_ns}" "MPTcpExtMPCapableFallbackACK")
90
91 expect_synrx=$((stat_synrx_last_l))
92 expect_ackrx=$((stat_ackrx_last_l))
93 @@ -564,6 +568,11 @@ do_transfer()
94 mptcp_lib_result_fail "${TEST_GROUP}: ${result_msg}"
95 fi
96
97 + if [ ${stat_ooo_now} -eq 0 ] && [ ${stat_tcpfb_last_l} -ne ${stat_tcpfb_now_l} ]; then
98 + mptcp_lib_pr_fail "unexpected fallback to TCP"
99 + rets=1
100 + fi
101 +
102 if [ $cookies -eq 2 ];then
103 if [ $stat_cookietx_last -ge $stat_cookietx_now ] ;then
104 printf " WARN: CookieSent: did not advance"