mptcp: add TCP_FASTOPEN_NO_COOKIE support
authorMatthieu Baerts <matthieu.baerts@tessares.net>
Sat, 22 Oct 2022 00:45:04 +0000 (17:45 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 25 Oct 2022 10:32:54 +0000 (12:32 +0200)
The goal of this socket option is to configure MPTCP + TFO without
cookie per socket.

It was already possible to enable TFO without a cookie per netns by
setting net.ipv4.tcp_fastopen sysctl knob to the right value. Per route
was also supported by setting 'fastopen_no_cookie' option. This patch
adds a per socket support like it is possible to do with TCP thanks to
TCP_FASTOPEN_NO_COOKIE socket option.

The only thing to do here is to relay the request to the first subflow
like it is already done for TCP_FASTOPEN_CONNECT.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/mptcp/sockopt.c

index 8d3b09d..1857281 100644 (file)
@@ -560,6 +560,7 @@ static bool mptcp_supported_sockopt(int level, int optname)
                case TCP_TX_DELAY:
                case TCP_INQ:
                case TCP_FASTOPEN_CONNECT:
+               case TCP_FASTOPEN_NO_COOKIE:
                        return true;
                }
 
@@ -568,8 +569,8 @@ static bool mptcp_supported_sockopt(int level, int optname)
                /* TCP_REPAIR, TCP_REPAIR_QUEUE, TCP_QUEUE_SEQ, TCP_REPAIR_OPTIONS,
                 * TCP_REPAIR_WINDOW are not supported, better avoid this mess
                 */
-               /* TCP_FASTOPEN_KEY, TCP_FASTOPEN, TCP_FASTOPEN_NO_COOKIE,
-                * are not supported fastopen is currently unsupported
+               /* TCP_FASTOPEN_KEY, TCP_FASTOPEN are not supported because
+                * fastopen for the listener side is currently unsupported
                 */
        }
        return false;
@@ -811,6 +812,7 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
        case TCP_DEFER_ACCEPT:
                return mptcp_setsockopt_sol_tcp_defer(msk, optval, optlen);
        case TCP_FASTOPEN_CONNECT:
+       case TCP_FASTOPEN_NO_COOKIE:
                return mptcp_setsockopt_first_sf_only(msk, SOL_TCP, optname,
                                                      optval, optlen);
        }
@@ -1175,6 +1177,7 @@ static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
        case TCP_CC_INFO:
        case TCP_DEFER_ACCEPT:
        case TCP_FASTOPEN_CONNECT:
+       case TCP_FASTOPEN_NO_COOKIE:
                return mptcp_getsockopt_first_sf_only(msk, SOL_TCP, optname,
                                                      optval, optlen);
        case TCP_INQ: