Page MenuHomeFreeBSD

arp/nd: Cope with late calls to iflladdr_event
ClosedPublic

Authored by kp on Feb 22 2021, 2:33 PM.
Tags
None
Referenced Files
F82223345: D28860.id84541.diff
Fri, Apr 26, 5:15 PM
F82223337: D28860.id84455.diff
Fri, Apr 26, 5:14 PM
F82223333: D28860.id.diff
Fri, Apr 26, 5:14 PM
F82223332: D28860.id84494.diff
Fri, Apr 26, 5:14 PM
F82208976: D28860.diff
Fri, Apr 26, 1:00 PM
Unknown Object (File)
Mon, Apr 22, 2:25 AM
Unknown Object (File)
Mon, Apr 22, 2:25 AM
Unknown Object (File)
Mon, Apr 22, 2:25 AM

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37284
Build 34173: arc lint + arc unit

Event Timeline

kp requested review of this revision.Feb 22 2021, 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.Feb 22 2021, 7:21 PM
melifaro added inline comments.
sys/netinet/if_ether.c
1482

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

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