diff options
author | Eric Dumazet <edumazet@google.com> | 2023-08-16 10:15:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-08-16 12:09:17 +0200 |
commit | 8e8cfb114d9f1e2efddb892f993c1ad61635c85e (patch) | |
tree | 88c0a039aec470e4de049c64b008af3c6408c095 /net/ipv4/ip_sockglue.c | |
parent | inet: move inet->recverr to inet->inet_flags (diff) | |
download | linux-8e8cfb114d9f1e2efddb892f993c1ad61635c85e.tar.xz linux-8e8cfb114d9f1e2efddb892f993c1ad61635c85e.zip |
inet: move inet->recverr_rfc4884 to inet->inet_flags
IP_RECVERR_RFC4884 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 | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 8283d862a9db..f75f44ad7b11 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -433,7 +433,7 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, serr->port = port; if (skb_pull(skb, payload - skb->data)) { - if (inet_sk(sk)->recverr_rfc4884) + if (inet_test_bit(RECVERR_RFC4884, sk)) ipv4_icmp_error_rfc4884(skb, &serr->ee.ee_rfc4884); skb_reset_transport_header(skb); @@ -980,6 +980,11 @@ int do_ip_setsockopt(struct sock *sk, int level, int optname, if (!val) skb_queue_purge(&sk->sk_error_queue); return 0; + case IP_RECVERR_RFC4884: + if (val < 0 || val > 1) + return -EINVAL; + inet_assign_bit(RECVERR_RFC4884, sk, val); + return 0; } err = 0; @@ -1066,11 +1071,6 @@ int do_ip_setsockopt(struct sock *sk, int level, int optname, goto e_inval; inet->pmtudisc = val; break; - case IP_RECVERR_RFC4884: - if (val < 0 || val > 1) - goto e_inval; - inet->recverr_rfc4884 = !!val; - break; case IP_MULTICAST_TTL: if (sk->sk_type == SOCK_STREAM) goto e_inval; @@ -1575,6 +1575,9 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, case IP_RECVERR: val = inet_test_bit(RECVERR, sk); goto copyval; + case IP_RECVERR_RFC4884: + val = inet_test_bit(RECVERR_RFC4884, sk); + goto copyval; } if (needs_rtnl) @@ -1649,9 +1652,6 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, } break; } - case IP_RECVERR_RFC4884: - val = inet->recverr_rfc4884; - break; case IP_MULTICAST_TTL: val = inet->mc_ttl; break; |