Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Don't force ARPHRD_IEEE1394 on IEEE1394 interfac...
details: https://anonhg.NetBSD.org/src/rev/719902141c1c
branches: trunk
changeset: 359504:719902141c1c
user: maxv <maxv%NetBSD.org@localhost>
date: Tue Feb 13 08:51:37 2018 +0000
description:
Don't force ARPHRD_IEEE1394 on IEEE1394 interfaces. If it's not there, then
kick the packet. And do this earlier.
diffstat:
sys/netinet/if_arp.c | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
diffs (70 lines):
diff -r 13bda83db105 -r 719902141c1c sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Tue Feb 13 08:43:26 2018 +0000
+++ b/sys/netinet/if_arp.c Tue Feb 13 08:51:37 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.259 2018/02/13 08:20:12 maxv Exp $ */
+/* $NetBSD: if_arp.c,v 1.260 2018/02/13 08:51:37 maxv 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.259 2018/02/13 08:20:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.260 2018/02/13 08:51:37 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -949,8 +949,19 @@
ARP_STATINC(ARP_STAT_RCVNOINT);
goto free;
}
+
switch (rcvif->if_type) {
case IFT_IEEE1394:
+ /*
+ * We don't want non-IEEE1394 ARP packets on IEEE1394
+ * interfaces. Our life depends on that.
+ */
+ if (ntohs(ar->ar_hrd) != ARPHRD_IEEE1394) {
+ m_put_rcvif(rcvif, &s);
+ ARP_STATINC(ARP_STAT_RCVBADPROTO);
+ goto free;
+ }
+
arplen = sizeof(struct arphdr) +
ar->ar_hln + 2 * ar->ar_pln;
break;
@@ -959,6 +970,7 @@
2 * ar->ar_hln + 2 * ar->ar_pln;
break;
}
+
m_put_rcvif(rcvif, &s);
if (m->m_len < arplen && (m = m_pullup(m, arplen)) == NULL)
@@ -1043,23 +1055,6 @@
if (__predict_false(rcvif == NULL))
goto out;
- /*
- * Fix up ah->ar_hrd if necessary, before using ar_tha() or ar_tpa().
- * XXX check ar_hrd more strictly?
- */
- switch (ifp->if_type) {
- case IFT_IEEE1394:
- if (ntohs(ah->ar_hrd) == ARPHRD_IEEE1394)
- ;
- else {
- /* XXX this is to make sure we compute ar_tha right */
- ah->ar_hrd = htons(ARPHRD_IEEE1394);
- }
- break;
- default:
- break;
- }
-
memcpy(&isaddr, ar_spa(ah), sizeof(isaddr));
memcpy(&itaddr, ar_tpa(ah), sizeof(itaddr));
Home |
Main Index |
Thread Index |
Old Index