Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Don't set IN_IFF_* flags to ia4_flags if DAD is ...



details:   https://anonhg.NetBSD.org/src/rev/389ba4925e1a
branches:  trunk
changeset: 831556:389ba4925e1a
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Apr 06 09:20:29 2018 +0000

description:
Don't set IN_IFF_* flags to ia4_flags if DAD is disabled

This fix allows that a GARP packet is sent when adding an IP address to an
interface with IFF_UP on a kernel with IPv4 DAD is disabled
(net.inet.ip.dad_count=0), which is the same behavior of NetBSD 7, i.e.,
before introducing the IPv4 DAD.

diffstat:

 sys/netinet/in.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r b7c648735529 -r 389ba4925e1a sys/netinet/in.c
--- a/sys/netinet/in.c  Fri Apr 06 09:19:16 2018 +0000
+++ b/sys/netinet/in.c  Fri Apr 06 09:20:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in.c,v 1.224 2018/04/06 09:19:16 ozaki-r Exp $ */
+/*     $NetBSD: in.c,v 1.225 2018/04/06 09:20:29 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.224 2018/04/06 09:19:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.225 2018/04/06 09:20:29 ozaki-r Exp $");
 
 #include "arp.h"
 
@@ -1146,10 +1146,12 @@
        if (ia->ia4_flags & IN_IFF_DUPLICATED)
                hostIsNew = 1;
        ia->ia4_flags = 0;
-       if (ifp->if_link_state == LINK_STATE_DOWN)
-               ia->ia4_flags |= IN_IFF_DETACHED;
-       else if (hostIsNew && if_do_dad(ifp))
-               ia->ia4_flags |= IN_IFF_TRYTENTATIVE;
+       if (ip_dad_count > 0) {
+               if (ifp->if_link_state == LINK_STATE_DOWN)
+                       ia->ia4_flags |= IN_IFF_DETACHED;
+               else if (hostIsNew && if_do_dad(ifp))
+                       ia->ia4_flags |= IN_IFF_TRYTENTATIVE;
+       }
 
        /*
         * Give the interface a chance to initialize



Home | Main Index | Thread Index | Old Index