Hi Jakub,
On Thu, 2026-05-28 at 08:23 -0700, Jakub Kicinski wrote:
> On Thu, 28 May 2026 11:10:36 +0800 Geliang Tang wrote:
> > Dedicated MPTCP helpers are introduced for setting accept socket
> > options.
> > These helpers (no_linger, set_priority, set_tos) set the values on
> > all
> > existing subflows using mptcp_for_each_subflow(). The values are
> > then
> > synchronized to other newly created subflows in
> > sync_socket_options().
>
> These are not protocol specific options, why do we have to export
> MPTCP-specific functions for them?
Thank you for reading the code. In addition to the three MPTCP-specific
functions implemented in this patch, I have implemented and exported
the following six MPTCP-specific functions throughout the series:
void mptcp_sock_set_nodelay(struct sock *sk)
int mptcp_sock_set_syncnt(struct sock *sk, int val)
void mptcp_sock_set_tos(struct sock *sk, int val)
void mptcp_sock_no_linger(struct sock *sk)
void mptcp_sock_set_priority(struct sock *sk, u32 priority)
void mptcp_sock_set_reuseaddr(struct sock *sk)
These correspond to the following six functions originally used for
TCP:
tcp_sock_set_nodelay()
tcp_sock_set_syncnt()
ip_sock_set_tos()
sock_no_linger()
sock_set_priority()
sock_set_reuseaddr()
The first two functions - tcp_sock_set_nodelay() and
tcp_sock_set_syncnt() - cannot be directly used with an MPTCP socket.
In fact, passing an MPTCP socket to tcp_sock_set_nodelay() even causes
a crash. Therefore I implemented these two MPTCP-specific functions.
Actually, a better approach would be to add protocol-independent
sock_set_nodelay() and sock_set_syncnt() in net/core/sock.c.
The third function, ip_sock_set_tos(), takes different arguments for
TCP vs. MPTCP. For MPTCP, it needs to pass inet_sk(msk->first)-
>rcv_tos, so I implemented an MPTCP-specific function.
The last three functions - sock_no_linger(), sock_set_priority(), and
sock_set_reuseaddr() - are not protocol-specific, but attributes set on
the MPTCP socket cannot be synchronized to its subflows because
mptcp_sockopt_sync_locked() checks msk->setsockopt_seq. Thus I
implemented these three MPTCP-specific functions, explicitly calling
sockopt_seq_inc(msk) inside them to increment msk->setsockopt_seq, so
that mptcp_sockopt_sync_locked() can properly synchronize the
attributes to all subflows. There should be a better solution for this,
and I will discuss it with @Matt.
Please give me some advice.
Thanks,
-Geliang