[PATCH mptcp-next v2 1/5] mptcp: copy the subflow's tos to the msk on accept

Geliang Tang <[email protected]> Sun, 26 Jul 2026 16:43:40 +0800
Newsgroups dev.linux.lists.mptcp
Message-ID <e07e2a150fbaf65b4bfc6c84c01bb7e348a4dc0a.1785054808.git.tanggeliang@kylinos.cn>
From: Geliang Tang <[email protected]>

mptcp_sk_clone_init() now copies both inet->tos and inet->rcv_tos
from the first subflow onto the accepted msk, mirroring plain TCP's
tcp_v4_syn_recv_sock() which sets both fields from ip_hdr(skb)->tos on
the accepted socket. Without this, MP_JOIN'd subflows would inherit
tos=0 from the msk and lose the peer's reflected value.

Signed-off-by: Geliang Tang <[email protected]>
---
 net/mptcp/protocol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 954e20bb27de..1152f1d0c24f 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3699,6 +3699,9 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
 #endif
 		mptcp_copy_ip_options(nsk, sk);
 
+	inet_sk(nsk)->rcv_tos = inet_sk(ssk)->rcv_tos;
+	inet_sk(nsk)->tos = inet_sk(ssk)->tos;
+
 	msk = mptcp_sk(nsk);
 	WRITE_ONCE(msk->local_key, subflow_req->local_key);
 	WRITE_ONCE(msk->token, subflow_req->token);
-- 
2.53.0