if_ether: revert prior alignment checks

Apparently not needed as our drivers ensure this.
This commit is contained in:
roy 2021-02-14 19:35:37 +00:00
parent 880dbbbc52
commit 951b7674b2
2 changed files with 7 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.85 2021/02/13 07:28:04 roy Exp $ */
/* $NetBSD: if_ether.h,v 1.86 2021/02/14 19:35:37 roy Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -89,15 +89,6 @@ struct ether_header {
uint8_t ether_shost[ETHER_ADDR_LEN];
uint16_t ether_type;
};
#ifdef __NO_STRICT_ALIGNMENT
#define ETHER_HDR_ALIGNED_P(eh) 1
#else
#define ETHER_HDR_ALIGNED_P(eh) ((((vaddr_t) (eh)) & 3) == 0)
#endif
#ifdef __CTASSERT
__CTASSERT(sizeof(struct ether_addr) == 6);
__CTASSERT(sizeof(struct ether_header) == 14);
#endif
#include <net/ethertypes.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.292 2021/02/14 19:35:37 roy Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.292 2021/02/14 19:35:37 roy Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -164,6 +164,9 @@ extern u_char aarp_org_code[3];
#include <netmpls/mpls_var.h>
#endif
CTASSERT(sizeof(struct ether_addr) == 6);
CTASSERT(sizeof(struct ether_header) == 14);
#ifdef DIAGNOSTIC
static struct timeval bigpktppslim_last;
static int bigpktppslim = 2; /* XXX */
@ -653,11 +656,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
m_claimm(m, &ec->ec_rx_mowner);
#endif
/* Enforce alignement */
if (ETHER_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
if ((m = m_copyup(m, sizeof(*eh), 0)) == NULL)
goto dropped;
} else if (__predict_false(m->m_len < sizeof(*eh))) {
if (__predict_false(m->m_len < sizeof(*eh))) {
if ((m = m_pullup(m, sizeof(*eh))) == NULL)
goto dropped;
}