--- src/sys/netinet/in.c 2005/06/02 23:52:42 1.15 +++ src/sys/netinet/in.c 2005/06/04 14:41:57 1.16 @@ -435,14 +435,6 @@ in_control(so, cmd, data, ifp, td) * a routing process they will come back. */ in_ifadown(&ia->ia_ifa, 1); - /* - * XXX horrible hack to detect that we are being called - * from if_detach() - */ - if (!ifnet_addrs[ifp->if_index - 1]) { - in_pcbpurgeif0(LIST_FIRST(&ripcbinfo.pcblisthead), ifp); - in_pcbpurgeif0(LIST_FIRST(&udbinfo.pcblisthead), ifp); - } EVENTHANDLER_INVOKE(ifaddr_event, ifp); error = 0; break; @@ -904,3 +896,10 @@ in_delmulti(inm) igmp_leavegroup(&my_inm); crit_exit(); } + +void +in_ifdetach(struct ifnet *ifp) +{ + in_pcbpurgeif0(LIST_FIRST(&ripcbinfo.pcblisthead), ifp); + in_pcbpurgeif0(LIST_FIRST(&udbinfo.pcblisthead), ifp); +}