In this point, the interface is disconnected from everywhere. No need to
hold netlock for dummy 'nd_ifinfo' release. Netlock is also not needed
for TAILQ_EMPTY(&ifp->if_*hooks) assertions.
Index: sys/net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.699
diff -u -p -r1.699 if.c
--- sys/net/if.c 5 Jun 2023 11:35:46 -0000 1.699
+++ sys/net/if.c 7 Jun 2023 10:15:12 -0000
@@ -1170,6 +1170,8 @@ if_detach(struct ifnet *ifp)
ifafree(ifa);
}
}
+ splx(s);
+ NET_UNLOCK();
KASSERT(TAILQ_EMPTY(&ifp->if_addrhooks));
KASSERT(TAILQ_EMPTY(&ifp->if_linkstatehooks));
@@ -1178,8 +1180,6 @@ 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);