summaryrefslogtreecommitdiff
path: root/sys/netinet6/in6.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2018-04-24 10:46:26 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2018-04-24 10:46:26 +0000
commitc0e75be2e9d7a42d0d43c1529c71080b48562f47 (patch)
tree3a5a5e6f650fb3386ec45e77968b966451913509 /sys/netinet6/in6.c
parent8705a767e0f97099be54e498e89d9161fa3388f0 (diff)
Run duplicate address detection again if an existing address gets
updated from userland that was marked duplicated or tentative. Otherwise we would just lose the duplicated / tentative state and assume that the address is now unique and usable. OK kn
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r--sys/netinet6/in6.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 1c5ec065aa5..338adcbc50a 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.219 2017/11/23 13:32:25 mpi Exp $ */
+/* $OpenBSD: in6.c,v 1.220 2018/04/24 10:46:25 florian Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -420,15 +420,15 @@ in6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
break;
}
+ /* Perform DAD, if needed. */
+ if (ia6->ia6_flags & IN6_IFF_TENTATIVE)
+ nd6_dad_start(&ia6->ia_ifa);
+
if (!newifaddr) {
dohooks(ifp->if_addrhooks, 0);
break;
}
- /* Perform DAD, if needed. */
- if (ia6->ia6_flags & IN6_IFF_TENTATIVE)
- nd6_dad_start(&ia6->ia_ifa);
-
plen = in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL);
if ((ifp->if_flags & IFF_LOOPBACK) || plen == 128) {
dohooks(ifp->if_addrhooks, 0);
@@ -655,6 +655,9 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
if ((error = in6_ifinit(ifp, ia6, hostIsNew)) != 0)
goto unlink;
+ /* re-run DAD */
+ if (ia6->ia6_flags & (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED))
+ ifra->ifra_flags |= IN6_IFF_TENTATIVE;
/*
* configure address flags.
*/