diff options
author | Warner Losh <imp@FreeBSD.org> | 1999-12-10 16:31:25 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 1999-12-10 16:31:25 +0000 |
commit | aa6be122fdbf570c204351ebe746fbf562a709b0 (patch) | |
tree | b09190ee295631fc87d2c1617e65846defa738b4 /sys/net/if.c | |
parent | 5530fb792a495054662afe06e16340cc883ed432 (diff) | |
download | src-aa6be122fdbf570c204351ebe746fbf562a709b0.tar.gz src-aa6be122fdbf570c204351ebe746fbf562a709b0.zip |
Add some gross ad-hock hacks to increase stability of if_detach:
o be more careful about clearing addresses (this isn't a kludge)
o For AF_INET interfaces, call SIOCDIFFADDR to remove last(?) bit
of cruft.
Special cases for AF_INET shouldn't be here, but I didn't see a good
generic way of doing this. If I missed something, please let me know.
This gross hack makes pccard ejection stable for ethernet cards.
Submitted by: Atushi Onoe-san
Notes
Notes:
svn path=/head/; revision=54410
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index c0ba5eebdd71..e244ce9ab819 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -227,12 +227,27 @@ if_detach(ifp) * Remove address from ifnet_addrs[] and maybe decrement if_index. * Clean up all addresses. */ - ifnet_addrs[ifp->if_index] = 0; - while (ifnet_addrs[if_index] == 0) + ifnet_addrs[ifp->if_index - 1] = 0; + while (if_index > 0 && ifnet_addrs[if_index - 1] == 0) if_index--; for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = TAILQ_FIRST(&ifp->if_addrhead)) { +#if 1 /* ONOE */ + /* XXX: Ugly!! ad hoc just for INET */ + if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) { + struct ifaliasreq ifr; + + bzero(&ifr, sizeof(ifr)); + if (ifa->ifa_addr) + ifr.ifra_addr = *ifa->ifa_addr; + if (ifa->ifa_dstaddr) + ifr.ifra_broadaddr = *ifa->ifa_dstaddr; + if (in_control(NULL, SIOCDIFADDR, (caddr_t)&ifr, ifp, + NULL) == 0) + continue; + } +#endif /* ONOE */ TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); IFAFREE(ifa); } |