Page MenuHomeFreeBSD

arp/nd: Cope with late calls to iflladdr_event

Authored by kp on Mon, Feb 22, 2:33 PM.



When tearing down vnet jails we can move an if_bridge out (as
part of the normal vnet_if_return()). This can, when it's clearing out
its list of member interfaces, change its link layer address.
That sends an iflladdr_event, but at that point we've already freed the
AF_INET/AF_INET6 if_afdata pointers.

In other words: when the iflladdr_event callbacks fire we can't assume
that ifp->if_afdata[AF_INET] will be set.

MFC after: 1 week
Sponsored by: Orange Business Services

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kp requested review of this revision.Mon, Feb 22, 2:33 PM

Would it not better to not setting the callback on shutdown?

Would it not better to not setting the callback on shutdown?

It'd require a reordering of stack setup/teardown, and that'd be a far more impactful and risky change.
We currently NULL out if_afdata[] in if_detach_internal(), which is called by if_vmove() before the if_reassign callback which triggers the bridge cleanup that results in the iflladdr_event that triggers the event this fixes.

To remove the callback first we'd have to shut down the arp/nd6 code before we move interfaces out. That feels like the wrong order, and would almost certainly result in other bugs.

This revision is now accepted and ready to land.Mon, Feb 22, 7:21 PM
melifaro added inline comments.

Would it be possible to add a comment here describing why do we check this?

This revision now requires review to proceed.Mon, Feb 22, 8:12 PM
This revision was not accepted when it landed; it landed in state Needs Review.Tue, Feb 23, 1:56 PM
This revision was automatically updated to reflect the committed changes.