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
Unknown Object (File)
Tue, Nov 5, 5:41 PM
Unknown Object (File)
Tue, Nov 5, 5:41 PM
Unknown Object (File)
Tue, Nov 5, 5:41 PM
Unknown Object (File)
Tue, Nov 5, 5:41 PM
Unknown Object (File)
Sun, Nov 3, 12:57 PM
Unknown Object (File)
Wed, Oct 16, 9:07 AM
Unknown Object (File)
Oct 4 2024, 8:19 PM
Unknown Object (File)
Oct 2 2024, 11:50 PM

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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.