Module Name: src Committed By: roy Date: Fri Feb 24 13:42:19 UTC 2017
Modified Files: src/sys/netinet: if_arp.c Log Message: Only do DaD if the interface actually has the address. To generate a diff of this commit: cvs rdiff -u -r1.243 -r1.244 src/sys/netinet/if_arp.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/if_arp.c diff -u src/sys/netinet/if_arp.c:1.243 src/sys/netinet/if_arp.c:1.244 --- src/sys/netinet/if_arp.c:1.243 Tue Feb 21 03:58:23 2017 +++ src/sys/netinet/if_arp.c Fri Feb 24 13:42:18 2017 @@ -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 @@ in_arpinput(struct mbuf *m) 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 @@ in_arpinput(struct mbuf *m) 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 @@ in_arpinput(struct mbuf *m) } /* 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));