diff options
author | Eric Dumazet <edumazet@google.com> | 2023-08-16 11:15:44 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-08-16 13:09:17 +0300 |
commit | ca571e2eb7eb6202aa367e01c811aab023272f38 (patch) | |
tree | 00d2396e709e8e8274a64205378a81cc95045825 /net/ipv4/ip_sockglue.c | |
parent | f04b8d3478a3a63f17d8dc0dc6da16a828b48df0 (diff) | |
download | linux-ca571e2eb7eb6202aa367e01c811aab023272f38.tar.xz |
inet: move inet->bind_address_no_port to inet->inet_flags
IP_BIND_ADDRESS_NO_PORT socket option can now be set/read
without locking the socket.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r-- | net/ipv4/ip_sockglue.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index ec946c13ea20..cfa65a0b0900 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -1020,6 +1020,9 @@ int do_ip_setsockopt(struct sock *sk, int level, int optname, return -ENOPROTOOPT; inet_assign_bit(NODEFRAG, sk, val); return 0; + case IP_BIND_ADDRESS_NO_PORT: + inet_assign_bit(BIND_ADDRESS_NO_PORT, sk, val); + return 0; } err = 0; @@ -1084,9 +1087,6 @@ int do_ip_setsockopt(struct sock *sk, int level, int optname, goto e_inval; inet->uc_ttl = val; break; - case IP_BIND_ADDRESS_NO_PORT: - inet->bind_address_no_port = val ? 1 : 0; - break; case IP_MTU_DISCOVER: if (val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_OMIT) goto e_inval; @@ -1587,6 +1587,9 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, case IP_NODEFRAG: val = inet_test_bit(NODEFRAG, sk); goto copyval; + case IP_BIND_ADDRESS_NO_PORT: + val = inet_test_bit(BIND_ADDRESS_NO_PORT, sk); + goto copyval; } if (needs_rtnl) @@ -1634,9 +1637,6 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, inet->uc_ttl); break; } - case IP_BIND_ADDRESS_NO_PORT: - val = inet->bind_address_no_port; - break; case IP_MTU_DISCOVER: val = inet->pmtudisc; break; |