git: 2466a1871154 - stable/14 - ifnet: Initialize the address family dependent data region earlier
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Jul 2025 10:06:54 UTC
The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=2466a18711548113d3ca4c61ccc7d6717adb6ade commit 2466a18711548113d3ca4c61ccc7d6717adb6ade Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-05-22 15:00:05 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-07-07 10:03:58 +0000 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 on e64fe5ad3a23, 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: e64fe5ad3a23 netinet6: Remove a set but not used global variable in6_maxmtu Differential Revision: https://reviews.freebsd.org/D49358 (cherry picked from commit 098b5d4dc744283a90b2d80c11395ecc18a84084) --- sys/net/if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index b4ffa9883efc..a0570aed32e9 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -948,11 +948,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);