diff options
author | luigi <luigi@FreeBSD.org> | 2004-04-19 17:28:15 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2004-04-19 17:28:15 +0000 |
commit | aeac3672f4085078db2f2898c11d80bbc9c782c2 (patch) | |
tree | 2b923209e8253a89fa9a610b091fadfe8d07bbf2 /sys/net | |
parent | 5fa6610bf2a33993d7359a1fddb9eb652294f8ab (diff) | |
download | FreeBSD-src-aeac3672f4085078db2f2898c11d80bbc9c782c2.zip FreeBSD-src-aeac3672f4085078db2f2898c11d80bbc9c782c2.tar.gz |
Fix a recently introduced panic in if_detach() by delaying
the invalidation of ifindex_table[] entry. Probably this
code should be moved even further down, but for the time being
let's do it this way.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index ba51a06..920eec4 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -520,17 +520,6 @@ if_detach(struct ifnet *ifp) s = splnet(); if_down(ifp); - /* - * Remove address from ifindex_table[] and maybe decrement if_index. - * Clean up all addresses. - */ - ifaddr_byindex(ifp->if_index) = NULL; - destroy_dev(ifdev_byindex(ifp->if_index)); - ifdev_byindex(ifp->if_index) = NULL; - - while (if_index > 0 && ifaddr_byindex(if_index) == NULL) - if_index--; - for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = next) { next = TAILQ_NEXT(ifa, ifa_link); @@ -570,6 +559,17 @@ if_detach(struct ifnet *ifp) */ in6_ifdetach(ifp); #endif + /* + * Remove address from ifindex_table[] and maybe decrement if_index. + * Clean up all addresses. + */ + ifaddr_byindex(ifp->if_index) = NULL; + destroy_dev(ifdev_byindex(ifp->if_index)); + ifdev_byindex(ifp->if_index) = NULL; + + while (if_index > 0 && ifaddr_byindex(if_index) == NULL) + if_index--; + /* We can now free link ifaddr. */ ifa = TAILQ_FIRST(&ifp->if_addrhead); |