Page MenuHomeFreeBSD

Add missing network interface address event for adding default IPv6 link-local addresses
ClosedPublic

Authored by hselasky on Dec 7 2017, 2:44 PM.

Details

Summary

After adding the default IPv6 default link-local address, the kernel is not informed about the new network interface address. Move the EVENTHANDLER_INVOKE() call to a more appropriate location.

This event is needed by ibcore which regularly listen for network address changes.
The issue manifests itself when creating a VLAN network interface and configuring a IPv4 address only which also brings up the IPv6 link-local address, but the ifaddr_event is not invoked for the latter and then ibcore will not see the IPv6 link-local address added only the IPv4 one.

Sponsored by: Mellanox Technologies

Test Plan

Test OK.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

hselasky created this revision.Dec 7 2017, 2:44 PM
kib added a comment.Dec 7 2017, 3:38 PM

For my understanding of this stuff. Is some lock which guarantees consistency for the addresses configuration is still held while the eventhandler is invoked ? What is the lock ?

netinet6/in6_ifattach.c
550 ↗(On Diff #36337)

The comment is actually useless. It is quite obvious for any reader that an eventhandler is called, so the text repeats the code.

@kib: Other places where "EVENTHANDLER_INVOKE(ifaddr_event, ifp)" is used there are no locks involved from what I can see. Correct me if I'm wrong.

kib added a comment.Dec 7 2017, 4:59 PM

@kib: Other places where "EVENTHANDLER_INVOKE(ifaddr_event, ifp)" is used there are no locks involved from what I can see. Correct me if I'm wrong.

Then how e.g. validity of ifp is ensured for the duration of the eventhandler callback ? Also, do eventhandlers re-check the condition they are called for ?

If not, this is quite hideous.

Then how e.g. validity of ifp is ensured for the duration of the eventhandler callback ? Also, do eventhandlers re-check the condition they are called for ?

If not, this is quite hideous.

The "ifp" pointer is already used several times inside the same function, so I assume it is safe to call the eventhandler with this network interface pointer aswell.

hselasky updated this revision to Diff 42134.May 4 2018, 11:13 AM

Remove useless comment as per KIB's suggestion.

I've checked the callers of in6_ifattach_linklocal(), and there appears to be no fast path involved, which means among others that sleeping is OK inside the eventhandler callbacks.

kib accepted this revision.May 8 2018, 8:48 AM
This revision is now accepted and ready to land.May 8 2018, 8:48 AM
hselasky added a reviewer: ae.May 8 2018, 8:52 AM
hselasky updated this revision to Diff 42264.May 8 2018, 10:44 AM
hselasky edited the summary of this revision. (Show Details)

Implement suggestion from ae@

This revision now requires review to proceed.May 8 2018, 10:44 AM
hselasky updated this revision to Diff 42265.May 8 2018, 10:46 AM

Remove superfluous eventhandler call.

Suggested by: ae@

ae accepted this revision.May 8 2018, 11:01 AM

Seems good to me.

This revision is now accepted and ready to land.May 8 2018, 11:01 AM
kib accepted this revision.May 8 2018, 11:26 AM
This revision was automatically updated to reflect the committed changes.