Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet One more time: backout arp header alignment, now...
details: https://anonhg.NetBSD.org/src/rev/77ea07f28d57
branches: trunk
changeset: 952742:77ea07f28d57
user: martin <martin%NetBSD.org@localhost>
date: Tue Feb 16 10:22:52 2021 +0000
description:
One more time: backout arp header alignment, now that the alignment
asserted has been aligned to reality.
Also remove unused ARP_HDR_ALIGNED_P macro. Pointed out by roy.
diffstat:
sys/netinet/if_arp.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
diffs (45 lines):
diff -r 39cea81b2aea -r 77ea07f28d57 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Tue Feb 16 10:20:56 2021 +0000
+++ b/sys/netinet/if_arp.c Tue Feb 16 10:22:52 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.305 2021/02/16 05:44:13 martin Exp $ */
+/* $NetBSD: if_arp.c,v 1.306 2021/02/16 10:22:52 martin 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.305 2021/02/16 05:44:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.306 2021/02/16 10:22:52 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -133,12 +133,6 @@
*/
#define ETHERTYPE_IPTRAILERS ETHERTYPE_TRAIL
-#ifdef __NO_STRICT_ALIGNMENT
-#define ARP_HDR_ALIGNED_P(ar) 1
-#else
-#define ARP_HDR_ALIGNED_P(ar) ((((vaddr_t) (ar)) & 1) == 0)
-#endif
-
/* timers */
static int arp_reachable = REACHABLE_TIME;
static int arp_retrans = RETRANS_TIMER;
@@ -707,9 +701,10 @@
MCLAIM(m, &arpdomain.dom_mowner);
ARP_STATINC(ARP_STAT_RCVTOTAL);
- if (m_get_aligned_hdr(&m, ARP_HDR_ALIGNMENT, sizeof(*ar),
- false) != 0)
- goto badlen;
+ if (__predict_false(m->m_len < sizeof(*ar))) {
+ if ((m = m_pullup(m, sizeof(*ar))) == NULL)
+ goto badlen;
+ }
ar = mtod(m, struct arphdr *);
KASSERT(POINTER_ALIGNED_P(ar, ARP_HDR_ALIGNMENT));
Home |
Main Index |
Thread Index |
Old Index