mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
ipv4: New multicast-all socket option
After some discussion offline with Christoph Lameter and David Stevens regarding multicast behaviour in Linux, I'm submitting a slightly modified patch from the one Christoph submitted earlier. This patch provides a new socket option IP_MULTICAST_ALL. In this case, default behaviour is _unchanged_ from the current Linux standard. The socket option is set by default to provide original behaviour. Sockets wishing to receive data only from multicast groups they join explicitly will need to clear this socket option. Signed-off-by: Nivedita Singhvi <[email protected]> Signed-off-by: Christoph Lameter<[email protected]> Acked-by: David Stevens <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
4d52cfbef6
commit
f771bef980
5 changed files with 16 additions and 2 deletions
|
|
@ -375,6 +375,7 @@ lookup_protocol:
|
|||
inet->uc_ttl = -1;
|
||||
inet->mc_loop = 1;
|
||||
inet->mc_ttl = 1;
|
||||
inet->mc_all = 1;
|
||||
inet->mc_index = 0;
|
||||
inet->mc_list = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -2196,7 +2196,7 @@ int ip_mc_sf_allow(struct sock *sk, __be32 loc_addr, __be32 rmt_addr, int dif)
|
|||
break;
|
||||
}
|
||||
if (!pmc)
|
||||
return 1;
|
||||
return inet->mc_all;
|
||||
psl = pmc->sflist;
|
||||
if (!psl)
|
||||
return pmc->sfmode == MCAST_EXCLUDE;
|
||||
|
|
|
|||
|
|
@ -453,6 +453,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
|
|||
(1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
|
||||
(1<<IP_PASSSEC) | (1<<IP_TRANSPARENT))) ||
|
||||
optname == IP_MULTICAST_TTL ||
|
||||
optname == IP_MULTICAST_ALL ||
|
||||
optname == IP_MULTICAST_LOOP ||
|
||||
optname == IP_RECVORIGDSTADDR) {
|
||||
if (optlen >= sizeof(int)) {
|
||||
|
|
@ -898,6 +899,13 @@ mc_msf_out:
|
|||
kfree(gsf);
|
||||
break;
|
||||
}
|
||||
case IP_MULTICAST_ALL:
|
||||
if (optlen < 1)
|
||||
goto e_inval;
|
||||
if (val != 0 && val != 1)
|
||||
goto e_inval;
|
||||
inet->mc_all = val;
|
||||
break;
|
||||
case IP_ROUTER_ALERT:
|
||||
err = ip_ra_control(sk, val ? 1 : 0, NULL);
|
||||
break;
|
||||
|
|
@ -1151,6 +1159,9 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
|
|||
release_sock(sk);
|
||||
return err;
|
||||
}
|
||||
case IP_MULTICAST_ALL:
|
||||
val = inet->mc_all;
|
||||
break;
|
||||
case IP_PKTOPTIONS:
|
||||
{
|
||||
struct msghdr msg;
|
||||
|
|
|
|||
Loading…
Reference in a new issue