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@
This commit is contained in:
ozaki-r 2018-04-06 16:03:16 +00:00
parent b9525d3d4c
commit 42d3fdb95f
2 changed files with 8 additions and 6 deletions

View File

@ -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. * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/ */
#include <sys/cdefs.h> #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" #include "arp.h"
@ -1150,7 +1150,7 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia,
if (ifp->if_link_state == LINK_STATE_DOWN) { if (ifp->if_link_state == LINK_STATE_DOWN) {
ia->ia4_flags |= IN_IFF_DETACHED; ia->ia4_flags |= IN_IFF_DETACHED;
ia->ia4_flags &= ~IN_IFF_TENTATIVE; 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; ia->ia4_flags |= IN_IFF_TRYTENTATIVE;
/* /*

View File

@ -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 $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/* /*
@ -62,7 +62,7 @@
*/ */
#include <sys/cdefs.h> #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 #ifdef _KERNEL_OPT
#include "opt_inet.h" #include "opt_inet.h"
@ -1240,8 +1240,10 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
if (ifp->if_link_state == LINK_STATE_DOWN) { if (ifp->if_link_state == LINK_STATE_DOWN) {
ia->ia6_flags |= IN6_IFF_DETACHED; ia->ia6_flags |= IN6_IFF_DETACHED;
ia->ia6_flags &= ~IN6_IFF_TENTATIVE; 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; ia->ia6_flags |= IN6_IFF_TENTATIVE;
}
/* /*
* backward compatibility - if IN6_IFF_DEPRECATED is set from the * backward compatibility - if IN6_IFF_DEPRECATED is set from the