Module Name: src Committed By: ozaki-r Date: Fri Apr 6 16:03:16 UTC 2018
Modified Files: src/sys/netinet: in.c src/sys/netinet6: in6.c Log Message: 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@ To generate a diff of this commit: cvs rdiff -u -r1.226 -r1.227 src/sys/netinet/in.c cvs rdiff -u -r1.264 -r1.265 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/sys/netinet/in.c diff -u src/sys/netinet/in.c:1.226 src/sys/netinet/in.c:1.227 --- src/sys/netinet/in.c:1.226 Fri Apr 6 16:01:16 2018 +++ src/sys/netinet/in.c Fri Apr 6 16:03:16 2018 @@ -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 @@ in_ifinit(struct ifnet *ifp, struct in_i 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; /* Index: src/sys/netinet6/in6.c diff -u src/sys/netinet6/in6.c:1.264 src/sys/netinet6/in6.c:1.265 --- src/sys/netinet6/in6.c:1.264 Tue Mar 6 07:27:55 2018 +++ src/sys/netinet6/in6.c Fri Apr 6 16:03:16 2018 @@ -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 @@ 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 || 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