diff options
author | Paolo Abeni <pabeni@redhat.com> | 2022-10-20 19:48:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-10-24 10:52:50 +0100 |
commit | a5ef058dc4d9a3e60d1808a0700e18e0e37e408e (patch) | |
tree | 2cda419cd35a4ed16b361aeb82b25a5f55675a0a /net/socket.c | |
parent | ea5ed0f00b07d5aba09189729d54751c98494f25 (diff) | |
download | lwn-a5ef058dc4d9a3e60d1808a0700e18e0e37e408e.tar.gz lwn-a5ef058dc4d9a3e60d1808a0700e18e0e37e408e.zip |
net: introduce and use custom sockopt socket flag
We will soon introduce custom setsockopt for UDP sockets, too.
Instead of doing even more complex arbitrary checks inside
sock_use_custom_sol_socket(), add a new socket flag and set it
for the relevant socket types (currently only MPTCP).
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/net/socket.c b/net/socket.c index 00da9ce3dba0..55c5d536e5f6 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2199,13 +2199,7 @@ SYSCALL_DEFINE4(recv, int, fd, void __user *, ubuf, size_t, size, static bool sock_use_custom_sol_socket(const struct socket *sock) { - const struct sock *sk = sock->sk; - - /* Use sock->ops->setsockopt() for MPTCP */ - return IS_ENABLED(CONFIG_MPTCP) && - sk->sk_protocol == IPPROTO_MPTCP && - sk->sk_type == SOCK_STREAM && - (sk->sk_family == AF_INET || sk->sk_family == AF_INET6); + return test_bit(SOCK_CUSTOM_SOCKOPT, &sock->flags); } /* |