summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-03-03 08:02:00 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-03-03 08:02:00 +0000
commit16ed7ee6d482703fc3fad25b8a1157d8ef4cbe78 (patch)
tree9d1dd32722e70304546863bfc681fd140257e0ae /sys/netinet6/nd6.c
parentaa9be2c56d283bde290b5a96523e484dda625468 (diff)
Iterate over the global list of interfaces instead of using the global
list of IPv6 addresses. ok bluhm@
Diffstat (limited to 'sys/netinet6/nd6.c')
-rw-r--r--sys/netinet6/nd6.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index e9d6bff3c18..5ed66239804 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.204 2017/03/02 09:24:02 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.205 2017/03/03 08:01:59 mpi Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -1156,18 +1156,29 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
/* First purge the addresses referenced by a prefix. */
LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, npr) {
- struct in6_ifaddr *ia6, *ia6_next;
+ struct ifnet *ifp;
+ struct ifaddr *ifa, *nifa;
+ struct in6_ifaddr *ia6;
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
continue; /* XXX */
/* do we really have to remove addresses as well? */
- TAILQ_FOREACH_SAFE(ia6, &in6_ifaddr, ia_list, ia6_next) {
- if ((ia6->ia6_flags & IN6_IFF_AUTOCONF) == 0)
- continue;
-
- if (ia6->ia6_ndpr == pr)
- in6_purgeaddr(&ia6->ia_ifa);
+ TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrlist,
+ ifa_list, nifa) {
+ if (ifa->ifa_addr->sa_family !=
+ AF_INET6)
+ continue;
+
+ ia6 = ifatoia6(ifa);
+ if ((ia6->ia6_flags & IN6_IFF_AUTOCONF)
+ == 0)
+ continue;
+
+ if (ia6->ia6_ndpr == pr)
+ in6_purgeaddr(&ia6->ia_ifa);
+ }
}
}
/*