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)
Fri, Mar 29, 12:55 AM
Unknown Object (File)
Feb 11 2024, 12:45 PM
Unknown Object (File)
Feb 9 2024, 12:53 PM
Unknown Object (File)
Jan 29 2024, 3:57 AM
Unknown Object (File)
Jan 29 2024, 3:57 AM
Unknown Object (File)
Jan 29 2024, 3:57 AM
Unknown Object (File)
Jan 29 2024, 3:57 AM
Unknown Object (File)
Jan 27 2024, 2:49 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.