Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Remove the ability for userland to toggle IN6_IFF_TENTATIVE.



details:   https://anonhg.NetBSD.org/src/rev/0628c91e2bcc
branches:  trunk
changeset: 803280:0628c91e2bcc
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Oct 20 14:50:09 2014 +0000

description:
Remove the ability for userland to toggle IN6_IFF_TENTATIVE.
Preserve IN6_IFF_TENTATIVE when updating address flags.

diffstat:

 sbin/ifconfig/af_inet6.c |   7 +++----
 sbin/ifconfig/ifconfig.8 |  10 ++--------
 sys/netinet6/in6.c       |  12 ++++++++----
 3 files changed, 13 insertions(+), 16 deletions(-)

diffs (121 lines):

diff -r ad0100d5d07c -r 0628c91e2bcc sbin/ifconfig/af_inet6.c
--- a/sbin/ifconfig/af_inet6.c  Mon Oct 20 11:58:01 2014 +0000
+++ b/sbin/ifconfig/af_inet6.c  Mon Oct 20 14:50:09 2014 +0000
@@ -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 const struct kwinst ia6flagskw[] = {
          IFKW("anycast",       IN6_IFF_ANYCAST)
-       , IFKW("tentative",     IN6_IFF_TENTATIVE)
        , IFKW("deprecated",    IN6_IFF_DEPRECATED)
 };
 
@@ -476,7 +475,7 @@
 {
        fprintf(stderr,
            "\t[ anycast | -anycast ] [ deprecated | -deprecated ]\n"
-           "\t[ tentative | -tentative ] [ pltime n ] [ vltime n ] "
+           "\t[ pltime n ] [ vltime n ] "
            "[ eui64 ]\n");
 }
 
diff -r ad0100d5d07c -r 0628c91e2bcc sbin/ifconfig/ifconfig.8
--- a/sbin/ifconfig/ifconfig.8  Mon Oct 20 11:58:01 2014 +0000
+++ b/sbin/ifconfig/ifconfig.8  Mon Oct 20 14:50:09 2014 +0000
@@ -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 @@
 .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
diff -r ad0100d5d07c -r 0628c91e2bcc sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Mon Oct 20 11:58:01 2014 +0000
+++ b/sys/netinet6/in6.c        Mon Oct 20 14:50:09 2014 +0000
@@ -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 @@
                /* 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 @@
        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 @@
 
        /*
         * 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 @@
        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;
 
        /*



Home | Main Index | Thread Index | Old Index