Subject: Re: kern/23221: setsockopt IP_ADD_MEMBERSHIP arguments not honored
To: William A.Carrel <william.a@carrel.org>
From: Nick Amato <naamato@nexthop.com>
List: tech-net
Date: 10/24/2003 17:06:29
William A.Carrel wrote:
> On Friday, October 24, 2003, at 3:39AM, Robert Elz wrote:
>
> Potentially, I could go ask for the complete network configuration for
> the machine and try to use the source address on the packet to help me
> determine where the packet came from so I can intelligently send the
> response. This won't work as soon as I stop talking about link-local
> multicast though, as the addresses may not provide me with an adequate
> clue as to where the packets came from. Plus caring a whole lot about
> the source address on the packet seems somewhat antithetical to how to
> play and win a multicast environment. This mucking about would not be
> required if the kernel was behaving as the documentation says it should.
One way to handle this without depending on packet source
addresses is to use the IP_RECVIF socket option. This gives
you the index of the packet's arrival interface.
Using this with the hack that allows the IP_ADD_MEMBERSHIP
option to handle an interface index (by setting the first
octet to 0), you can quickly discard unwanted multicast
packets without ever caring about interface IP addresses.
Nick