linux-stable/net/mptcp
Matthieu Baerts (NGI0) 874aae15fb mptcp: fix full TCP keep-alive support
commit bd11dc4fb9 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.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/383
Fixes: 1b3e7ede13 ("mptcp: setsockopt: handle SO_KEEPALIVE and SO_PRIORITY")
Link: https://github.com/golang/go/issues/56539 [1]
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Mat Martineau <martineau@kernel.org>
Link: https://lore.kernel.org/r/20240514011335.176158-3-martineau@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Conflicts in the same context, because commit 29b5e5ef87 ("mptcp:
  implement TCP_NOTSENT_LOWAT support") (new feature), commit
  013e3179db ("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
  4f6e14bd19 ("mptcp: support TCP_CORK and TCP_NODELAY") are not in
  this version. The adaptations done by 7f71a337b5 ("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 6fd70a6b4e ("tcp: set
  TCP_KEEPINTVL locklessly") and commit 84485080cb ("tcp: set
  TCP_KEEPCNT locklessly"). ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:39:54 +02:00
..
Kconfig
Makefile
crypto.c
crypto_test.c
ctrl.c mptcp: faster active backup recovery 2021-08-14 11:37:25 +01:00
diag.c mptcp: fix possible deadlock in subflow diag 2024-03-06 14:38:49 +00:00
mib.c mptcp: add mibs counter for ignored incoming options 2022-03-02 11:47:53 +01:00
mib.h mptcp: add mibs counter for ignored incoming options 2022-03-02 11:47:53 +01:00
mptcp_diag.c net: inet: Retire port only listening_hash 2023-11-28 16:56:22 +00:00
options.c mptcp: drop unused sk in mptcp_get_options 2024-01-25 14:52:53 -08:00
pm.c mptcp: add mibs counter for ignored incoming options 2022-03-02 11:47:53 +01:00
pm_netlink.c mptcp: add needs_id for netlink appending addr 2024-03-06 14:38:49 +00:00
protocol.c mptcp: ensure snd_nxt is properly initialized on connect 2024-05-17 11:51:03 +02:00
protocol.h mptcp: fix full TCP keep-alive support 2024-06-16 13:39:54 +02:00
sockopt.c mptcp: fix full TCP keep-alive support 2024-06-16 13:39:54 +02:00
subflow.c mptcp: don't account accept() of non-MPC client as fallback to TCP 2024-04-10 16:19:43 +02:00
syncookies.c mptcp: don't return sockets in foreign netns 2021-09-24 10:51:36 +01:00
token.c mptcp: don't return sockets in foreign netns 2021-09-24 10:51:36 +01:00
token_test.c mptcp: don't return sockets in foreign netns 2021-09-24 10:51:36 +01:00