AF_LINK sockaddr has to be attached to ifp->if_addrlist until the
end, as many of the code assumes that TAILQ_FIRST(ifp->if_addrlist) is non-null. Submitted by: itojun
This commit is contained in:
parent
6c021c7220
commit
212bd869db
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121135
14
sys/net/if.c
14
sys/net/if.c
@ -454,7 +454,7 @@ void
|
||||
if_detach(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
struct ifaddr *ifa;
|
||||
struct ifaddr *ifa, *next;
|
||||
struct radix_node_head *rnh;
|
||||
int s;
|
||||
int i;
|
||||
@ -476,8 +476,11 @@ if_detach(ifp)
|
||||
while (if_index > 0 && ifaddr_byindex(if_index) == NULL)
|
||||
if_index--;
|
||||
|
||||
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
|
||||
ifa = TAILQ_FIRST(&ifp->if_addrhead)) {
|
||||
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = next) {
|
||||
next = TAILQ_NEXT(ifa, ifa_link);
|
||||
|
||||
if (ifa->ifa_addr->sa_family == AF_LINK)
|
||||
continue;
|
||||
#ifdef INET
|
||||
/* XXX: Ugly!! ad hoc just for INET */
|
||||
if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) {
|
||||
@ -513,6 +516,11 @@ if_detach(ifp)
|
||||
in6_ifdetach(ifp);
|
||||
#endif
|
||||
|
||||
/* We can now free link ifaddr. */
|
||||
ifa = TAILQ_FIRST(&ifp->if_addrhead);
|
||||
TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
|
||||
IFAFREE(ifa);
|
||||
|
||||
/*
|
||||
* Delete all remaining routes using this interface
|
||||
* Unfortuneatly the only way to do this is to slog through
|
||||
|
Loading…
Reference in New Issue
Block a user