diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-11-25 12:24:01 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-11-25 12:24:01 +0000 |
commit | 9d1ca56de997f833cc58c4b336853569b8c6289b (patch) | |
tree | 4103bab9e76dc684ef11969c5760cbd8913d5bb2 /sys | |
parent | 4abf735ccbe62153a9fcd248886f0ac74f488980 (diff) |
Strip the CRC in rxeof()
ok claudio@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_et.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index 1a9eb0ff8c7..18c927e2e7d 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.2 2007/11/25 11:45:14 claudio Exp $ */ +/* $OpenBSD: if_et.c,v 1.3 2007/11/25 12:24:00 jsg Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -1775,16 +1775,23 @@ et_rxeof(struct et_softc *sc) rb->rb_dmap->dm_mapsize, BUS_DMASYNC_POSTREAD); if (rbd->rbd_newbuf(rbd, buf_idx, 0) == 0) { - m->m_pkthdr.len = m->m_len = buflen; - m->m_pkthdr.rcvif = ifp; + if (buflen < ETHER_CRC_LEN) { + m_freem(m); + ifp->if_ierrors++; + } else { + m->m_pkthdr.len = m->m_len = buflen - + ETHER_CRC_LEN; + m->m_pkthdr.rcvif = ifp; #if NBPFILTER > 0 - if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); + if (ifp->if_bpf != NULL) + bpf_mtap(ifp->if_bpf, m, + BPF_DIRECTION_IN); #endif - ifp->if_ipackets++; - ether_input_mbuf(ifp, m); + ifp->if_ipackets++; + ether_input_mbuf(ifp, m); + } } else { ifp->if_ierrors++; } |