mptcp: add TCP_MAXSEG sockopt support
authorGeliang Tang <tanggeliang@kylinos.cn>
Fri, 18 Jul 2025 22:06:58 +0000 (00:06 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 22 Jul 2025 00:48:33 +0000 (17:48 -0700)
commit51c5fd09e1b457eed103a22893603fb83a818162
tree3feb12435cd51cba37fc64fac3e14791b9513871
parent51a62199a8aaac0d1645b1dd8e670a6f35aead81
mptcp: add TCP_MAXSEG sockopt support

The TCP_MAXSEG socket option is currently not supported by MPTCP, mainly
because it has never been requested before. But there are still valid
use-cases, e.g. with HAProxy.

This patch adds its support in MPTCP by propagating the value to all
subflows. The get part looks at the value on the first subflow, to be as
closed as possible to TCP. Only one value can be returned for the cached
MSS, so this can come only from one subflow.

Similar to mptcp_setsockopt_first_sf_only(), a generic helper
mptcp_setsockopt_all_subflows() is added to set sockopt for each
subflows of the mptcp socket.

Add a new member for struct mptcp_sock to store the TCP_MAXSEG value,
and return this value in getsockopt.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/515
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20250719-net-next-mptcp-tcp_maxseg-v2-3-8c910fbc5307@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/protocol.h
net/mptcp/sockopt.c