Module Name: src Committed By: roy Date: Mon Oct 20 14:50:09 UTC 2014
Modified Files: src/sbin/ifconfig: af_inet6.c ifconfig.8 src/sys/netinet6: in6.c Log Message: Remove the ability for userland to toggle IN6_IFF_TENTATIVE. Preserve IN6_IFF_TENTATIVE when updating address flags. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sbin/ifconfig/af_inet6.c cvs rdiff -u -r1.108 -r1.109 src/sbin/ifconfig/ifconfig.8 cvs rdiff -u -r1.176 -r1.177 src/sys/netinet6/in6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/ifconfig/af_inet6.c diff -u src/sbin/ifconfig/af_inet6.c:1.29 src/sbin/ifconfig/af_inet6.c:1.30 --- src/sbin/ifconfig/af_inet6.c:1.29 Sat Oct 19 15:50:26 2013 +++ src/sbin/ifconfig/af_inet6.c Mon Oct 20 14:50:09 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: af_inet6.c,v 1.29 2013/10/19 15:50:26 christos Exp $ */ +/* $NetBSD: af_inet6.c,v 1.30 2014/10/20 14:50:09 roy Exp $ */ /* * Copyright (c) 1983, 1993 @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: af_inet6.c,v 1.29 2013/10/19 15:50:26 christos Exp $"); +__RCSID("$NetBSD: af_inet6.c,v 1.30 2014/10/20 14:50:09 roy Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -78,7 +78,6 @@ static cmdloop_branch_t branch[2]; static const struct kwinst ia6flagskw[] = { IFKW("anycast", IN6_IFF_ANYCAST) - , IFKW("tentative", IN6_IFF_TENTATIVE) , IFKW("deprecated", IN6_IFF_DEPRECATED) }; @@ -476,7 +475,7 @@ in6_usage(prop_dictionary_t env) { fprintf(stderr, "\t[ anycast | -anycast ] [ deprecated | -deprecated ]\n" - "\t[ tentative | -tentative ] [ pltime n ] [ vltime n ] " + "\t[ pltime n ] [ vltime n ] " "[ eui64 ]\n"); } Index: src/sbin/ifconfig/ifconfig.8 diff -u src/sbin/ifconfig/ifconfig.8:1.108 src/sbin/ifconfig/ifconfig.8:1.109 --- src/sbin/ifconfig/ifconfig.8:1.108 Mon Sep 15 06:48:05 2014 +++ src/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:50:09 2014 @@ -1,4 +1,4 @@ -.\" $NetBSD: ifconfig.8,v 1.108 2014/09/15 06:48:05 ozaki-r Exp $ +.\" $NetBSD: ifconfig.8,v 1.109 2014/10/20 14:50:09 roy Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94 .\" -.Dd September 15, 2014 +.Dd October 12, 2014 .Dt IFCONFIG 8 .Os .Sh NAME @@ -551,12 +551,6 @@ Set the IPv6 deprecated address bit. .It Fl deprecated .Pq inet6 only Clear the IPv6 deprecated address bit. -.It Cm tentative -.Pq inet6 only -Set the IPv6 tentative address bit. -.It Fl tentative -.Pq inet6 only -Clear the IPv6 tentative address bit. .It Cm eui64 .Pq inet6 only Fill interface index Index: src/sys/netinet6/in6.c diff -u src/sys/netinet6/in6.c:1.176 src/sys/netinet6/in6.c:1.177 --- src/sys/netinet6/in6.c:1.176 Tue Sep 9 20:16:12 2014 +++ src/sys/netinet6/in6.c Mon Oct 20 14:50:09 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: in6.c,v 1.176 2014/09/09 20:16:12 rmind Exp $ */ +/* $NetBSD: in6.c,v 1.177 2014/10/20 14:50:09 roy Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.176 2014/09/09 20:16:12 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.177 2014/10/20 14:50:09 roy Exp $"); #include "opt_inet.h" #include "opt_compat_netbsd.h" @@ -649,6 +649,7 @@ in6_control1(struct socket *so, u_long c /* reject read-only flags */ if ((ifra->ifra_flags & IN6_IFF_DUPLICATED) != 0 || (ifra->ifra_flags & IN6_IFF_DETACHED) != 0 || + (ifra->ifra_flags & IN6_IFF_TENTATIVE) != 0 || (ifra->ifra_flags & IN6_IFF_NODAD) != 0 || (ifra->ifra_flags & IN6_IFF_AUTOCONF) != 0) { return EINVAL; @@ -834,7 +835,7 @@ in6_update_ifa1(struct ifnet *ifp, struc struct in6_multi_mship *imm; struct in6_multi *in6m_sol; struct rtentry *rt; - int dad_delay; + int dad_delay, was_tentative; in6m_sol = NULL; @@ -1063,7 +1064,10 @@ in6_update_ifa1(struct ifnet *ifp, struc /* * configure address flags. + * We need to preserve tentative state so DAD works if + * something adds the same address before DAD finishes. */ + was_tentative = ia->ia6_flags & (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED); ia->ia6_flags = ifra->ifra_flags; /* @@ -1075,7 +1079,7 @@ in6_update_ifa1(struct ifnet *ifp, struc if (ifp->if_link_state == LINK_STATE_DOWN) { ia->ia6_flags |= IN6_IFF_DETACHED; ia->ia6_flags &= ~IN6_IFF_TENTATIVE; - } else if (hostIsNew && in6if_do_dad(ifp)) + } else if ((hostIsNew || was_tentative) && in6if_do_dad(ifp)) ia->ia6_flags |= IN6_IFF_TENTATIVE; /*