diff options
author | imp <imp@FreeBSD.org> | 1999-12-10 16:31:25 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1999-12-10 16:31:25 +0000 |
commit | 108333f0a453421722555eb52a232a10bd5c4c77 (patch) | |
tree | 1b22eb5b19f43ca85b3762ede9f6821ae7a7c2f8 /sys/net | |
parent | a0aeba94d4c4ff749b9f7e5dd71dcfa5ee1f60c5 (diff) | |
download | FreeBSD-src-108333f0a453421722555eb52a232a10bd5c4c77.zip FreeBSD-src-108333f0a453421722555eb52a232a10bd5c4c77.tar.gz |
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
Diffstat (limited to 'sys/net')
-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 c0ba5ee..e244ce9 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); } |