Module Name: src
Committed By: roy
Date: Fri Mar 10 20:27:31 UTC 2017
Modified Files:
src/sys/netinet: if_arp.c
Log Message:
If an ARP packet is received to the null host (0.0.0.0) then look for
an address matching the sender IP address on the interface.
This allows DAD to fail during the probe phase when a reverse ARP
proxy is present.
To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 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.245 src/sys/netinet/if_arp.c:1.246
--- src/sys/netinet/if_arp.c:1.245 Thu Mar 9 08:41:56 2017
+++ src/sys/netinet/if_arp.c Fri Mar 10 20:27:31 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.245 2017/03/09 08:41:56 roy Exp $ */
+/* $NetBSD: if_arp.c,v 1.246 2017/03/10 20:27:31 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.245 2017/03/09 08:41:56 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.246 2017/03/10 20:27:31 roy Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -1058,11 +1058,15 @@ in_arpinput(struct mbuf *m)
/*
* Search for a matching interface address
* or any address on the interface to use
- * as a dummy address in the rest of this function
+ * as a dummy address in the rest of this function.
+ *
+ * If the target IP address is zero then try and find
+ * the sender address for DAD.
*/
+ myaddr = in_nullhost(itaddr) ? isaddr : itaddr;
s = pserialize_read_enter();
- IN_ADDRHASH_READER_FOREACH(ia, itaddr.s_addr) {
- if (!in_hosteq(ia->ia_addr.sin_addr, itaddr))
+ IN_ADDRHASH_READER_FOREACH(ia, myaddr.s_addr) {
+ if (!in_hosteq(ia->ia_addr.sin_addr, myaddr))
continue;
#if NCARP > 0
if (ia->ia_ifp->if_type == IFT_CARP &&
@@ -1153,15 +1157,8 @@ in_arpinput(struct mbuf *m)
else if (in_hosteq(isaddr, myaddr))
ARP_STATINC(ARP_STAT_RCVLOCALSPA);
- /*
- * If the target IP address is zero, ignore the packet.
- * This prevents the code below from trying to answer
- * when we are using IP address zero (booting).
- */
- if (in_nullhost(itaddr)) {
+ if (in_nullhost(itaddr))
ARP_STATINC(ARP_STAT_RCVZEROTPA);
- goto out;
- }
/*
* DAD check, RFC 5227.
@@ -1182,6 +1179,14 @@ in_arpinput(struct mbuf *m)
goto out;
}
+ /*
+ * If the target IP address is zero, ignore the packet.
+ * This prevents the code below from trying to answer
+ * when we are using IP address zero (booting).
+ */
+ if (in_nullhost(itaddr))
+ goto out;
+
if (in_nullhost(isaddr))
goto reply;