diff options
author | 2013-03-26 00:14:18 +0000 | |
---|---|---|
committer | 2013-03-26 00:14:18 +0000 | |
commit | f0596c797be4351f310705264b3f30f6bd55ded0 (patch) | |
tree | aedd2ac87e4956b5f8fdb7796420d36bb76cbbc7 | |
parent | during upgrade network setup, print friendlier error message if (diff) | |
download | wireguard-openbsd-f0596c797be4351f310705264b3f30f6bd55ded0.tar.xz wireguard-openbsd-f0596c797be4351f310705264b3f30f6bd55ded0.zip |
Remove a block of dead code in in6_ifdetach(). It was never executed
due to the wrong & in satosin6(&ifa->ifa_addr). The link local
prefix fe80 was not checked within the IPv6 address, but within
some pointers of the interface address struct. The whole loop
around this was also never executed as all IPv6 addresses had already
been purged.
OK sperreault@ mpi@ mikeb@
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 52 |
1 files changed, 1 insertions, 51 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 00ef34a6bc5..90e2df4e641 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.59 2013/03/25 14:40:57 mpi Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.60 2013/03/26 00:14:18 bluhm Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -653,11 +653,9 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) void in6_ifdetach(struct ifnet *ifp) { - struct in6_ifaddr *ia; struct ifaddr *ifa, *next; struct rtentry *rt; struct sockaddr_in6 sin6; - struct in6_multi_mship *imm; #ifdef MROUTING /* remove ip6_mrouter stuff */ @@ -674,54 +672,6 @@ in6_ifdetach(struct ifnet *ifp) in6_purgeaddr(ifa); } - /* undo everything done by in6_ifattach(), just in case */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrlist, ifa_list, next) { - if (ifa->ifa_addr->sa_family != AF_INET6 - || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { - continue; - } - - ia = ifatoia6(ifa); - - /* - * leave from multicast groups we have joined for the interface - */ - while (!LIST_EMPTY(&ia->ia6_memberships)) { - imm = LIST_FIRST(&ia->ia6_memberships); - LIST_REMOVE(imm, i6mm_chain); - in6_leavegroup(imm); - } - - /* remove from the routing table */ - if ((ia->ia_flags & IFA_ROUTE) && - (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, - ifp->if_rdomain))) { - struct rt_addrinfo info; - u_int8_t prio; - - bzero(&info, sizeof(info)); - info.rti_flags = rt->rt_flags; - prio = rt->rt_priority; - info.rti_info[RTAX_DST] = - (struct sockaddr *)&ia->ia_addr; - info.rti_info[RTAX_GATEWAY] = - (struct sockaddr *)&ia->ia_addr; - info.rti_info[RTAX_NETMASK] = - (struct sockaddr *)&ia->ia_prefixmask; - rtfree(rt); - rtrequest1(RTM_DELETE, &info, prio, NULL, - ifp->if_rdomain); - } - - /* remove from the linked list */ - ifa_del(ifp, &ia->ia_ifa); - ifafree(&ia->ia_ifa); - - /* also remove from the IPv6 address list */ - TAILQ_REMOVE(&in6_ifaddr, ia, ia_list); - ifafree(&ia->ia_ifa); - } - /* cleanup multicast address kludge table, if there is any */ in6_purgemkludge(ifp); |