diff options
-rw-r--r-- | sys/dev/ed/if_ed.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 1d877cb..604c287 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -2177,7 +2177,7 @@ ed_rint(sc) * But make sure that we have at least a full ethernet header * or we would be unable to call ether_input() later. */ - if ((len > sizeof(struct ed_ring) + ETHER_HDR_LEN) && + if ((len >= sizeof(struct ed_ring) + ETHER_HDR_LEN) && (len <= MCLBYTES) && (packet_hdr.next_packet >= sc->rec_page_start) && (packet_hdr.next_packet < sc->rec_page_stop)) { @@ -2644,17 +2644,21 @@ ed_get_packet(sc, buf, len) #ifdef BRIDGE /* * Don't read in the entire packet if we know we're going to drop it + * and no bpf is active. */ - if (do_bridge) { + if (!sc->arpcom.ac_if.if_bpf && + do_bridge && BDG_USED( (&sc->arpcom.ac_if) ) ) { struct ifnet *bif; ed_ring_copy(sc, buf, (char *)eh, ETHER_HDR_LEN); - if ((bif = bridge_in(&sc->arpcom.ac_if, eh)) == BDG_DROP) { + bif = bridge_in(&sc->arpcom.ac_if, eh) ; + if (bif == BDG_DROP) { m_freem(m); return; } - ed_ring_copy(sc, buf + ETHER_HDR_LEN, - (char *)eh + ETHER_HDR_LEN, len - ETHER_HDR_LEN); + if (len > ETHER_HDR_LEN) + ed_ring_copy(sc, buf + ETHER_HDR_LEN, + (char *)(eh + 1), len - ETHER_HDR_LEN); } else #endif /* |