diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-03-04 14:23:36 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-03-04 14:23:36 +0000 |
commit | ead282c6b876a48dc12d77e3496fb775d84d225a (patch) | |
tree | eb4492ccf43a551d905411ac3b217d159c3bdf47 | |
parent | cb5137c830ba0a1738042a6673bdd43ec96feb9b (diff) |
When deleting an IPv6 interface address, also remove the prefix and
the cloning route.
bug report and test Florian Riehm; original fix sperreault@; OK claudio@
-rw-r--r-- | sys/netinet6/in6.c | 24 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 4 |
2 files changed, 12 insertions, 16 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index f15a6eff202..7c56bf11303 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.102 2013/03/03 00:35:13 bluhm Exp $ */ +/* $OpenBSD: in6.c,v 1.103 2013/03/04 14:23:35 bluhm Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -1260,20 +1260,16 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) in6_savemkludge(oia); } - /* - * When an autoconfigured address is being removed, release the - * reference to the base prefix. - */ - if ((oia->ia6_flags & IN6_IFF_AUTOCONF) != 0) { - if (oia->ia6_ndpr == NULL) { - log(LOG_NOTICE, "in6_unlink_ifa: autoconf'ed address " + /* Release the reference to the base prefix. */ + if (oia->ia6_ndpr == NULL) { + if (!IN6_IS_ADDR_LINKLOCAL(IA6_IN6(oia))) + log(LOG_NOTICE, "in6_unlink_ifa: interface address " "%p has no prefix\n", oia); - } else { - oia->ia6_flags &= ~IN6_IFF_AUTOCONF; - if (--oia->ia6_ndpr->ndpr_refcnt == 0) - prelist_remove(oia->ia6_ndpr); - oia->ia6_ndpr = NULL; - } + } else { + oia->ia6_flags &= ~IN6_IFF_AUTOCONF; + if (--oia->ia6_ndpr->ndpr_refcnt == 0) + prelist_remove(oia->ia6_ndpr); + oia->ia6_ndpr = NULL; } /* diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index add70ba7733..aa8420b19cc 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_var.h,v 1.35 2012/11/11 04:45:44 deraadt Exp $ */ +/* $OpenBSD: in6_var.h,v 1.36 2013/03/04 14:23:35 bluhm Exp $ */ /* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -115,7 +115,7 @@ struct in6_ifaddr { */ time_t ia6_updatetime; - /* back pointer to the ND prefix (for autoconfigured addresses only) */ + /* back pointer to the prefix (for all addresses, not just autoconf) */ struct nd_prefix *ia6_ndpr; /* multicast addresses joined from the kernel */ |