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>
This commit is contained in:
Paolo Abeni 2026-04-23 13:20:24 +02:00
commit d40831b016
2 changed files with 29 additions and 1 deletions

View File

@ -3594,7 +3594,6 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
* uses the correct data
*/
mptcp_copy_inaddrs(nsk, ssk);
__mptcp_propagate_sndbuf(nsk, ssk);
mptcp_rcv_space_init(msk, ssk);
msk->rcvq_space.time = mptcp_stamp();
@ -4252,6 +4251,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
mptcp_graft_subflows(newsk);
mptcp_rps_record_subflows(msk);
__mptcp_propagate_sndbuf(newsk, mptcp_subflow_tcp_sock(subflow));
/* Do late cleanup for the first subflow as necessary. Also
* deal with bad peers not doing a complete shutdown.

View File

@ -322,6 +322,33 @@ wait_connected()
done
}
chk_sndbuf()
{
local server_sndbuf client_sndbuf msg
local port=${1}
msg="....chk sndbuf server/client"
server_sndbuf=$(ss -N "${ns}" -inmHM "sport" "${port}" | \
sed -n 's/.*tb\([0-9]\+\).*/\1/p')
client_sndbuf=$(ss -N "${ns}" -inmHM "dport" "${port}" | \
sed -n 's/.*tb\([0-9]\+\).*/\1/p')
mptcp_lib_print_title "${msg}"
if [ -z "${server_sndbuf}" ] || [ -z "${client_sndbuf}" ]; then
mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} C=${client_sndbuf}"
mptcp_lib_result_fail "${msg}"
ret=${KSFT_FAIL}
elif [ "${server_sndbuf}" != "${client_sndbuf}" ]; then
mptcp_lib_pr_fail "sndbuf S=${server_sndbuf} != C=${client_sndbuf}"
mptcp_lib_result_fail "${msg}"
ret=${KSFT_FAIL}
else
mptcp_lib_pr_ok
mptcp_lib_result_pass "${msg}"
fi
}
trap cleanup EXIT
mptcp_lib_ns_init ns
@ -341,6 +368,7 @@ echo "b" | \
127.0.0.1 >/dev/null &
wait_connected $ns 10000
chk_msk_nr 2 "after MPC handshake"
chk_sndbuf 10000
chk_last_time_info 10000
chk_msk_remote_key_nr 2 "....chk remote_key"
chk_msk_fallback_nr 0 "....chk no fallback"