Skip to content

Commit d40831b

Browse files
author
Paolo Abeni
committed
Merge branch 'mptcp-sync-the-msk-sndbuf-at-accept-time'
Matthieu Baerts says: ==================== mptcp: sync the msk->sndbuf at accept() time On passive MPTCP connections, the MPTCP socket send buffer doesn't have the expected size at accept() time. Patch 1 fixes the regression introduced in v6.7, while the following one validates the fix in the selftests. Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> ==================== Link: https://patch.msgid.link/20260420-net-mptcp-sync-sndbuf-accept-v1-0-e3523e3aeb44@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2 parents 1cb36e2 + d0576eb commit d40831b

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

net/mptcp/protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3594,7 +3594,6 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
35943594
* uses the correct data
35953595
*/
35963596
mptcp_copy_inaddrs(nsk, ssk);
3597-
__mptcp_propagate_sndbuf(nsk, ssk);
35983597

35993598
mptcp_rcv_space_init(msk, ssk);
36003599
msk->rcvq_space.time = mptcp_stamp();
@@ -4252,6 +4251,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
42524251

42534252
mptcp_graft_subflows(newsk);
42544253
mptcp_rps_record_subflows(msk);
4254+
__mptcp_propagate_sndbuf(newsk, mptcp_subflow_tcp_sock(subflow));
42554255

42564256
/* Do late cleanup for the first subflow as necessary. Also
42574257
* deal with bad peers not doing a complete shutdown.

tools/testing/selftests/net/mptcp/diag.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,33 @@ wait_connected()
322322
done
323323
}
324324

325+
chk_sndbuf()
326+
{
327+
local server_sndbuf client_sndbuf msg
328+
local port=${1}
329+
330+
msg="....chk sndbuf server/client"
331+
server_sndbuf=$(ss -N "${ns}" -inmHM "sport" "${port}" | \
332+
sed -n 's/.*tb\([0-9]\+\).*/\1/p')
333+
client_sndbuf=$(ss -N "${ns}" -inmHM "dport" "${port}" | \
334+
sed -n 's/.*tb\([0-9]\+\).*/\1/p')
335+
336+
mptcp_lib_print_title "${msg}"
337+
if [ -z "${server_sndbuf}" ] || [ -z "${client_sndbuf}" ]; then
338+
mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} C=${client_sndbuf}"
339+
mptcp_lib_result_fail "${msg}"
340+
ret=${KSFT_FAIL}
341+
elif [ "${server_sndbuf}" != "${client_sndbuf}" ]; then
342+
mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} != C=${client_sndbuf}"
343+
mptcp_lib_result_fail "${msg}"
344+
ret=${KSFT_FAIL}
345+
else
346+
mptcp_lib_pr_ok
347+
mptcp_lib_result_pass "${msg}"
348+
fi
349+
}
350+
351+
325352
trap cleanup EXIT
326353
mptcp_lib_ns_init ns
327354

@@ -341,6 +368,7 @@ echo "b" | \
341368
127.0.0.1 >/dev/null &
342369
wait_connected $ns 10000
343370
chk_msk_nr 2 "after MPC handshake"
371+
chk_sndbuf 10000
344372
chk_last_time_info 10000
345373
chk_msk_remote_key_nr 2 "....chk remote_key"
346374
chk_msk_fallback_nr 0 "....chk no fallback"

0 commit comments

Comments
 (0)