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>
This commit is contained in:
committed by
David S. Miller
parent
cafbe182a4
commit
b09bde5c35
@ -356,7 +356,7 @@ lookup_protocol:
|
||||
sk->sk_txrehash = READ_ONCE(net->core.sysctl_txrehash);
|
||||
|
||||
inet->uc_ttl = -1;
|
||||
inet->mc_loop = 1;
|
||||
inet_set_bit(MC_LOOP, sk);
|
||||
inet->mc_ttl = 1;
|
||||
inet->mc_all = 1;
|
||||
inet->mc_index = 0;
|
||||
|
@ -186,7 +186,7 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
|
||||
inet_sockopt.is_icsk = inet->is_icsk;
|
||||
inet_sockopt.freebind = inet_test_bit(FREEBIND, sk);
|
||||
inet_sockopt.hdrincl = inet_test_bit(HDRINCL, sk);
|
||||
inet_sockopt.mc_loop = inet->mc_loop;
|
||||
inet_sockopt.mc_loop = inet_test_bit(MC_LOOP, sk);
|
||||
inet_sockopt.transparent = inet->transparent;
|
||||
inet_sockopt.mc_all = inet->mc_all;
|
||||
inet_sockopt.nodefrag = inet->nodefrag;
|
||||
|
@ -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;
|
||||
|
@ -63,7 +63,7 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock,
|
||||
struct sock *sk = sock->sk;
|
||||
|
||||
/* Disable multicast loopback */
|
||||
inet_sk(sk)->mc_loop = 0;
|
||||
inet_clear_bit(MC_LOOP, sk);
|
||||
|
||||
/* Enable CHECKSUM_UNNECESSARY to CHECKSUM_COMPLETE conversion */
|
||||
inet_inc_convert_csum(sk);
|
||||
|
Reference in New Issue
Block a user