--- b/sys/net/if.c +++ b/sys/net/if.c @@ -1908,6 +1908,7 @@ ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, struct sockaddr *ia) { int error; + int fibnum; struct rt_addrinfo info; struct sockaddr_dl null_sdl; struct ifnet *ifp; @@ -1922,6 +1923,16 @@ ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type); + // XXX: prevent dangling loopback route in other fibs + if (cmd == RTM_DELETE) { + for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { + if (fibnum == ifp->if_fib) + continue; + + (void) rtrequest1_fib(cmd, &info, NULL, fibnum); + } + } + error = rtrequest1_fib(cmd, &info, NULL, ifp->if_fib); if (error == 0 ||