diff options
| author | martin <martin@NetBSD.org> | 2021-02-16 10:22:52 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2021-02-16 10:22:52 +0000 |
| commit | c1956a3b86f3283f774aad3bf895f4221bc04b4b (patch) | |
| tree | 53c1bd6d9a0c566b8b46f64ce0e22df0dd8d1d60 /sys/netinet | |
| parent | 7bae53ce11367d24317defc63f4d39157ef91fec (diff) | |
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 (limited to 'sys/netinet')
| -rw-r--r-- | sys/netinet/if_arp.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/netinet/if_arp.c b/sys/netinet/if_arp.c index 313424f1f42..9846bf2655d 100644 --- a/sys/netinet/if_arp.c +++ b/sys/netinet/if_arp.c @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.305 2021/02/16 05:44:13 martin Exp $"); */ #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 @@ arpintr(void) 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)); |
