diff options
author | Eric Dumazet <edumazet@google.com> | 2023-08-16 10:15:39 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-08-16 12:09:17 +0200 |
commit | b09bde5c3554d58cb711dac55a10ecc56d436966 (patch) | |
tree | f454c01e10f8a1312d9941a1867f49569b36aaa4 /net/ipv4/ip_sockglue.c | |
parent | inet: move inet->hdrincl to inet->inet_flags (diff) | |
download | linux-b09bde5c3554d58cb711dac55a10ecc56d436966.tar.xz linux-b09bde5c3554d58cb711dac55a10ecc56d436966.zip |
inet: move inet->mc_loop to inet->inet_frags
IP_MULTICAST_LOOP socket option can now be set/read
without locking the socket.
v3: fix build bot error reported in ipvs set_mcast_loop()
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 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 763456fd4f4f..be569032b612 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -993,6 +993,11 @@ int do_ip_setsockopt(struct sock *sk, int level, int optname, return -ENOPROTOOPT; inet_assign_bit(HDRINCL, sk, val); return 0; + case IP_MULTICAST_LOOP: + if (optlen < 1) + return -EINVAL; + inet_assign_bit(MC_LOOP, sk, val); + return 0; } err = 0; @@ -1083,11 +1088,6 @@ int do_ip_setsockopt(struct sock *sk, int level, int optname, goto e_inval; inet->mc_ttl = val; break; - case IP_MULTICAST_LOOP: - if (optlen < 1) - goto e_inval; - inet->mc_loop = !!val; - break; case IP_UNICAST_IF: { struct net_device *dev = NULL; @@ -1579,6 +1579,9 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, case IP_HDRINCL: val = inet_test_bit(HDRINCL, sk); goto copyval; + case IP_MULTICAST_LOOP: + val = inet_test_bit(MC_LOOP, sk); + goto copyval; } if (needs_rtnl) @@ -1653,9 +1656,6 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname, case IP_MULTICAST_TTL: val = inet->mc_ttl; break; - case IP_MULTICAST_LOOP: - val = inet->mc_loop; - break; case IP_UNICAST_IF: val = (__force int)htonl((__u32) inet->uc_index); break; |