Fri Oct 11 18:22:14 2019 UTC ()
Pull up following revision(s) (requested by roy in ticket #300):

	sys/netinet/if_arp.c: revision 1.289

ARP: Don't defend ARP probes.

We should let the nature of ARP takes it's course here when our address
is neither tentative nor duplicated.
This allows the host to work with ARP ping, which was broken in r1.279.


(martin)
diff -r1.282.2.4 -r1.282.2.5 src/sys/netinet/if_arp.c

cvs diff -r1.282.2.4 -r1.282.2.5 src/sys/netinet/if_arp.c (expand / switch to unified diff)

--- src/sys/netinet/if_arp.c 2019/09/30 15:55:40 1.282.2.4
+++ src/sys/netinet/if_arp.c 2019/10/11 18:22:14 1.282.2.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_arp.c,v 1.282.2.4 2019/09/30 15:55:40 martin Exp $ */ 1/* $NetBSD: if_arp.c,v 1.282.2.5 2019/10/11 18:22:14 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Public Access Networks Corporation ("Panix"). It was developed under 8 * by Public Access Networks Corporation ("Panix"). It was developed under
9 * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon. 9 * contract to Panix by Eric Haszlakiewicz and Thor Lancelot Simon.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -58,27 +58,27 @@ @@ -58,27 +58,27 @@
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE. 59 * SUCH DAMAGE.
60 * 60 *
61 * @(#)if_ether.c 8.2 (Berkeley) 9/26/94 61 * @(#)if_ether.c 8.2 (Berkeley) 9/26/94
62 */ 62 */
63 63
64/* 64/*
65 * Ethernet address resolution protocol. 65 * Ethernet address resolution protocol.
66 * TODO: 66 * TODO:
67 * add "inuse/lock" bit (or ref. count) along with valid bit 67 * add "inuse/lock" bit (or ref. count) along with valid bit
68 */ 68 */
69 69
70#include <sys/cdefs.h> 70#include <sys/cdefs.h>
71__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.282.2.4 2019/09/30 15:55:40 martin Exp $"); 71__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.282.2.5 2019/10/11 18:22:14 martin Exp $");
72 72
73#ifdef _KERNEL_OPT 73#ifdef _KERNEL_OPT
74#include "opt_ddb.h" 74#include "opt_ddb.h"
75#include "opt_inet.h" 75#include "opt_inet.h"
76#include "opt_net_mpsafe.h" 76#include "opt_net_mpsafe.h"
77#endif 77#endif
78 78
79#ifdef INET 79#ifdef INET
80 80
81#include "arp.h" 81#include "arp.h"
82#include "bridge.h" 82#include "bridge.h"
83 83
84#include <sys/param.h> 84#include <sys/param.h>
@@ -1147,35 +1147,37 @@ in_arpinput(struct mbuf *m) @@ -1147,35 +1147,37 @@ in_arpinput(struct mbuf *m)
1147 * If the source IP address is zero, this is an RFC 5227 ARP probe 1147 * If the source IP address is zero, this is an RFC 5227 ARP probe
1148 */ 1148 */
1149 if (in_nullhost(isaddr)) 1149 if (in_nullhost(isaddr))
1150 ARP_STATINC(ARP_STAT_RCVZEROSPA); 1150 ARP_STATINC(ARP_STAT_RCVZEROSPA);
1151 else if (in_hosteq(isaddr, myaddr)) 1151 else if (in_hosteq(isaddr, myaddr))
1152 ARP_STATINC(ARP_STAT_RCVLOCALSPA); 1152 ARP_STATINC(ARP_STAT_RCVLOCALSPA);
1153 1153
1154 if (in_nullhost(itaddr)) 1154 if (in_nullhost(itaddr))
1155 ARP_STATINC(ARP_STAT_RCVZEROTPA); 1155 ARP_STATINC(ARP_STAT_RCVZEROTPA);
1156 1156
1157 /* 1157 /*
1158 * DAD check, RFC 5227. 1158 * DAD check, RFC 5227.
1159 * Collision on sender address is always a duplicate. 1159 * Collision on sender address is always a duplicate.
1160 * Collision on target address is only a duplicate IF 1160 * Collision on target address is only a duplicate
1161 * the sender address is the null host (ie a DAD probe) AND 1161 * IF the sender address is the null host (ie a DAD probe)
1162 * the message was broadcast - if it's unicast then it's 1162 * AND the message was broadcast
1163 * a valid Unicast Poll from RFC 1122. 1163 * AND our address is either tentative or duplicated
 1164 * If it was unicast then it's a valid Unicast Poll from RFC 1122.
1164 */ 1165 */
1165 if (do_dad && 1166 if (do_dad &&
1166 (in_hosteq(isaddr, myaddr) || 1167 (in_hosteq(isaddr, myaddr) ||
1167 (in_nullhost(isaddr) && in_hosteq(itaddr, myaddr) && 1168 (in_nullhost(isaddr) && in_hosteq(itaddr, myaddr) &&
1168 m->m_flags & M_BCAST))) 1169 m->m_flags & M_BCAST &&
 1170 ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED))))
1169 { 1171 {
1170 struct sockaddr_dl sdl, *sdlp; 1172 struct sockaddr_dl sdl, *sdlp;
1171 1173
1172 sdlp = sockaddr_dl_init(&sdl, sizeof(sdl), 1174 sdlp = sockaddr_dl_init(&sdl, sizeof(sdl),
1173 ifp->if_index, ifp->if_type, 1175 ifp->if_index, ifp->if_type,
1174 NULL, 0, ar_sha(ah), ah->ar_hln); 1176 NULL, 0, ar_sha(ah), ah->ar_hln);
1175 arp_dad_duplicated((struct ifaddr *)ia, sdlp); 1177 arp_dad_duplicated((struct ifaddr *)ia, sdlp);
1176 goto out; 1178 goto out;
1177 } 1179 }
1178 1180
1179 /* 1181 /*
1180 * If the target IP address is zero, ignore the packet. 1182 * If the target IP address is zero, ignore the packet.
1181 * This prevents the code below from trying to answer 1183 * This prevents the code below from trying to answer