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.
This commit is contained in:
parent
e69d8e61f3
commit
f4247b5934
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128432
22
sys/net/if.c
22
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);
|
||||
|
Loading…
Reference in New Issue
Block a user