This is the mbuf(9) allocation and broadcast transmission for PF_ROUTE
sockets, netlock is not required here. Make sense for systems with many
short time living pseudo interfaces like tun(4) and pppx(4).
The corresponding IFAN_ARRIVAL announce could be also done without
netlock held, but I like to do if_attachsetup() first and move
netlock within. Otherwise this will be " rtm_ifannounce(ifp,
IFAN_ARRIVAL);" copy-paste.
Index: sys/net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.683
diff -u -p -r1.683 if.c
--- sys/net/if.c 23 Nov 2022 16:57:37 -0000 1.683
+++ sys/net/if.c 16 Feb 2023 11:07:09 -0000
@@ -1107,11 +1107,11 @@ if_detach(struct ifnet *ifp)
#ifdef INET6
nd6_ifdetach(ifp);
#endif
+ splx(s);
+ NET_UNLOCK();
/* Announce that the interface is gone. */
rtm_ifannounce(ifp, IFAN_DEPARTURE);
- splx(s);
- NET_UNLOCK();
if (ifp->if_counters != NULL)
if_counters_free(ifp);