Source-Changes-HG archive

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

[src/trunk]: src/sys Make GARP work again when DAD is disabled



details:   https://anonhg.NetBSD.org/src/rev/0415d7af42ef
branches:  trunk
changeset: 321803:0415d7af42ef
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Apr 06 16:03:16 2018 +0000

description:
Make GARP work again when DAD is disabled

The change avoids setting an IP address tentative on initializing it when the
IPv4 DAD is disabled (net.inet.ip.dad_count=0), which allows a GARP packet to be
sent (see arpannounce).  This is the same behavior of NetBSD 7, i.e., before
introducing the IPv4 DAD.

Additionally do the same change to IPv6 DAD for consistency.

The change is suggested by roy@

diffstat:

 sys/netinet/in.c   |  6 +++---
 sys/netinet6/in6.c |  8 +++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r 8e3dc7e80537 -r 0415d7af42ef sys/netinet/in.c
--- a/sys/netinet/in.c  Fri Apr 06 16:01:16 2018 +0000
+++ b/sys/netinet/in.c  Fri Apr 06 16:03:16 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in.c,v 1.226 2018/04/06 16:01:16 ozaki-r Exp $ */
+/*     $NetBSD: in.c,v 1.227 2018/04/06 16:03:16 ozaki-r Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.226 2018/04/06 16:01:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.227 2018/04/06 16:03:16 ozaki-r Exp $");
 
 #include "arp.h"
 
@@ -1150,7 +1150,7 @@
        if (ifp->if_link_state == LINK_STATE_DOWN) {
                ia->ia4_flags |= IN_IFF_DETACHED;
                ia->ia4_flags &= ~IN_IFF_TENTATIVE;
-       } else if (hostIsNew && if_do_dad(ifp))
+       } else if (hostIsNew && if_do_dad(ifp) && ip_dad_count > 0)
                ia->ia4_flags |= IN_IFF_TRYTENTATIVE;
 
        /*
diff -r 8e3dc7e80537 -r 0415d7af42ef sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Fri Apr 06 16:01:16 2018 +0000
+++ b/sys/netinet6/in6.c        Fri Apr 06 16:03:16 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.264 2018/03/06 07:27:55 ozaki-r Exp $        */
+/*     $NetBSD: in6.c,v 1.265 2018/04/06 16:03:16 ozaki-r 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.264 2018/03/06 07:27:55 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.265 2018/04/06 16:03:16 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1240,8 +1240,10 @@
        if (ifp->if_link_state == LINK_STATE_DOWN) {
                ia->ia6_flags |= IN6_IFF_DETACHED;
                ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
-       } else if ((hostIsNew || was_tentative) && if_do_dad(ifp))
+       } else if ((hostIsNew || was_tentative) && if_do_dad(ifp) &&
+                  ip6_dad_count > 0) {
                ia->ia6_flags |= IN6_IFF_TENTATIVE;
+       }
 
        /*
         * backward compatibility - if IN6_IFF_DEPRECATED is set from the



Home | Main Index | Thread Index | Old Index