[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090529103556.GA4160@hmsreliant.think-freely.org>
Date: Fri, 29 May 2009 06:35:56 -0400
From: Neil Horman <nhorman@...driver.com>
To: Nivedita Singhvi <niv@...ibm.com>
Cc: netdev <netdev@...r.kernel.org>,
David Stevens <dlstevens@...ibm.com>,
Christoph Lameter <cl@...ux.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] Multicast socket option
On Thu, May 28, 2009 at 10:00:46AM -0700, Nivedita Singhvi wrote:
> 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@...ibm.com>
> Signed-off-by: Christoph Lameter<cl@...ux.com>
> Acked-by: David Stevens <dlstevens@...ibm.com>
>
>
> diff -urN linux-2.6.29.2/include/linux/in.h linux-2.6.29.2.new/include/linux/in.h
> --- linux-2.6.29.2/include/linux/in.h 2009-04-27 13:37:11.000000000 -0400
> +++ linux-2.6.29.2.new/include/linux/in.h 2009-05-18 16:22:06.000000000 -0400
> @@ -107,6 +107,7 @@
> #define MCAST_JOIN_SOURCE_GROUP 46
> #define MCAST_LEAVE_SOURCE_GROUP 47
> #define MCAST_MSFILTER 48
> +#define IP_MULTICAST_ALL 49
>
> #define MCAST_EXCLUDE 0
> #define MCAST_INCLUDE 1
> diff -urN linux-2.6.29.2/include/net/inet_sock.h linux-2.6.29.2.new/include/net/inet_sock.h
> --- linux-2.6.29.2/include/net/inet_sock.h 2009-04-27 13:37:11.000000000 -0400
> +++ linux-2.6.29.2.new/include/net/inet_sock.h 2009-05-18 16:22:06.000000000 -0400
> @@ -130,7 +130,8 @@
> freebind:1,
> hdrincl:1,
> mc_loop:1,
> - transparent:1;
> + transparent:1,
> + mc_all:1;
> int mc_index;
> __be32 mc_addr;
> struct ip_mc_socklist *mc_list;
> diff -urN linux-2.6.29.2/net/ipv4/af_inet.c linux-2.6.29.2.new/net/ipv4/af_inet.c
> --- linux-2.6.29.2/net/ipv4/af_inet.c 2009-04-27 13:37:11.000000000 -0400
> +++ linux-2.6.29.2.new/net/ipv4/af_inet.c 2009-05-18 16:22:06.000000000 -0400
> @@ -376,6 +376,7 @@
> inet->uc_ttl = -1;
> inet->mc_loop = 1;
> inet->mc_ttl = 1;
> + inet->mc_all = 1;
> inet->mc_index = 0;
> inet->mc_list = NULL;
>
> diff -urN linux-2.6.29.2/net/ipv4/igmp.c linux-2.6.29.2.new/net/ipv4/igmp.c
> --- linux-2.6.29.2/net/ipv4/igmp.c 2009-04-27 13:37:11.000000000 -0400
> +++ linux-2.6.29.2.new/net/ipv4/igmp.c 2009-05-18 16:22:33.000000000 -0400
> @@ -2196,7 +2196,7 @@
> break;
> }
> if (!pmc)
> - return 1;
> + return inet->mc_all;
This change also filters out broadcasts sent to sockets listening on a given
port. Is that what you want?
Neil
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists