Subject: Re: [PATCH] IPv4 Multicast: prevent reception of mcast frames from unjoined groups

From: Rémi Denis-Courmont <[email-masked]>
Date: Fri, 11 Jul 2008 21:44:44 +0300

Le vendredi 11 juillet 2008 20:35:49 Neil Horman, vous avez écrit :
> So you're saying that if I take a process, call bind, specifying
> INADDR_ANY, and then call setsockopt(...,IP_ADD_MEMBERSHIP,...) specifying
> a multicast group X, that I can expect to recieve messages from other
> multicast addresses that other processes in the system have joined to? 

Yes, he says so. I am not aware of a real standard for the IPv4 socket API: 
POSIX and IETF only defined the IPv6 multicast API, it seems. That being 
noted, the Linux behavior is in accordance with RFC3493:

|     IPV6_JOIN_GROUP
|
|        Join a multicast group on a specified local interface.
|        If the interface index is specified as 0,
|        the kernel chooses the local interface.
|        For example, some kernels look up the multicast group
|        in the normal IPv6 routing table and use the resulting
|        interface.

Note the use of *interface* rather than *socket* here. And then:

|  Note that to receive multicast datagrams a process must join the
|  multicast group to which datagrams will be sent.  UDP applications
|  must also bind the UDP port to which datagrams will be sent.  Some
|  processes also bind the multicast group address to the socket, in
|  addition to the port, to prevent other datagrams destined to that
|  same port from being delivered to the socket.

-- 
Rémi Denis-Courmont
http://www.remlab.net/