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

Greg Troxel gdt at ir.bbn.com
Wed Aug 17 01:31:49 BST 2005

> From: Nate Nielsen <nielsen-list at memberwebs.com>
> Greg Troxel wrote:
> > 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.
> And if it's another socket (and hence another process, and OSPF
> implementation running) then we would want to get EADDRINUSE.


> Just to confirm, this does fix the problem on FreeBSD, and allows an
> interface (let's say a tun interface) to go down and back up and have
> ospfd rejoin on that interface.

So you are saying that the leftover membership on an interface that
has gone down/up is 'broken' in that arriving packets aren't
delivered?  Or just that ospfd's error path causes trouble?  I dimly
remember adding code (perhaps not in the real repo due to it being
gross) to silently ignore EADDRINUSE on joins.

> > 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.
> Yes, but in any case it probably won't be backported to already running
> versions of FreeBSD, in which case the faulty behavior (pretty big deal
> IMO) will still exist there.

Sure, but I meant internal to quagga.  Essentially similar to your
workaround, but the drop would be done first, and only if the group
was previously joined and had a failed drop.

> > In your case, does the interface still have the address, and what
> > error do you get on the failed IP_DROP_MEMBERSHIP?
> This was my first approach to solving the problem: To just force it to
> do IP_DROP_MEMBERSHIP on the DOWN interface. I patch ospfd to this end.
> However setsockopt_multicast_ipv4 would fail with something like EINVAL.

OK, I can believe EINVAL for a down interface.

> This whole setup is at one of my client's places, I've fixed 3 or 4 bugs
> in quagga and am looking to contribute these back to the community one
> by one.

Fair enough, but I like to ask whether the OS or quagga is at fault
and have a clean fix, although workarounds are ok too.

> If you'd like me to get the specific failure codes etc... then I would
> need to wait until I visit back there, probably some time next week.

It's more that I wanted to understand the situation you were facing.
Sometimes people do more unusual things and expect things to work, but
down/up is normal.

> > 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.
> What would the call look like? I can check this out if you send me a patch.

Same IP_ADD_MEMBERSHIP, but 0.0.0.ifindex for the interface address.
I think #ifdef linux code does this already.  [Sorry, not enough time
to find/write/send patch now.]

More information about the Quagga-dev mailing list