diff options
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/isa/if_el.c | 45 | ||||
-rw-r--r-- | sys/i386/isa/if_fe.c | 62 | ||||
-rw-r--r-- | sys/i386/isa/if_le.c | 48 | ||||
-rw-r--r-- | sys/i386/isa/if_lnc.c | 57 | ||||
-rw-r--r-- | sys/i386/isa/if_rdp.c | 24 | ||||
-rw-r--r-- | sys/i386/isa/if_wi.c | 13 | ||||
-rw-r--r-- | sys/i386/isa/if_wl.c | 21 |
7 files changed, 17 insertions, 253 deletions
diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c index 7a76f03..bbe0940 100644 --- a/sys/i386/isa/if_el.c +++ b/sys/i386/isa/if_el.c @@ -70,7 +70,7 @@ static void el_stop(void *); static int el_xmit(struct el_softc *,int); static ointhand2_t elintr; static __inline void elread(struct el_softc *,caddr_t,int); -static struct mbuf *elget(caddr_t,int,int,struct ifnet *); +static struct mbuf *elget(caddr_t,int,struct ifnet *); static __inline void el_hardreset(void *); /* isa_driver structure for autoconf */ @@ -424,32 +424,9 @@ elread(struct el_softc *sc,caddr_t buf,int len) eh = (struct ether_header *)buf; /* - * Check if there's a bpf filter listening on this interface. - * If so, hand off the raw packet to bpf. + * Put packet into an mbuf chain */ - if(sc->arpcom.ac_if.if_bpf) { - bpf_tap(&sc->arpcom.ac_if, buf, - len + sizeof(struct ether_header)); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no bpf listeners. And if el are in promiscuous - * mode, el have to check if this packet is really ours. - * - * This test does not support multicasts. - */ - if((sc->arpcom.ac_if.if_flags & IFF_PROMISC) - && bcmp(eh->ether_dhost,sc->arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0 - && bcmp(eh->ether_dhost,etherbroadcastaddr, - sizeof(eh->ether_dhost)) != 0) - return; - } - - /* - * Pull packet off interface. - */ - m = elget(buf,len,0,&sc->arpcom.ac_if); + m = elget(buf,len,&sc->arpcom.ac_if); if(m == 0) return; @@ -557,27 +534,21 @@ elintr(int unit) * Pull read data off a interface. * Len is length of data, with local net header stripped. */ -struct mbuf * -elget(buf, totlen, off0, ifp) +static struct mbuf * +elget(buf, totlen, ifp) caddr_t buf; - int totlen, off0; + int totlen; struct ifnet *ifp; { struct mbuf *top, **mp, *m; - int off = off0, len; - register caddr_t cp = buf; + int len; + register caddr_t cp; char *epkt; buf += sizeof(struct ether_header); cp = buf; epkt = cp + totlen; - - if (off) { - cp += off + 2 * sizeof(u_short); - totlen -= 2 * sizeof(u_short); - } - MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) return (0); diff --git a/sys/i386/isa/if_fe.c b/sys/i386/isa/if_fe.c index ac0d57f..821c80b 100644 --- a/sys/i386/isa/if_fe.c +++ b/sys/i386/isa/if_fe.c @@ -66,7 +66,6 @@ * cons of multiple frame transmission. * o To test IPX codes. * o To test FreeBSD3.0-current. - * o To test BRIDGE codes. */ #include "fe.h" @@ -92,10 +91,6 @@ #include <net/bpf.h> -#ifdef BRIDGE -#include <net/bridge.h> -#endif - #include <machine/clock.h> #include <i386/isa/isa_device.h> @@ -3819,7 +3814,7 @@ fe_ioctl ( struct ifnet * ifp, u_long command, caddr_t data ) /* * Retrieve packet from receive buffer and send to the next level up via - * ether_input(). If there is a BPF listener, give a copy to BPF, too. + * ether_input(). * Returns 0 if success, -1 if error (i.e., mbuf allocation failure). */ static int @@ -3897,61 +3892,6 @@ fe_get_packet ( struct fe_softc * sc, u_short len ) insw( sc->ioaddr[ FE_BMPR8 ], eh, ( len + 1 ) >> 1 ); } -#define ETHER_ADDR_IS_MULTICAST(A) (*(char *)(A) & 1) - - /* - * Check if there's a BPF listener on this interface. - * If it is, hand off the raw packet to bpf. - */ - if ( sc->sc_if.if_bpf ) { - bpf_mtap( &sc->sc_if, m ); - } - -#ifdef BRIDGE - if (do_bridge) { - struct ifnet *ifp; - - ifp = bridge_in(m); - if (ifp == BDG_DROP) { - m_freem(m); - return 0; - } - if (ifp != BDG_LOCAL) - bdg_forward(&m, ifp); /* not local, need forwarding */ - if (ifp == BDG_LOCAL || ifp == BDG_BCAST || ifp == BDG_MCAST) - goto getit; - /* not local and not multicast, just drop it */ - if (m) - m_freem(m); - return 0; - } -#endif - - /* - * Make sure this packet is (or may be) directed to us. - * That is, the packet is either unicasted to our address, - * or broad/multi-casted. If any other packets are - * received, it is an indication of an error -- probably - * 86960 is in a wrong operation mode. - * Promiscuous mode is an exception. Under the mode, all - * packets on the media must be received. (We must have - * programmed the 86960 so.) - */ - - if ( ( sc->sc_if.if_flags & IFF_PROMISC ) - && !ETHER_ADDR_IS_MULTICAST( eh->ether_dhost ) - && bcmp( eh->ether_dhost, sc->sc_enaddr, ETHER_ADDR_LEN ) != 0 ) { - /* - * The packet was not for us. This is normal since - * we are now in promiscuous mode. Just drop the packet. - */ - m_freem( m ); - return 0; - } - -#ifdef BRIDGE -getit: -#endif /* Strip off the Ethernet header. */ m->m_pkthdr.len -= sizeof ( struct ether_header ); m->m_len -= sizeof ( struct ether_header ); diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c index 2050196..35951a6 100644 --- a/sys/i386/isa/if_le.c +++ b/sys/i386/isa/if_le.c @@ -203,9 +203,6 @@ struct le_softc { le_mcbits_t *le_mctbl; /* pointer to multicast table */ const char *le_prodname; /* product name DE20x-xx */ u_char le_hwaddr[6]; /* local copy of hwaddr */ - unsigned le_scast_drops; /* singlecast drops */ - unsigned le_mcast_drops; /* multicast drops */ - unsigned le_bcast_drops; /* broadcast drops */ union { #if !defined(LE_NOLEMAC) struct le_lemac_info un_lemac; /* LEMAC specific information */ @@ -394,27 +391,6 @@ le_input( } MEMCPY(&eh, seg1, sizeof(eh)); - if (sc->le_if.if_bpf != NULL && seg2 == NULL) { - bpf_tap(&sc->le_if, seg1, total_len); - /* - * If this is single cast but not to us - * drop it! - */ - if ((eh.ether_dhost[0] & 1) == 0) { - if (!LE_ADDREQUAL(eh.ether_dhost, sc->le_ac.ac_enaddr)) { - sc->le_scast_drops++; - return; - } - } else if ((sc->le_flags & IFF_MULTICAST) == 0) { - sc->le_mcast_drops++; - return; - } else if (sc->le_flags & LE_BRDCSTONLY) { - if (!LE_ADDRBRDCST(eh.ether_dhost)) { - sc->le_bcast_drops++; - return; - } - } - } seg1 += sizeof(eh); total_len -= sizeof(eh); len1 -= sizeof(eh); MGETHDR(m, M_DONTWAIT, MT_DATA); @@ -449,30 +425,6 @@ le_input( MEMCPY(mtod(m, caddr_t), seg1, len1); if (seg2 != NULL) MEMCPY(mtod(m, caddr_t) + len1, seg2, total_len - len1); - if (sc->le_if.if_bpf != NULL && seg2 != NULL) { - bpf_mtap(&sc->le_if, m); - /* - * If this is single cast but not to us - * drop it! - */ - if ((eh.ether_dhost[0] & 1) == 0) { - if (!LE_ADDREQUAL(eh.ether_dhost, sc->le_ac.ac_enaddr)) { - sc->le_scast_drops++; - m_freem(m); - return; - } - } else if ((sc->le_flags & IFF_MULTICAST) == 0) { - sc->le_mcast_drops++; - m_freem(m); - return; - } else if (sc->le_flags & LE_BRDCSTONLY) { - if (!LE_ADDRBRDCST(eh.ether_dhost)) { - sc->le_bcast_drops++; - m_freem(m); - return; - } - } - } ether_input(&sc->le_if, &eh, m); } diff --git a/sys/i386/isa/if_lnc.c b/sys/i386/isa/if_lnc.c index 42e3c02..308f557 100644 --- a/sys/i386/isa/if_lnc.c +++ b/sys/i386/isa/if_lnc.c @@ -84,11 +84,6 @@ #include <net/bpf.h> -#include "opt_bdg.h" -#ifdef BRIDGE -#include <net/bridge.h> -#endif - #ifdef PC98 #include <machine/clock.h> #endif @@ -596,56 +591,14 @@ lnc_rint(struct lnc_softc *sc) */ head->m_pkthdr.rcvif = &sc->arpcom.ac_if; head->m_pkthdr.len = pkt_len ; - - /* - * BPF expects the ether header to be in the first - * mbuf of the chain so point eh at the right place - * but don't increment the mbuf pointers before - * the bpf tap. - */ - eh = (struct ether_header *) head->m_data; - if (sc->arpcom.ac_if.if_bpf) - bpf_mtap(&sc->arpcom.ac_if, head); -#ifdef BRIDGE - if (do_bridge) { - struct ifnet *bdg_ifp ; - - bdg_ifp = bridge_in(head); - if (bdg_ifp == BDG_DROP) - m_freem(head); - else { - if (bdg_ifp != BDG_LOCAL) - bdg_forward(&head, bdg_ifp); - if ( bdg_ifp == BDG_LOCAL || - bdg_ifp == BDG_BCAST || - bdg_ifp == BDG_MCAST ) - goto getit; - else if (head) - m_freem(head); - } - } else -#endif - /* Check this packet is really for us */ - - if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) && - !(eh->ether_dhost[0] & 1) && /* Broadcast and multicast */ - (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, - sizeof(eh->ether_dhost)))) - m_freem(head); - else - { -#ifdef BRIDGE -getit: -#endif - /* Skip over the ether header */ - head->m_data += sizeof *eh; - head->m_len -= sizeof *eh; - head->m_pkthdr.len -= sizeof *eh; + /* Skip over the ether header */ + head->m_data += sizeof *eh; + head->m_len -= sizeof *eh; + head->m_pkthdr.len -= sizeof *eh; - ether_input(&sc->arpcom.ac_if, eh, head); - } + ether_input(&sc->arpcom.ac_if, eh, head); } else { int unit = sc->arpcom.ac_if.if_unit; diff --git a/sys/i386/isa/if_rdp.c b/sys/i386/isa/if_rdp.c index 5c7d761..5b45c0f 100644 --- a/sys/i386/isa/if_rdp.c +++ b/sys/i386/isa/if_rdp.c @@ -1093,8 +1093,7 @@ rdp_rint(struct rdp_softc *sc) /* * Retreive packet from NIC memory and send to the next level up via - * ether_input(). If there is a BPF listener, give a copy to BPF, - * too. + * ether_input(). */ static void rdp_get_packet(struct rdp_softc *sc, unsigned len) @@ -1154,33 +1153,12 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len) WrNib(sc, CMR1, CMR1_RDPAC); /* - * Check if there's a BPF listener on this interface. If so, hand off - * the raw packet to bpf. - */ - if (sc->arpcom.ac_if.if_bpf) { - bpf_mtap(&sc->arpcom.ac_if, m); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no BPF listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) && - bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(m); - return; - } - } - - /* * Remove link layer address. */ m->m_pkthdr.len = m->m_len = len - sizeof(struct ether_header); m->m_data += sizeof(struct ether_header); ether_input(&sc->arpcom.ac_if, eh, m); - return; } /* diff --git a/sys/i386/isa/if_wi.c b/sys/i386/isa/if_wi.c index eb8053b..441beaf 100644 --- a/sys/i386/isa/if_wi.c +++ b/sys/i386/isa/if_wi.c @@ -430,25 +430,12 @@ static void wi_rxeof(sc) ifp->if_ipackets++; - /* Handle BPF listeners. */ - if (ifp->if_bpf) { - bpf_mtap(ifp, m); - if (ifp->if_flags & IFF_PROMISC && - (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, - ETHER_ADDR_LEN) && (eh->ether_dhost[0] & 1) == 0)) { - m_freem(m); - return; - } - } - /* Receive packet. */ m_adj(m, sizeof(struct ether_header)); #ifdef WICACHE wi_cache_store(sc, eh, m, rx_frame.wi_q_info); #endif ether_input(ifp, eh, m); - - return; } static void wi_txeof(sc, status) diff --git a/sys/i386/isa/if_wl.c b/sys/i386/isa/if_wl.c index 6111b8d..44f2849 100644 --- a/sys/i386/isa/if_wl.c +++ b/sys/i386/isa/if_wl.c @@ -1075,27 +1075,10 @@ wlread(int unit, u_short fd_p) m->m_pkthdr.len = clen; /* - * Check if there's a BPF listener on this interface. If so, hand off - * the raw packet to bpf. - */ - if (ifp->if_bpf) { - /* bpf assumes header is in mbufs. It isn't. We can - * fool it without allocating memory as follows. - * Trick borrowed from if_ie.c - */ - struct mbuf m0; - m0.m_len = sizeof eh; - m0.m_data = (caddr_t) &eh; - m0.m_next = m; - - bpf_mtap(ifp, &m0); - - } - /* * If hw is in promiscuous mode (note that I said hardware, not if * IFF_PROMISC is set in ifnet flags), then if this is a unicast - * packet and the MAC dst is not us, drop it. This check was formerly - * inside the bpf if, above, but IFF_MULTI causes hw promisc without + * packet and the MAC dst is not us, drop it. This check in normally + * inside ether_input(), but IFF_MULTI causes hw promisc without * a bpf listener, so this is wrong. * Greg Troxel <gdt@ir.bbn.com>, 1998-08-07 */ |