Commit d3d42904 authored by Matthieu Baerts's avatar Matthieu Baerts Committed by Paolo Abeni

mptcp: sockopt: make 'tcp_fastopen_connect' generic

There are other socket options that need to act only on the first
subflow, e.g. all TCP_FASTOPEN* socket options.

This is similar to the getsockopt version.

In the next commit, this new mptcp_setsockopt_first_sf_only() helper is
used by other another option.
Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 818a2604
...@@ -769,17 +769,17 @@ static int mptcp_setsockopt_sol_tcp_defer(struct mptcp_sock *msk, sockptr_t optv ...@@ -769,17 +769,17 @@ static int mptcp_setsockopt_sol_tcp_defer(struct mptcp_sock *msk, sockptr_t optv
return tcp_setsockopt(listener->sk, SOL_TCP, TCP_DEFER_ACCEPT, optval, optlen); return tcp_setsockopt(listener->sk, SOL_TCP, TCP_DEFER_ACCEPT, optval, optlen);
} }
static int mptcp_setsockopt_sol_tcp_fastopen_connect(struct mptcp_sock *msk, sockptr_t optval, static int mptcp_setsockopt_first_sf_only(struct mptcp_sock *msk, int level, int optname,
unsigned int optlen) sockptr_t optval, unsigned int optlen)
{ {
struct socket *sock; struct socket *sock;
/* Limit to first subflow */ /* Limit to first subflow, before the connection establishment */
sock = __mptcp_nmpc_socket(msk); sock = __mptcp_nmpc_socket(msk);
if (!sock) if (!sock)
return -EINVAL; return -EINVAL;
return tcp_setsockopt(sock->sk, SOL_TCP, TCP_FASTOPEN_CONNECT, optval, optlen); return tcp_setsockopt(sock->sk, level, optname, optval, optlen);
} }
static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
...@@ -811,7 +811,8 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, ...@@ -811,7 +811,8 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
case TCP_DEFER_ACCEPT: case TCP_DEFER_ACCEPT:
return mptcp_setsockopt_sol_tcp_defer(msk, optval, optlen); return mptcp_setsockopt_sol_tcp_defer(msk, optval, optlen);
case TCP_FASTOPEN_CONNECT: case TCP_FASTOPEN_CONNECT:
return mptcp_setsockopt_sol_tcp_fastopen_connect(msk, optval, optlen); return mptcp_setsockopt_first_sf_only(msk, SOL_TCP, optname,
optval, optlen);
} }
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment