Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Be tougher:
details: https://anonhg.NetBSD.org/src/rev/4be654544071
branches: trunk
changeset: 359513:4be654544071
user: maxv <maxv%NetBSD.org@localhost>
date: Tue Feb 13 10:47:41 2018 +0000
description:
Be tougher:
* In arpintr(), don't allow IEEE1394 packets on non-IEEE1394 interfaces.
* In revarpinput(), kick IEEE1394 packets right away. They are not
supported.
diffstat:
sys/netinet/if_arp.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diffs (67 lines):
diff -r e3fffaafe0d2 -r 4be654544071 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Tue Feb 13 10:31:01 2018 +0000
+++ b/sys/netinet/if_arp.c Tue Feb 13 10:47:41 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.263 2018/02/13 10:31:01 maxv Exp $ */
+/* $NetBSD: if_arp.c,v 1.264 2018/02/13 10:47:41 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.263 2018/02/13 10:31:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.264 2018/02/13 10:47:41 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -948,12 +948,12 @@
goto free;
}
+ /*
+ * We don't want non-IEEE1394 ARP packets on IEEE1394
+ * interfaces, and vice versa. Our life depends on that.
+ */
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);
@@ -964,6 +964,12 @@
ar->ar_hln + 2 * ar->ar_pln;
break;
default:
+ if (ntohs(ar->ar_hrd) == ARPHRD_IEEE1394) {
+ m_put_rcvif(rcvif, &s);
+ ARP_STATINC(ARP_STAT_RCVBADPROTO);
+ goto free;
+ }
+
arplen = sizeof(struct arphdr) +
2 * ar->ar_hln + 2 * ar->ar_pln;
break;
@@ -1827,6 +1833,10 @@
return;
ar = mtod(m, struct arphdr *);
+ if (ntohs(ar->ar_hrd) == ARPHRD_IEEE1394) {
+ goto out;
+ }
+
arplen = sizeof(struct arphdr) + 2 * (ar->ar_hln + ar->ar_pln);
if (m->m_len < arplen && (m = m_pullup(m, arplen)) == NULL)
return;
@@ -1842,6 +1852,7 @@
break;
}
+out:
m_freem(m);
}
Home |
Main Index |
Thread Index |
Old Index