Consider the configured MTU of the interface when determining

if a packet is too large.
This commit is contained in:
thorpej 2001-06-03 03:24:23 +00:00
parent 88905c8ca1
commit 7b1b8dd02a
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.24 2001/06/03 03:07:40 thorpej Exp $ */
/* $NetBSD: if_ether.h,v 1.25 2001/06/03 03:24:23 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -83,8 +83,8 @@ struct ether_header {
* Compute the maximum frame size based on ethertype (i.e. possible
* encapsulation) and whether or not an FCS is present.
*/
#define ETHER_MAX_FRAME(etype, hasfcs) \
(ETHERMTU + ETHER_HDR_LEN + \
#define ETHER_MAX_FRAME(ifp, etype, hasfcs) \
((ifp)->if_mtu + ETHER_HDR_LEN + \
((hasfcs) ? ETHER_CRC_LEN : 0) + \
(((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0))

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ethersubr.c,v 1.82 2001/06/03 03:07:39 thorpej Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.83 2001/06/03 03:24:23 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -653,7 +653,8 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
/*
* Determine if the packet is within its size limits.
*/
if (m->m_pkthdr.len > ETHER_MAX_FRAME(etype, m->m_flags & M_HASFCS)) {
if (m->m_pkthdr.len >
ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) {
printf("%s: discarding oversize frame (len=%d)\n",
ifp->if_xname, m->m_pkthdr.len);
m_freem(m);