ifnet: Initialize the address family dependent data region earlier
if_link_ifnet() adds the interface to the global network interface list, and it is a natural synchronization point. With this change, any threads that obtain the reference of the interface via ifunit(), ifunit_ref() etc., will be guaranteed to see the address family dependent data rightly. The issue [1] reported by Mike Belanger also hints the potential race. MFC note: this change depends one64fe5ad3a, as calculating the max IPv6 MTU through all the interfaces requires the current interface to be added to the global network interface list firstly. [1] https://lists.freebsd.org/archives/freebsd-net/2025-May/006817.html Reviewed by: glebius MFC after: 1 month MFC with:e64fe5ad3anetinet6: Remove a set but not used global variable in6_maxmtu Differential Revision: https://reviews.freebsd.org/D49358
This commit is contained in:
+2
-2
@@ -946,11 +946,11 @@ if_attach_internal(struct ifnet *ifp, bool vmove)
|
||||
}
|
||||
#endif
|
||||
|
||||
if_link_ifnet(ifp);
|
||||
|
||||
if (domain_init_status >= 2)
|
||||
if_attachdomain1(ifp);
|
||||
|
||||
if_link_ifnet(ifp);
|
||||
|
||||
EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp);
|
||||
if (IS_DEFAULT_VNET(curvnet))
|
||||
devctl_notify("IFNET", ifp->if_xname, "ATTACH", NULL);
|
||||
|
||||
Reference in New Issue
Block a user