mptcp: fix full TCP keep-alive support
Subsystems (2)
Matthieu Baerts (NGI0)
maintainerPATCH 1/1 mptcp: fix full TCP keep-alive support
commit bd11dc4fb969ec148e50cd87f88a78246dbc4d0b upstream.
SO_KEEPALIVE support has been added a while ago, as part of a series "adding SOL_SOCKET" support. To have a full control of this keep-alive feature, it is important to also support TCP_KEEP* socket options at the SOL_TCP level.
Supporting them on the setsockopt() part is easy, it is just a matter of remembering each value in the MPTCP sock structure, and calling tcp_sock_set_keep*() helpers on each subflow. If the value is not modified (0), calling these helpers will not do anything. For the getsockopt() part, the corresponding value from the MPTCP sock structure or the default one is simply returned. All of this is very similar to other TCP_* socket options supported by MPTCP.
It looks important for kernels supporting SO_KEEPALIVE, to also support TCP_KEEP* options as well: some apps seem to (wrongly) consider that if the former is supported, the latter ones will be supported as well. But also, not having this simple and isolated change is preventing MPTCP support in some apps, and libraries like GoLang [1]. This is why this patch is seen as a fix.
[ Conflicts in the same context, because commit 29b5e5ef8739 ("mptcp:
implement TCP_NOTSENT_LOWAT support") (new feature), commit 013e3179dbd2 ("mptcp: fix rcv space initialization") (not backported because of the various conflicts, and because the race fixed by this commit "does not produce ill effects in practice"), and commit 4f6e14bd19d6 ("mptcp: support TCP_CORK and TCP_NODELAY") are not in this version. The adaptations done by 7f71a337b515 ("mptcp: cleanup SOL_TCP handling") have been adapted to this case here. Also, TCP_KEEPINTVL and TCP_KEEPCNT value had to be set without lock, the same way it was done on TCP side prior commit 6fd70a6b4e6f ("tcp: set TCP_KEEPINTVL locklessly") and commit 84485080cbc1 ("tcp: set TCP_KEEPCNT locklessly"). ]
--- net/mptcp/protocol.h | 3 ++ net/mptcp/sockopt.c | 115 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+)
net/mptcp/protocol.h +3 -0
@@ -250,6 +250,9 @@ struct mptcp_sock {bool use_64bit_ack;/* Set when we received a 64-bit DSN */ bool csum_enabled;spinlock_t join_list_lock; +int keepalive_cnt; +int keepalive_idle; +int keepalive_intvl;struct work_struct work;struct sk_buff *ooo_last_skb;struct rb_root out_of_order_queue;
net/mptcp/sockopt.c +115 -0
148 lines not on this page · raw message
Signature · 1 line
2.43.0