[quagga-dev 3583] Re: Patch to fix multicast problem on FreeBSD 5.x

Greg Troxel gdt at ir.bbn.com
Tue Aug 16 13:38:01 BST 2005

I've seen this too (on NetBSD).
Semi-related, I recently fixed a bug in NetBSD where on deallocation
of a struct ifnet an ifnet pointer in a socket group membership struct
ended up dangling.

Two observations about the proposed change:

1) It seems wrong of FreeBSD (although I think this is standard BSD
   behavior) not to allow dropping a membership because the interface
   is down.  Not adding is of course fine.

2) In the case where add returns EADDRINUSE, the code does a DROP/ADD
   pair.  If the error was due to a stale join on the same socket,
   this would seem to do nothing.  If it's due to another socket,
   you'll still get an error.

I wonder about keeping a flag in user space representing the state of
join/leave for the group, and doing a drop first if it is recorded as
joined.  The problem here is if an interface is taken down and another
is brought up with the same address.  So really I think problem (1)
needs to be fixed.

I just read the NetBSD-current add/drop code and I can't find where it
requires that an interface be up to drop a membership.

In your case, does the interface still have the address, and what
error do you get on the failed IP_DROP_MEMBERSHIP?

NetBSD supports specifying interfaces by ifindex, and I'm 99% sure
FreeBSD has done this for a while.  Last I checked, Quagga didn't use
this on BSD, and doing so might help in finding an interface on drop
if the address is gone.

 * following RFC1724 section 3.3, is interpreted as interface index.
static struct ifnet *
ip_multicast_if(struct in_addr *a, int *ifindexp)

        Greg Troxel <gdt at ir.bbn.com>

More information about the Quagga-dev mailing list