Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet If an ARP packet is received to the null host (0...



details:   https://anonhg.NetBSD.org/src/rev/0dc1542da0a5
branches:  trunk
changeset: 352021:0dc1542da0a5
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Mar 10 20:27:31 2017 +0000

description:
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.

diffstat:

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

diffs (69 lines):

diff -r 554373aee479 -r 0dc1542da0a5 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Fri Mar 10 18:02:32 2017 +0000
+++ b/sys/netinet/if_arp.c      Fri Mar 10 20:27:31 2017 +0000
@@ -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 @@
        /*
         * 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 @@
        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 @@
                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;
 



Home | Main Index | Thread Index | Old Index