aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_sockglue.c
diff options
context:
space:
mode:
authorNivedita Singhvi <niv@us.ibm.com>2009-05-28 03:00:46 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-02 03:45:24 -0400
commitf771bef98004d9d141b085d987a77d06669d4f4f (patch)
treedf9b7a353a8c28e71a8237d3ad65ba7f41ffab30 /net/ipv4/ip_sockglue.c
parent4d52cfbef6266092d535237ba5a4b981458ab171 (diff)
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 <niv@us.ibm.com> Signed-off-by: Christoph Lameter<cl@linux.com> Acked-by: David Stevens <dlstevens@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r--net/ipv4/ip_sockglue.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 21b0187123d6..cb49936856e0 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -453,6 +453,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
453 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | 453 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
454 (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT))) || 454 (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT))) ||
455 optname == IP_MULTICAST_TTL || 455 optname == IP_MULTICAST_TTL ||
456 optname == IP_MULTICAST_ALL ||
456 optname == IP_MULTICAST_LOOP || 457 optname == IP_MULTICAST_LOOP ||
457 optname == IP_RECVORIGDSTADDR) { 458 optname == IP_RECVORIGDSTADDR) {
458 if (optlen >= sizeof(int)) { 459 if (optlen >= sizeof(int)) {
@@ -898,6 +899,13 @@ mc_msf_out:
898 kfree(gsf); 899 kfree(gsf);
899 break; 900 break;
900 } 901 }
902 case IP_MULTICAST_ALL:
903 if (optlen < 1)
904 goto e_inval;
905 if (val != 0 && val != 1)
906 goto e_inval;
907 inet->mc_all = val;
908 break;
901 case IP_ROUTER_ALERT: 909 case IP_ROUTER_ALERT:
902 err = ip_ra_control(sk, val ? 1 : 0, NULL); 910 err = ip_ra_control(sk, val ? 1 : 0, NULL);
903 break; 911 break;
@@ -1151,6 +1159,9 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1151 release_sock(sk); 1159 release_sock(sk);
1152 return err; 1160 return err;
1153 } 1161 }
1162 case IP_MULTICAST_ALL:
1163 val = inet->mc_all;
1164 break;
1154 case IP_PKTOPTIONS: 1165 case IP_PKTOPTIONS:
1155 { 1166 {
1156 struct msghdr msg; 1167 struct msghdr msg;