Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Only do DaD if the interface actually has the ad...



details:   https://anonhg.NetBSD.org/src/rev/86a76a421edf
branches:  trunk
changeset: 821994:86a76a421edf
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Feb 24 13:42:18 2017 +0000

description:
Only do DaD if the interface actually has the address.

diffstat:

 sys/netinet/if_arp.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r 219fc50c762e -r 86a76a421edf sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Fri Feb 24 13:04:23 2017 +0000
+++ b/sys/netinet/if_arp.c      Fri Feb 24 13:42:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.243 2017/02/21 03:58:23 ozaki-r Exp $     */
+/*     $NetBSD: if_arp.c,v 1.244 2017/02/24 13:42:18 roy Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.243 2017/02/21 03:58:23 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.244 2017/02/24 13:42:18 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1018,6 +1018,7 @@
        int s;
        char llabuf[LLA_ADDRSTRLEN];
        char ipbuf[INET_ADDRSTRLEN];
+       bool do_dad;
 
        if (__predict_false(m_makewritable(&m, 0, m->m_pkthdr.len, M_DONTWAIT)))
                goto out;
@@ -1113,6 +1114,9 @@
                goto out;
        }
 
+       /* Only do DaD if we have a matching address. */
+       do_dad = (ia != NULL);
+
        if (ia == NULL) {
                ia = in_get_ia_on_iface_psref(isaddr, rcvif, &psref_ia);
                if (ia == NULL) {
@@ -1160,9 +1164,10 @@
        }
 
        /* DAD check, RFC 5227 */
-       if (in_hosteq(isaddr, myaddr) ||
+       if (do_dad &&
+           (in_hosteq(isaddr, myaddr) ||
            (in_nullhost(isaddr) && in_hosteq(itaddr, myaddr)
-           && ISSET(m->m_flags, M_BCAST))) /* Allow Unicast Poll, RFC 1122 */
+           && ISSET(m->m_flags, M_BCAST)))) /* Allow Unicast Poll, RFC 1122 */
        {
                arp_dad_duplicated((struct ifaddr *)ia,
                    lla_snprintf(llabuf, ar_sha(ah), ah->ar_hln));



Home | Main Index | Thread Index | Old Index