diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-10-17 00:09:40 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-10-17 00:09:40 +0000 |
commit | 184f0f0cf626ba16e8792cf6eed29798ef876839 (patch) | |
tree | 92c0d2e9ef418f7decefe282bf6d9a21f2e3f404 /sys | |
parent | 12123c65b426f190f521b902bf0727e9890ee108 (diff) |
do not differentiate manually configured address from autoconfigured ones
wrt prefix management;
- always earn a reference to the prefix when an address is configured
(by ioctl).
- always delete the prefix when an address that has the last referene
is manually removed.
The change should solve the problem raised in KAME-snap 6989.
sync w/kame
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/in6.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index c52f013e59e..883e52c7b78 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.48 2002/09/23 23:28:15 itojun Exp $ */ +/* $OpenBSD: in6.c,v 1.49 2002/10/17 00:09:39 itojun Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -704,7 +704,7 @@ in6_control(so, cmd, data, ifp, p) pr0.ndpr_vltime = ifra->ifra_lifetime.ia6t_vltime; pr0.ndpr_pltime = ifra->ifra_lifetime.ia6t_pltime; - /* add the prefix if there's one. */ + /* add the prefix if not yet. */ if ((pr = nd6_prefix_lookup(&pr0)) == NULL) { /* * nd6_prelist_add will install the corresponding @@ -718,8 +718,9 @@ in6_control(so, cmd, data, ifp, p) return (EINVAL); /* XXX panic here? */ } } - if ((ia->ia6_flags & IN6_IFF_AUTOCONF) && - ia->ia6_ndpr == NULL) { /* new autoconfed addr */ + + /* relate the address to the prefix */ + if (ia->ia6_ndpr == NULL) { ia->ia6_ndpr = pr; pr->ndpr_refcnt++; } @@ -759,20 +760,12 @@ in6_control(so, cmd, data, ifp, p) pr0.ndpr_prefix.sin6_addr.s6_addr32[i] &= ia->ia_prefixmask.sin6_addr.s6_addr32[i]; } - /* - * The logic of the following condition is a bit complicated. - * We expire the prefix when - * 1. the address obeys autoconfiguration and it is the - * only owner of the associated prefix, or - * 2. the address does not obey autoconf and there is no - * other owner of the prefix. - */ if ((pr = nd6_prefix_lookup(&pr0)) != NULL && - (((ia->ia6_flags & IN6_IFF_AUTOCONF) != 0 && - pr->ndpr_refcnt == 1) || - ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0 && - pr->ndpr_refcnt == 0))) - purgeprefix = 1; + pr == ia->ia6_ndpr) { + pr->ndpr_refcnt--; + if (pr->ndpr_refcnt == 0) + purgeprefix = 1; + } purgeaddr: in6_purgeaddr(&ia->ia_ifa); |