From c0e75be2e9d7a42d0d43c1529c71080b48562f47 Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Tue, 24 Apr 2018 10:46:26 +0000 Subject: 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 --- sys/netinet6/in6.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sys/netinet6/in6.c') 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. */ -- cgit v1.2.3