Remove NBPF conditionality of bpf calls in most of our network drivers.

This means that we will not have to have a bpf and a non-bpf version
of our driver modules.

This does not open any security hole, because the bpf core isn't loadable

The drivers left unchanged are the "cross platform" drivers where the respective
maintainers are urged to DTRT, whatever that may be.

Add a couple of missing FreeBSD tags.
This commit is contained in:
Poul-Henning Kamp 1999-09-25 12:06:01 +00:00
parent 40bc58df9a
commit 46783fb897
53 changed files with 16 additions and 563 deletions

View File

@ -78,10 +78,7 @@
*/
#include "opt_inet.h"
#if NBPF > 0
#include <net/bpf.h>
#include <net/bpfdesc.h>
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -229,9 +226,7 @@ am7990_config(sc)
if_attach(ifp);
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
switch (sc->sc_memsize) {
case 8192:
@ -318,11 +313,9 @@ am7990_meminit(sc)
struct letmd tmd;
u_int8_t *myaddr;
#if NBPF > 0
if (ifp->if_flags & IFF_PROMISC)
init.init_mode = LE_MODE_NORMAL | LE_MODE_PROM;
else
#endif
init.init_mode = LE_MODE_NORMAL;
if (sc->sc_initmodemedia == 1)
init.init_mode |= LE_MODE_PSEL0;
@ -565,7 +558,6 @@ am7990_read(sc, boff, len)
/* We assume that the header fit entirely in one mbuf. */
eh = mtod(m, struct ether_header *);
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface.
* If so, hand off the raw packet to BPF.
@ -587,7 +579,6 @@ am7990_read(sc, boff, len)
}
#endif
}
#endif
#ifdef LANCE_REVC_BUG
/*
@ -923,14 +914,12 @@ am7990_start(ifp)
if (m == 0)
break;
#if NBPF > 0
/*
* If BPF is listening on this interface, let it see the packet
* before we commit it to the wire.
*/
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m);
#endif
/*
* Copy the mbuf chain into the transmit buffer.

View File

@ -37,7 +37,6 @@
#include "pci.h"
#include "oltr.h"
#include "opt_inet.h"
#include "bpf.h"
#if (NOLTR + NPCI) > 0
@ -90,9 +89,7 @@ char *AdapterName[] = {
#include <net/iso88025.h>
#include <net/if_media.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#if NPNP > 0
#include <i386/isa/pnp.h>
@ -632,9 +629,7 @@ oltr_attach_common(sc)
if_attach(ifp);
iso88025_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_IEEE802, sizeof(struct iso88025_header));
#endif
printf("oltr%d: Adapter modes - ", sc->unit);
if (sc->config->mode & TRLLD_MODE_16M) printf("TRLLD_MODE_16M ");
@ -949,10 +944,8 @@ oltr_start(ifp)
goto bad;
}
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m0);
#endif
bad:
@ -1351,10 +1344,8 @@ DriverReceiveFrameCompleted(DriverHandle, ByteCount, FragmentCount, FragmentHand
}
ifp->if_ipackets++;
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m0);
#endif
if (ifp->if_flags & IFF_PROMISC)
if (bcmp(th->iso88025_dhost, etherbroadcastaddr, sizeof(th->iso88025_dhost)) != 0) {

View File

@ -49,7 +49,6 @@
*/
#include "ar.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -61,9 +60,7 @@
#include <net/if.h>
#include <net/if_sppp.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -357,9 +354,7 @@ arattach(struct isa_device *id)
sppp_attach((struct ifnet *)&sc->ifsppp);
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif
}
ARC_SET_OFF(hc->iobase);
@ -537,10 +532,8 @@ arstart(struct ifnet *ifp)
txdata += AR_BUF_SIZ;
i++;
#if NBPF > 0
if(ifp->if_bpf)
bpf_mtap(ifp, mtx);
#endif
m_freem(mtx);
++sc->ifsppp.pp_if.if_opackets;
@ -1299,10 +1292,8 @@ ar_get_packets(struct ar_softc *sc)
}
}
ar_copy_rxbuf(m, sc, len);
#if NBPF > 0
if(sc->ifsppp.pp_if.if_bpf)
bpf_mtap(&sc->ifsppp.pp_if, m);
#endif
sppp_input(&sc->ifsppp.pp_if, m);
sc->ifsppp.pp_if.if_ipackets++;

View File

@ -49,7 +49,6 @@
*/
#include "ar.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -61,9 +60,7 @@
#include <net/if.h>
#include <net/if_sppp.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -357,9 +354,7 @@ arattach(struct isa_device *id)
sppp_attach((struct ifnet *)&sc->ifsppp);
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif
}
ARC_SET_OFF(hc->iobase);
@ -537,10 +532,8 @@ arstart(struct ifnet *ifp)
txdata += AR_BUF_SIZ;
i++;
#if NBPF > 0
if(ifp->if_bpf)
bpf_mtap(ifp, mtx);
#endif
m_freem(mtx);
++sc->ifsppp.pp_if.if_opackets;
@ -1299,10 +1292,8 @@ ar_get_packets(struct ar_softc *sc)
}
}
ar_copy_rxbuf(m, sc, len);
#if NBPF > 0
if(sc->ifsppp.pp_if.if_bpf)
bpf_mtap(&sc->ifsppp.pp_if, m);
#endif
sppp_input(&sc->ifsppp.pp_if, m);
sc->ifsppp.pp_if.if_ipackets++;

View File

@ -35,7 +35,6 @@
/* #define CS_DEBUG */
#include "cs.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -52,9 +51,7 @@
#include <net/if_media.h>
#include <net/ethernet.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -621,9 +618,7 @@ cs_attach(struct cs_softc *sc, int unit, int flags)
printf(CS_NAME"%d: ethernet address %6D\n",
ifp->if_unit, sc->arpcom.ac_enaddr, ":");
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof (struct ether_header));
#endif
return 1;
}
@ -778,10 +773,8 @@ cs_get_packet(struct cs_softc *sc)
eh = mtod(m, struct ether_header *);
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m);
#endif
#ifdef CS_DEBUG
for (i=0;i<length;i++)
@ -951,11 +944,9 @@ cs_start(struct ifnet *ifp)
cs_write_mbufs(sc, m);
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, m);
}
#endif
m_freem(m);
}

View File

@ -60,10 +60,7 @@
#include <net/netisr.h>
#endif
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#ifdef INET
#include <netinet/in.h>
@ -3473,14 +3470,12 @@ tulip_rx_intr(
#endif /* TULIP_BUS_DMA */
eh = *mtod(ms, struct ether_header *);
#if NBPF > 0
if (sc->tulip_if.if_bpf != NULL) {
if (me == ms)
bpf_tap(&sc->tulip_if, mtod(ms, caddr_t), total_len);
else
bpf_mtap(&sc->tulip_if, ms);
}
#endif
sc->tulip_flags |= TULIP_RXACT;
#ifdef BRIDGE /* see code in if_ed.c */
@ -3737,10 +3732,8 @@ tulip_tx_intr(
TULIP_TXMAP_POSTSYNC(sc, map);
sc->tulip_txmaps[sc->tulip_txmaps_free++] = map;
#endif /* TULIP_BUS_DMA */
#if NBPF > 0
if (sc->tulip_if.if_bpf != NULL)
bpf_mtap(&sc->tulip_if, m);
#endif
m_freem(m);
#if defined(TULIP_DEBUG)
} else {
@ -4901,9 +4894,7 @@ tulip_attach(
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ether_ifattach(&(sc)->tulip_if);
#if NBPF > 0
bpfattach(&sc->tulip_if, DLT_EN10MB, sizeof(struct ether_header));
#endif
}
#if defined(TULIP_BUS_DMA)

View File

@ -42,7 +42,6 @@
#include <i386/isa/if_ed.c> /* PCCARD version */
#else
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -66,9 +65,7 @@
#include <net/if_dl.h>
#include <net/if_mib.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include "opt_bdg.h"
#ifdef BRIDGE
#include <net/bridge.h>
@ -1858,9 +1855,7 @@ ed_attach(sc, unit, flags)
/*
* If BPF is in the kernel, call the attach for it
*/
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
return (0);
}
@ -2337,11 +2332,9 @@ ed_start(ifp)
/*
* Tap off here if there is a bpf listener.
*/
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, m0);
}
#endif
m_freem(m0);
@ -2773,13 +2766,10 @@ ed_ioctl(ifp, command, data)
}
}
#if NBPF > 0
/*
* Promiscuous flag may have changed, so reprogram the RCR.
*/
ed_setrcr(sc);
#endif
/*
* An unfortunate hack to provide the (required) software
@ -2904,13 +2894,11 @@ ed_get_packet(sc, buf, len, multicast)
struct ifnet *ifp ;
int need_more = 1 ; /* in case not bpf */
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf) {
need_more = 0 ;
ed_ring_copy(sc, buf, (char *)eh, len);
bpf_mtap(&sc->arpcom.ac_if, m);
} else
#endif
ed_ring_copy(sc, buf, (char *)eh, 14);
ifp = bridge_in(m);
if (ifp == BDG_DROP) {
@ -2935,15 +2923,12 @@ ed_get_packet(sc, buf, len, multicast)
*/
ed_ring_copy(sc, buf, (char *)eh, len);
#if NBPF > 0
/*
* 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);
#endif
/*
* If we are in promiscuous mode, we have to check whether
* this packet is really for us.

View File

@ -59,7 +59,6 @@
#include "ep.h"
#if NEP > 0
#include "bpf.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -82,9 +81,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#if defined(__FreeBSD__)
#include <machine/clock.h>
@ -686,11 +683,9 @@ ep_attach(sc)
ep_fset(F_RX_FIRST);
sc->top = sc->mcur = 0;
#if NBPF > 0
if (!attached) {
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
}
#endif
return 0;
}
@ -923,11 +918,9 @@ epstart(ifp)
while (pad--)
outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, top);
}
#endif
ifp->if_timer = 2;
ifp->if_opackets++;
@ -1189,7 +1182,6 @@ epread(sc)
top->m_pkthdr.rcvif = &sc->arpcom.ac_if;
top->m_pkthdr.len = sc->cur_len;
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, top);
@ -1218,7 +1210,6 @@ epread(sc)
return;
}
}
#endif
eh = mtod(top, struct ether_header *);
m_adj(top, sizeof(struct ether_header));

View File

@ -37,7 +37,6 @@
#include "ex.h"
#if NEX > 0
#include "bpf.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -54,9 +53,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -283,9 +280,7 @@ int ex_attach(struct isa_device *dev)
/*
* If BPF is in the kernel, call the attach for it
*/
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
DODEBUG(Start_End, printf("ex_attach%d: finish\n", unit););
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
return(1);
@ -509,10 +504,8 @@ void ex_start(struct ifnet *ifp)
sc->tx_last = dest;
sc->tx_tail = next;
#if NBPF > 0
if (ifp->if_bpf != NULL)
bpf_mtap(ifp, opkt);
#endif
ifp->if_timer = 2;
ifp->if_opackets++;
m_freem(opkt);
@ -716,7 +709,6 @@ void ex_rx_intr(int unit)
} /* QQQ */
}
#endif
#if NBPF > 0
if (ifp->if_bpf != NULL) {
bpf_mtap(ifp, ipkt);
@ -733,7 +725,6 @@ void ex_rx_intr(int unit)
goto rx_another;
}
}
#endif
m_adj(ipkt, sizeof(struct ether_header));
ether_input(ifp, eh, ipkt);
ifp->if_ipackets++;

View File

@ -70,7 +70,6 @@
*/
#include "fe.h"
#include "bpf.h"
#include "opt_fe.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -91,9 +90,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#ifdef BRIDGE
#include <net/bridge.h>
@ -2773,10 +2770,8 @@ fe_attach ( struct isa_device * dev )
sc->sc_unit);
}
#if NBPF > 0
/* If BPF is in the kernel, call the attach for it. */
bpfattach(&sc->sc_if, DLT_EN10MB, sizeof(struct ether_header));
#endif
return 1;
}
@ -3142,12 +3137,10 @@ fe_start ( struct ifnet *ifp )
* and only if it is in "receive everything"
* mode.)
*/
#if NBPF > 0
if ( sc->sc_if.if_bpf
&& !( sc->sc_if.if_flags & IFF_PROMISC ) ) {
bpf_mtap( &sc->sc_if, m );
}
#endif
m_freem( m );
}
@ -3774,7 +3767,6 @@ fe_get_packet ( struct fe_softc * sc, u_short len )
#define ETHER_ADDR_IS_MULTICAST(A) (*(char *)(A) & 1)
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface.
* If it is, hand off the raw packet to bpf.
@ -3782,7 +3774,6 @@ fe_get_packet ( struct fe_softc * sc, u_short len )
if ( sc->sc_if.if_bpf ) {
bpf_mtap( &sc->sc_if, m );
}
#endif
#ifdef BRIDGE
if (do_bridge) {

View File

@ -34,8 +34,6 @@
* Intel EtherExpress Pro/100B PCI Fast Ethernet driver
*/
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
@ -52,9 +50,7 @@
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
#if defined(__NetBSD__)
@ -419,10 +415,8 @@ fxp_attach(parent, self, aux)
*/
ifp->if_snd.ifq_maxlen = FXP_NTXCB - 1;
ether_ifattach(ifp, enaddr);
#if NBPF > 0
bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB,
sizeof(struct ether_header));
#endif
/*
* Add shutdown hook so that DMA is disabled prior to reboot. Not
@ -603,9 +597,7 @@ fxp_attach(device_t dev)
*/
ifp->if_snd.ifq_maxlen = FXP_NTXCB - 1;
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
splx(s);
return 0;
@ -993,13 +985,11 @@ fxp_start(ifp)
sc->tx_queued++;
#if NBPF > 0
/*
* Pass packet to bpf if there is a listener.
*/
if (ifp->if_bpf)
bpf_mtap(FXP_BPFTAP_ARG(ifp), mb_head);
#endif
}
/*
@ -1102,12 +1092,10 @@ fxp_intr(arg)
m->m_pkthdr.len = m->m_len =
total_len ;
eh = mtod(m, struct ether_header *);
#if NBPF > 0
if (ifp->if_bpf)
bpf_tap(FXP_BPFTAP_ARG(ifp),
mtod(m, caddr_t),
total_len);
#endif /* NBPF > 0 */
#ifdef BRIDGE
if (do_bridge) {
struct ifnet *bdg_ifp ;

View File

@ -130,8 +130,6 @@ iomem and and with 0xffff.
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include "bpf.h"
#include <machine/clock.h>
#include <machine/md_var.h>
@ -143,9 +141,7 @@ iomem and and with 0xffff.
#include <i386/isa/if_iee16.h>
#include <i386/isa/elink.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#ifdef DEBUG
#define IED_RINT 0x01
@ -836,9 +832,7 @@ ieattach(struct isa_device *dvp)
EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
ie, SHUTDOWN_PRI_DEFAULT);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
if_attach(ifp);
ether_ifattach(ifp);
@ -1095,10 +1089,8 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* Receiving all multicasts, but no unicasts except those
* destined for us.
*/
#if NBPF > 0
/* BPF gets this packet if anybody cares */
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
if (eh->ether_dhost[0] & 1) {
return (1);
}
@ -1111,17 +1103,13 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* Receiving all packets. These need to be passed on to
* BPF.
*/
#if NBPF > 0
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
/* If for us, accept and hand up to BPF */
if (ether_equal(eh->ether_dhost, ie->arpcom.ac_enaddr))
return (1);
#if NBPF > 0
if (*to_bpf)
*to_bpf = 2; /* we don't need to see it */
#endif
/*
* Not a multicast, so BPF wants to see it but we don't.
@ -1136,10 +1124,8 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
for (i = 0; i < ie->mcast_count; i++) {
if (ether_equal(eh->ether_dhost,
(u_char *)&ie->mcast_addrs[i])) {
#if NBPF > 0
if (*to_bpf)
*to_bpf = 1;
#endif
return (1);
}
}
@ -1150,9 +1136,7 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* Acting as a multicast router, and BPF running at the same
* time. Whew! (Hope this is a fast machine...)
*/
#if NBPF > 0
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
/* We want to see multicasts. */
if (eh->ether_dhost[0] & 1)
return (1);
@ -1162,10 +1146,8 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
return (1);
/* Anything else goes to BPF but nothing else. */
#if NBPF > 0
if (*to_bpf)
*to_bpf = 2;
#endif
return (1);
default:
@ -1177,9 +1159,7 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* for the multicast filter), but it will do in this case,
* and we want to get out of here as quickly as possible.
*/
#if NBPF > 0
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
return (1);
}
return (0);
@ -1414,11 +1394,8 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
struct mbuf *m = 0;
struct ether_header eh;
#if NBPF > 0
int bpf_gets_it = 0;
#endif
bcopy((v_caddr_t) (ie->rframes[num]), &rfd,
sizeof(struct ie_recv_frame_desc));
@ -1433,11 +1410,7 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
ie->rfhead = (ie->rfhead + 1) % ie->nframes;
if (rfd.ie_fd_status & IE_FD_OK) {
#if NBPF > 0
if (ieget(unit, ie, &m, &eh, &bpf_gets_it)) {
#else
if (ieget(unit, ie, &m, &eh, (int *)0)) {
#endif
ie->arpcom.ac_if.if_ierrors++; /* this counts as an
* error */
return;
@ -1460,7 +1433,6 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
m_freem(last_not_for_us);
last_not_for_us = 0;
}
#if NBPF > 0
/*
* Check for a BPF filter; if so, hand it up. Note that we have to
* stick an extra mbuf up front, because bpf_mtap expects to have
@ -1488,7 +1460,6 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
last_not_for_us = m;
return;
}
#endif /* NBPF > 0 */
/*
* In here there used to be code to check destination addresses upon
* receipt of a packet. We have deleted that code, and replaced it
@ -1572,7 +1543,6 @@ iestart(struct ifnet *ifp)
m_freem(m0);
len = max(len, ETHER_MIN_LEN);
#if NBPF > 0
/*
* See if bpf is listening on this interface, let it see the
* packet before we commit it to the wire.
@ -1580,7 +1550,6 @@ iestart(struct ifnet *ifp)
if (ie->arpcom.ac_if.if_bpf)
bpf_tap(&ie->arpcom.ac_if,
(void *)ie->xmit_cbuffs[ie->xmit_count], len);
#endif
ie->xmit_buffs[ie->xmit_count]->ie_xmit_flags =
IE_XMIT_LAST|len;

View File

@ -59,11 +59,7 @@
#include <netinet/ip.h>
#include <netinet/if_ether.h>
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
@ -151,9 +147,7 @@ icattach(device_t dev)
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_NULL, ICHDRLEN);
#endif
return (0);
}
@ -322,10 +316,8 @@ icintr (device_t dev, int event, char *ptr)
sc->ic_if.if_ipackets ++;
sc->ic_if.if_ibytes += len;
#if NBPF > 0
if (sc->ic_if.if_bpf)
bpf_tap(&sc->ic_if, sc->ic_ifbuf, len + ICHDRLEN);
#endif
top = m_devget(sc->ic_ifbuf + ICHDRLEN, len, 0, &sc->ic_if, 0);
@ -417,7 +409,6 @@ icoutput(struct ifnet *ifp, struct mbuf *m,
} while ((mm = mm->m_next));
#if NBPF > 0
if (ifp->if_bpf) {
struct mbuf m0, *n = m;
@ -435,7 +426,6 @@ icoutput(struct ifnet *ifp, struct mbuf *m,
bpf_mtap(ifp, n);
}
#endif
sc->ic_sending = 1;

View File

@ -64,7 +64,6 @@
#include "lnc.h"
#if NLNC > 0
#include "bpf.h"
#include "opt_inet.h"
/* Some defines that should really be in generic locations */
@ -88,9 +87,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include "opt_bdg.h"
#ifdef BRIDGE
@ -614,10 +611,8 @@ lnc_rint(struct lnc_softc *sc)
eh = (struct ether_header *) head->m_data;
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf)
bpf_mtap(&sc->arpcom.ac_if, head);
#endif
#ifdef BRIDGE
if (do_bridge) {
struct ifnet *bdg_ifp ;
@ -1299,9 +1294,7 @@ lnc_attach_sc(struct lnc_softc *sc, int unit)
printf("%s", ic_ident[sc->nic.ic]);
printf(" address %6D\n", sc->arpcom.ac_enaddr, ":");
#if NBPF > 0
bpfattach(&sc->arpcom.ac_if, DLT_EN10MB, sizeof(struct ether_header));
#endif
return (1);
}
@ -1824,10 +1817,8 @@ lnc_start(struct ifnet *ifp)
ifp->if_timer = 2;
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf)
bpf_mtap(&sc->arpcom.ac_if, head);
#endif
if (sc->nic.mem_mode != DMA_MBUF)
m_freem(head);

View File

@ -39,11 +39,7 @@
* Initialize multicast address hashing registers to accept
* all multicasts (only used when in promiscuous mode)
*/
#if NBPF > 0
#define MULTI_INIT_ADDR 0xff
#else
#define MULTI_INIT_ADDR 0
#endif
#define NORMAL 0

View File

@ -106,7 +106,6 @@
#include "xe.h"
#include "card.h"
#include "apm.h"
#include "bpf.h"
#if NXE > 0
@ -131,9 +130,7 @@
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_mib.h>
#if NBPF > 0
#include <net/bpf.h>
#endif /* NBPF > 0 */
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
@ -808,13 +805,11 @@ xe_attach (struct isa_device *dev) {
if_attach(scp->ifp);
ether_ifattach(scp->ifp);
#if NBPF > 0
/* If BPF is in the kernel, call the attach for it */
#if XE_DEBUG > 1
printf("xe%d: BPF listener attached\n", scp->unit);
#endif
bpfattach(scp->ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
/* Done */
return 1;
@ -944,7 +939,6 @@ xe_start(struct ifnet *ifp) {
return;
}
#if NBPF > 0
/* Tap off here if there is a bpf listener */
if (ifp->if_bpf) {
#if XE_DEBUG > 1
@ -952,7 +946,6 @@ xe_start(struct ifnet *ifp) {
#endif
bpf_mtap(ifp, mbp);
}
#endif /* NBPF > 0 */
ifp->if_timer = 5; /* In case we don't hear from the card again */
scp->tx_queued++;
@ -1266,7 +1259,6 @@ xe_card_intr(struct pccard_devinfo *devi) {
else
insw(scp->dev->id_iobase+XE_EDP, ehp, len >> 1);
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface. If so, hand
* off the raw packet to bpf.
@ -1289,7 +1281,6 @@ xe_card_intr(struct pccard_devinfo *devi) {
mbp = NULL;
}
}
#endif /* NBPF > 0 */
if (mbp != NULL) {
mbp->m_pkthdr.len = mbp->m_len = len - ETHER_HDR_LEN;

View File

@ -45,10 +45,7 @@
#include <net/if.h>
#include <net/if_dl.h>
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#if defined(__FreeBSD__)
#ifdef INET
@ -186,14 +183,12 @@ pdq_os_receive_pdu(
struct fddi_header *fh = mtod(m, struct fddi_header *);
sc->sc_if.if_ipackets++;
#if NBPF > 0
if (sc->sc_bpf != NULL)
PDQ_BPF_MTAP(sc, m);
if ((fh->fddi_fc & (FDDIFC_L|FDDIFC_F)) != FDDIFC_LLC_ASYNC) {
m_freem(m);
return;
}
#endif
m->m_data += sizeof(struct fddi_header);
m->m_len -= sizeof(struct fddi_header);
@ -222,10 +217,8 @@ pdq_os_transmit_done(
struct mbuf *m)
{
pdq_softc_t *sc = (pdq_softc_t *) pdq->pdq_os_ctx;
#if NBPF > 0
if (sc->sc_bpf != NULL)
PDQ_BPF_MTAP(sc, m);
#endif
m_freem(m);
sc->sc_if.if_opackets++;
}
@ -384,7 +377,5 @@ pdq_ifattach(
if_attach(ifp);
fddi_ifattach(ifp);
#if NBPF > 0
PDQ_BPFATTACH(sc, DLT_FDDI, sizeof(struct fddi_header));
#endif
}

View File

@ -93,10 +93,7 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <dev/ppbus/ppbconf.h>
@ -256,9 +253,7 @@ lpattach (struct ppb_device *dev)
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
#endif
return (1);
}
@ -446,7 +441,6 @@ clpinbyte (int spin, struct ppb_device *dev)
return (ctrecvl[cl] | ctrecvh[c]);
}
#if NBPF > 0
static void
lptap(struct ifnet *ifp, struct mbuf *m)
{
@ -464,7 +458,6 @@ lptap(struct ifnet *ifp, struct mbuf *m)
m0.m_data = (char *)&af;
bpf_mtap(ifp, &m0);
}
#endif
static void
lpintr (int unit)
@ -525,10 +518,8 @@ lpintr (int unit)
sc->sc_if.if_ibytes += len;
top = m_devget(sc->sc_ifbuf + CLPIPHDRLEN, len, 0, &sc->sc_if, 0);
if (top) {
#if NBPF > 0
if (sc->sc_if.if_bpf)
lptap(&sc->sc_if, top);
#endif
IF_ENQUEUE(&ipintrq, top);
schednetisr(NETISR_IP);
}
@ -578,10 +569,8 @@ lpintr (int unit)
sc->sc_if.if_ibytes += len;
top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, &sc->sc_if, 0);
if (top) {
#if NBPF > 0
if (sc->sc_if.if_bpf)
lptap(&sc->sc_if, top);
#endif
IF_ENQUEUE(&ipintrq, top);
schednetisr(NETISR_IP);
}
@ -715,10 +704,8 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
} else {
ifp->if_opackets++;
ifp->if_obytes += m->m_pkthdr.len;
#if NBPF > 0
if (ifp->if_bpf)
lptap(ifp, m);
#endif
}
m_freem(m);
@ -762,10 +749,8 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
} else {
ifp->if_opackets++;
ifp->if_obytes += m->m_pkthdr.len;
#if NBPF > 0
if (ifp->if_bpf)
lptap(ifp, m);
#endif
}
m_freem(m);

View File

@ -53,7 +53,6 @@
#else
#define NFR 0
#endif
#include "bpf.h"
#include "sppp.h"
#if NSPPP <= 0
@ -71,9 +70,7 @@
#include <net/if.h>
#include <net/if_sppp.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/md_var.h>
@ -848,9 +845,7 @@ srattach(struct sr_hardc *hc)
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif
}
if (hc->mempages)
@ -1119,10 +1114,8 @@ srstart(struct ifnet *ifp)
sc->unit, mtx, len);
#endif
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, mtx);
#endif
/*
* We can perform a straight copy because the tranmit
@ -2462,10 +2455,8 @@ sr_get_packets(struct sr_softc *sc)
*/
sr_copy_rxbuf(m, sc, len); /* copy from DPRAM */
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m);
#endif
#if BUGGY > 3
{

View File

@ -53,7 +53,6 @@
#else
#define NFR 0
#endif
#include "bpf.h"
#include "sppp.h"
#if NSPPP <= 0
@ -71,9 +70,7 @@
#include <net/if.h>
#include <net/if_sppp.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/md_var.h>
@ -848,9 +845,7 @@ srattach(struct sr_hardc *hc)
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif
}
if (hc->mempages)
@ -1119,10 +1114,8 @@ srstart(struct ifnet *ifp)
sc->unit, mtx, len);
#endif
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, mtx);
#endif
/*
* We can perform a straight copy because the tranmit
@ -2462,10 +2455,8 @@ sr_get_packets(struct sr_softc *sc)
*/
sr_copy_rxbuf(m, sc, len); /* copy from DPRAM */
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m);
#endif
#if BUGGY > 3
{

View File

@ -62,7 +62,6 @@
#define NVX 4
#endif
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -76,9 +75,7 @@
#include <net/ethernet.h>
#include <net/if_arp.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -216,9 +213,7 @@ vxattach(sc)
if_attach(ifp);
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
sc->tx_start_thresh = 20; /* probably a good starting point. */
@ -496,11 +491,9 @@ vxstart(ifp)
outw(BASE + VX_COMMAND, SET_TX_START_THRESH |
((len / 4 + sc->tx_start_thresh) >> 2));
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf) {
bpf_mtap(&sc->arpcom.ac_if, m0);
}
#endif
/*
* Do the output at splhigh() so that an interrupt from another device
@ -745,7 +738,6 @@ vxread(sc)
/* We assume the header fit entirely in one mbuf. */
eh = mtod(m, struct ether_header *);
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface.
* If so, hand off the raw packet to BPF.
@ -753,7 +745,6 @@ vxread(sc)
if (sc->arpcom.ac_if.if_bpf) {
bpf_mtap(&sc->arpcom.ac_if, m);
}
#endif
/*
* XXX: Some cards seem to be in promiscous mode all the time.

View File

@ -190,7 +190,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "wl.h"
#include "opt_wavelan.h"
#include "bpf.h"
#include "opt_inet.h"
#include <sys/param.h>
@ -215,9 +214,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <netinet/if_ether.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -511,9 +508,7 @@ wlattach(struct isa_device *id)
if_attach(ifp);
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
bcopy(&sc->wl_addr[0], sc->wl_ac.ac_enaddr, WAVELAN_ADDR_SIZE);
printf("%s%d: address %6D, NWID 0x%02x%02x", ifp->if_name, ifp->if_unit,
@ -896,12 +891,10 @@ wlstart(struct ifnet *ifp)
ifp = &(sc->wl_if);
IF_DEQUEUE(&ifp->if_snd, m);
if (m != (struct mbuf *)0) {
#if NBPF > 0
/* let BPF see it before we commit it */
if (ifp->if_bpf) {
bpf_mtap(ifp, m);
}
#endif
sc->tbusy++;
/* set the watchdog timer so that if the board
* fails to interrupt we will restart
@ -1081,7 +1074,6 @@ wlread(int unit, u_short fd_p)
m->m_pkthdr.len = clen;
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface. If so, hand off
* the raw packet to bpf.
@ -1099,7 +1091,6 @@ wlread(int unit, u_short fd_p)
bpf_mtap(ifp, &m0);
}
#endif
/*
* 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

View File

@ -106,7 +106,6 @@
#include "xe.h"
#include "card.h"
#include "apm.h"
#include "bpf.h"
#if NXE > 0
@ -131,9 +130,7 @@
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_mib.h>
#if NBPF > 0
#include <net/bpf.h>
#endif /* NBPF > 0 */
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
@ -808,13 +805,11 @@ xe_attach (struct isa_device *dev) {
if_attach(scp->ifp);
ether_ifattach(scp->ifp);
#if NBPF > 0
/* If BPF is in the kernel, call the attach for it */
#if XE_DEBUG > 1
printf("xe%d: BPF listener attached\n", scp->unit);
#endif
bpfattach(scp->ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
/* Done */
return 1;
@ -944,7 +939,6 @@ xe_start(struct ifnet *ifp) {
return;
}
#if NBPF > 0
/* Tap off here if there is a bpf listener */
if (ifp->if_bpf) {
#if XE_DEBUG > 1
@ -952,7 +946,6 @@ xe_start(struct ifnet *ifp) {
#endif
bpf_mtap(ifp, mbp);
}
#endif /* NBPF > 0 */
ifp->if_timer = 5; /* In case we don't hear from the card again */
scp->tx_queued++;
@ -1266,7 +1259,6 @@ xe_card_intr(struct pccard_devinfo *devi) {
else
insw(scp->dev->id_iobase+XE_EDP, ehp, len >> 1);
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface. If so, hand
* off the raw packet to bpf.
@ -1289,7 +1281,6 @@ xe_card_intr(struct pccard_devinfo *devi) {
mbp = NULL;
}
}
#endif /* NBPF > 0 */
if (mbp != NULL) {
mbp->m_pkthdr.len = mbp->m_len = len - ETHER_HDR_LEN;

View File

@ -49,7 +49,6 @@
*/
#include "ar.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -61,9 +60,7 @@
#include <net/if.h>
#include <net/if_sppp.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -357,9 +354,7 @@ arattach(struct isa_device *id)
sppp_attach((struct ifnet *)&sc->ifsppp);
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif
}
ARC_SET_OFF(hc->iobase);
@ -537,10 +532,8 @@ arstart(struct ifnet *ifp)
txdata += AR_BUF_SIZ;
i++;
#if NBPF > 0
if(ifp->if_bpf)
bpf_mtap(ifp, mtx);
#endif
m_freem(mtx);
++sc->ifsppp.pp_if.if_opackets;
@ -1299,10 +1292,8 @@ ar_get_packets(struct ar_softc *sc)
}
}
ar_copy_rxbuf(m, sc, len);
#if NBPF > 0
if(sc->ifsppp.pp_if.if_bpf)
bpf_mtap(&sc->ifsppp.pp_if, m);
#endif
sppp_input(&sc->ifsppp.pp_if, m);
sc->ifsppp.pp_if.if_ipackets++;

View File

@ -35,7 +35,6 @@
/* #define CS_DEBUG */
#include "cs.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -52,9 +51,7 @@
#include <net/if_media.h>
#include <net/ethernet.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -621,9 +618,7 @@ cs_attach(struct cs_softc *sc, int unit, int flags)
printf(CS_NAME"%d: ethernet address %6D\n",
ifp->if_unit, sc->arpcom.ac_enaddr, ":");
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof (struct ether_header));
#endif
return 1;
}
@ -778,10 +773,8 @@ cs_get_packet(struct cs_softc *sc)
eh = mtod(m, struct ether_header *);
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m);
#endif
#ifdef CS_DEBUG
for (i=0;i<length;i++)
@ -951,11 +944,9 @@ cs_start(struct ifnet *ifp)
cs_write_mbufs(sc, m);
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, m);
}
#endif
m_freem(m);
}

View File

@ -15,11 +15,13 @@
* all derivative works or modified versions.
*
* Version 1.9, Wed Oct 4 18:58:15 MSK 1995
*
* $FreeBSD$
*
*/
#undef DEBUG
#include "cx.h"
#include "bpf.h"
#include "sppp.h"
#if NSPPP <= 0
#error The device 'cx' requires sppp.
@ -36,9 +38,7 @@
#include <net/if.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <i386/isa/isa_device.h>
#define watchdog_func_t void(*)(struct ifnet *)
@ -275,10 +275,8 @@ cxattach (struct isa_device *id)
sppp_attach (c->ifp);
if_attach (c->ifp);
sp = (struct sppp*) c->ifp;
#if NBPF > 0
/* If BPF is in the kernel, call the attach for it. */
bpfattach (c->ifp, DLT_PPP, PPP_HEADER_LEN);
#endif
}
}
@ -472,10 +470,8 @@ cxput (cx_chan_t *c, char b)
return;
}
m_copydata (m, 0, len, buf);
#if NBPF > 0
if (c->ifp->if_bpf)
bpf_mtap (c->ifp, m);
#endif
m_freem (m);
/* Start transmitter. */
@ -796,14 +792,12 @@ cxinput (cx_chan_t *c, void *buf, unsigned len)
printmbuf (m);
#endif
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface.
* If so, hand off the raw packet to bpf.
*/
if (c->ifp->if_bpf)
bpf_tap (c->ifp, buf, len);
#endif
/* Count the received bytes to the subchannel, not the master. */
c->master->if_ibytes -= len + 3;

View File

@ -38,7 +38,6 @@
*/
#include "ed.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -62,9 +61,7 @@
#include <net/if_dl.h>
#include <net/if_mib.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include "opt_bdg.h"
#ifdef BRIDGE
#include <net/bridge.h>
@ -1715,9 +1712,7 @@ ed_attach(sc, unit, flags)
/*
* If BPF is in the kernel, call the attach for it
*/
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
return 1;
}
@ -2173,11 +2168,9 @@ ed_start(ifp)
/*
* Tap off here if there is a bpf listener.
*/
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, m0);
}
#endif
m_freem(m0);
@ -2615,13 +2608,10 @@ ed_ioctl(ifp, command, data)
}
}
#if NBPF > 0
/*
* Promiscuous flag may have changed, so reprogram the RCR.
*/
ed_setrcr(sc);
#endif
/*
* An unfortunate hack to provide the (required) software
@ -2746,13 +2736,11 @@ ed_get_packet(sc, buf, len, multicast)
struct ifnet *ifp ;
int need_more = 1 ; /* in case not bpf */
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf) {
need_more = 0 ;
ed_ring_copy(sc, buf, (char *)eh, len);
bpf_mtap(&sc->arpcom.ac_if, m);
} else
#endif
ed_ring_copy(sc, buf, (char *)eh, 14);
ifp = bridge_in(m);
if (ifp == BDG_DROP) {
@ -2777,15 +2765,12 @@ ed_get_packet(sc, buf, len, multicast)
*/
ed_ring_copy(sc, buf, (char *)eh, len);
#if NBPF > 0
/*
* 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);
#endif
/*
* If we are in promiscuous mode, we have to check whether
* this packet is really for us.

View File

@ -20,7 +20,6 @@
* - Does not currently support multicasts
*/
#include "el.h"
#include "bpf.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -37,9 +36,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -203,10 +200,8 @@ el_attach(struct isa_device *idev)
sc->arpcom.ac_enaddr, ":");
/* Finally, attach to bpf filter if it is present. */
#if NBPF > 0
dprintf(("Attaching to BPF...\n"));
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
dprintf(("el_attach() finished.\n"));
return(1);
@ -340,10 +335,8 @@ el_start(struct ifnet *ifp)
len = max(len,ETHER_MIN_LEN);
/* Give the packet to the bpf, if any */
#if NBPF > 0
if(sc->arpcom.ac_if.if_bpf)
bpf_tap(&sc->arpcom.ac_if, sc->el_pktbuf, len);
#endif
/* Transfer datagram to board */
dprintf(("el: xfr pkt length=%d...\n",len));
@ -430,7 +423,6 @@ elread(struct el_softc *sc,caddr_t buf,int len)
eh = (struct ether_header *)buf;
#if NBPF > 0
/*
* Check if there's a bpf filter listening on this interface.
* If so, hand off the raw packet to bpf.
@ -453,7 +445,6 @@ elread(struct el_softc *sc,caddr_t buf,int len)
sizeof(eh->ether_dhost)) != 0)
return;
}
#endif
/*
* Pull packet off interface.

View File

@ -59,7 +59,6 @@
#include "ep.h"
#if NEP > 0
#include "bpf.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -82,9 +81,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#if defined(__FreeBSD__)
#include <machine/clock.h>
@ -686,11 +683,9 @@ ep_attach(sc)
ep_fset(F_RX_FIRST);
sc->top = sc->mcur = 0;
#if NBPF > 0
if (!attached) {
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
}
#endif
return 0;
}
@ -923,11 +918,9 @@ epstart(ifp)
while (pad--)
outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, top);
}
#endif
ifp->if_timer = 2;
ifp->if_opackets++;
@ -1189,7 +1182,6 @@ epread(sc)
top->m_pkthdr.rcvif = &sc->arpcom.ac_if;
top->m_pkthdr.len = sc->cur_len;
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, top);
@ -1218,7 +1210,6 @@ epread(sc)
return;
}
}
#endif
eh = mtod(top, struct ether_header *);
m_adj(top, sizeof(struct ether_header));

View File

@ -37,7 +37,6 @@
#include "ex.h"
#if NEX > 0
#include "bpf.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -54,9 +53,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -283,9 +280,7 @@ int ex_attach(struct isa_device *dev)
/*
* If BPF is in the kernel, call the attach for it
*/
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
DODEBUG(Start_End, printf("ex_attach%d: finish\n", unit););
sc->arpcom.ac_if.if_snd.ifq_maxlen = ifqmaxlen;
return(1);
@ -509,10 +504,8 @@ void ex_start(struct ifnet *ifp)
sc->tx_last = dest;
sc->tx_tail = next;
#if NBPF > 0
if (ifp->if_bpf != NULL)
bpf_mtap(ifp, opkt);
#endif
ifp->if_timer = 2;
ifp->if_opackets++;
m_freem(opkt);
@ -716,7 +709,6 @@ void ex_rx_intr(int unit)
} /* QQQ */
}
#endif
#if NBPF > 0
if (ifp->if_bpf != NULL) {
bpf_mtap(ifp, ipkt);
@ -733,7 +725,6 @@ void ex_rx_intr(int unit)
goto rx_another;
}
}
#endif
m_adj(ipkt, sizeof(struct ether_header));
ether_input(ifp, eh, ipkt);
ifp->if_ipackets++;

View File

@ -70,7 +70,6 @@
*/
#include "fe.h"
#include "bpf.h"
#include "opt_fe.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -91,9 +90,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#ifdef BRIDGE
#include <net/bridge.h>
@ -2773,10 +2770,8 @@ fe_attach ( struct isa_device * dev )
sc->sc_unit);
}
#if NBPF > 0
/* If BPF is in the kernel, call the attach for it. */
bpfattach(&sc->sc_if, DLT_EN10MB, sizeof(struct ether_header));
#endif
return 1;
}
@ -3142,12 +3137,10 @@ fe_start ( struct ifnet *ifp )
* and only if it is in "receive everything"
* mode.)
*/
#if NBPF > 0
if ( sc->sc_if.if_bpf
&& !( sc->sc_if.if_flags & IFF_PROMISC ) ) {
bpf_mtap( &sc->sc_if, m );
}
#endif
m_freem( m );
}
@ -3774,7 +3767,6 @@ fe_get_packet ( struct fe_softc * sc, u_short len )
#define ETHER_ADDR_IS_MULTICAST(A) (*(char *)(A) & 1)
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface.
* If it is, hand off the raw packet to bpf.
@ -3782,7 +3774,6 @@ fe_get_packet ( struct fe_softc * sc, u_short len )
if ( sc->sc_if.if_bpf ) {
bpf_mtap( &sc->sc_if, m );
}
#endif
#ifdef BRIDGE
if (do_bridge) {

View File

@ -130,8 +130,6 @@ iomem and and with 0xffff.
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include "bpf.h"
#include <machine/clock.h>
#include <machine/md_var.h>
@ -143,9 +141,7 @@ iomem and and with 0xffff.
#include <i386/isa/if_iee16.h>
#include <i386/isa/elink.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#ifdef DEBUG
#define IED_RINT 0x01
@ -836,9 +832,7 @@ ieattach(struct isa_device *dvp)
EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
ie, SHUTDOWN_PRI_DEFAULT);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
if_attach(ifp);
ether_ifattach(ifp);
@ -1095,10 +1089,8 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* Receiving all multicasts, but no unicasts except those
* destined for us.
*/
#if NBPF > 0
/* BPF gets this packet if anybody cares */
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
if (eh->ether_dhost[0] & 1) {
return (1);
}
@ -1111,17 +1103,13 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* Receiving all packets. These need to be passed on to
* BPF.
*/
#if NBPF > 0
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
/* If for us, accept and hand up to BPF */
if (ether_equal(eh->ether_dhost, ie->arpcom.ac_enaddr))
return (1);
#if NBPF > 0
if (*to_bpf)
*to_bpf = 2; /* we don't need to see it */
#endif
/*
* Not a multicast, so BPF wants to see it but we don't.
@ -1136,10 +1124,8 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
for (i = 0; i < ie->mcast_count; i++) {
if (ether_equal(eh->ether_dhost,
(u_char *)&ie->mcast_addrs[i])) {
#if NBPF > 0
if (*to_bpf)
*to_bpf = 1;
#endif
return (1);
}
}
@ -1150,9 +1136,7 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* Acting as a multicast router, and BPF running at the same
* time. Whew! (Hope this is a fast machine...)
*/
#if NBPF > 0
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
/* We want to see multicasts. */
if (eh->ether_dhost[0] & 1)
return (1);
@ -1162,10 +1146,8 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
return (1);
/* Anything else goes to BPF but nothing else. */
#if NBPF > 0
if (*to_bpf)
*to_bpf = 2;
#endif
return (1);
default:
@ -1177,9 +1159,7 @@ check_eh(struct ie_softc * ie, struct ether_header * eh, int *to_bpf)
* for the multicast filter), but it will do in this case,
* and we want to get out of here as quickly as possible.
*/
#if NBPF > 0
*to_bpf = (ie->arpcom.ac_if.if_bpf != 0);
#endif
return (1);
}
return (0);
@ -1414,11 +1394,8 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
struct mbuf *m = 0;
struct ether_header eh;
#if NBPF > 0
int bpf_gets_it = 0;
#endif
bcopy((v_caddr_t) (ie->rframes[num]), &rfd,
sizeof(struct ie_recv_frame_desc));
@ -1433,11 +1410,7 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
ie->rfhead = (ie->rfhead + 1) % ie->nframes;
if (rfd.ie_fd_status & IE_FD_OK) {
#if NBPF > 0
if (ieget(unit, ie, &m, &eh, &bpf_gets_it)) {
#else
if (ieget(unit, ie, &m, &eh, (int *)0)) {
#endif
ie->arpcom.ac_if.if_ierrors++; /* this counts as an
* error */
return;
@ -1460,7 +1433,6 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
m_freem(last_not_for_us);
last_not_for_us = 0;
}
#if NBPF > 0
/*
* Check for a BPF filter; if so, hand it up. Note that we have to
* stick an extra mbuf up front, because bpf_mtap expects to have
@ -1488,7 +1460,6 @@ ie_readframe(int unit, struct ie_softc *ie, int num/* frame number to read */)
last_not_for_us = m;
return;
}
#endif /* NBPF > 0 */
/*
* In here there used to be code to check destination addresses upon
* receipt of a packet. We have deleted that code, and replaced it
@ -1572,7 +1543,6 @@ iestart(struct ifnet *ifp)
m_freem(m0);
len = max(len, ETHER_MIN_LEN);
#if NBPF > 0
/*
* See if bpf is listening on this interface, let it see the
* packet before we commit it to the wire.
@ -1580,7 +1550,6 @@ iestart(struct ifnet *ifp)
if (ie->arpcom.ac_if.if_bpf)
bpf_tap(&ie->arpcom.ac_if,
(void *)ie->xmit_cbuffs[ie->xmit_count], len);
#endif
ie->xmit_buffs[ie->xmit_count]->ie_xmit_flags =
IE_XMIT_LAST|len;

View File

@ -56,7 +56,6 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include "bpf.h"
#include <machine/clock.h>
@ -66,9 +65,7 @@
#include <vm/vm.h>
#include <vm/pmap.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
/* Forward declarations */
typedef struct le_softc le_softc_t;
@ -359,9 +356,7 @@ le_attach(
ifp->if_addrlen = 6;
ifp->if_hdrlen = 14;
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
if_attach(ifp);
ether_ifattach(ifp);
@ -401,7 +396,6 @@ le_input(
}
MEMCPY(&eh, seg1, sizeof(eh));
#if NBPF > 0
if (sc->le_if.if_bpf != NULL && seg2 == NULL) {
bpf_tap(&sc->le_if, seg1, total_len);
/*
@ -423,7 +417,6 @@ le_input(
}
}
}
#endif
seg1 += sizeof(eh); total_len -= sizeof(eh); len1 -= sizeof(eh);
MGETHDR(m, M_DONTWAIT, MT_DATA);
@ -458,7 +451,6 @@ le_input(
MEMCPY(mtod(m, caddr_t), seg1, len1);
if (seg2 != NULL)
MEMCPY(mtod(m, caddr_t) + len1, seg2, total_len - len1);
#if NBPF > 0
if (sc->le_if.if_bpf != NULL && seg2 != NULL) {
bpf_mtap(&sc->le_if, m);
/*
@ -483,7 +475,6 @@ le_input(
}
}
}
#endif
ether_input(&sc->le_if, &eh, m);
}
@ -1077,10 +1068,8 @@ lemac_start(
LE_OUTB(sc, LEMAC_REG_TQ, tx_pg); /* tell chip to transmit this packet */
#if NBPF > 0
if (sc->le_if.if_bpf)
bpf_mtap(&sc->le_if, m);
#endif
m_freem(m); /* free the mbuf */
}

View File

@ -64,7 +64,6 @@
#include "lnc.h"
#if NLNC > 0
#include "bpf.h"
#include "opt_inet.h"
/* Some defines that should really be in generic locations */
@ -88,9 +87,7 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include "opt_bdg.h"
#ifdef BRIDGE
@ -614,10 +611,8 @@ lnc_rint(struct lnc_softc *sc)
eh = (struct ether_header *) head->m_data;
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf)
bpf_mtap(&sc->arpcom.ac_if, head);
#endif
#ifdef BRIDGE
if (do_bridge) {
struct ifnet *bdg_ifp ;
@ -1299,9 +1294,7 @@ lnc_attach_sc(struct lnc_softc *sc, int unit)
printf("%s", ic_ident[sc->nic.ic]);
printf(" address %6D\n", sc->arpcom.ac_enaddr, ":");
#if NBPF > 0
bpfattach(&sc->arpcom.ac_if, DLT_EN10MB, sizeof(struct ether_header));
#endif
return (1);
}
@ -1824,10 +1817,8 @@ lnc_start(struct ifnet *ifp)
ifp->if_timer = 2;
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf)
bpf_mtap(&sc->arpcom.ac_if, head);
#endif
if (sc->nic.mem_mode != DMA_MBUF)
m_freem(head);

View File

@ -39,11 +39,7 @@
* Initialize multicast address hashing registers to accept
* all multicasts (only used when in promiscuous mode)
*/
#if NBPF > 0
#define MULTI_INIT_ADDR 0xff
#else
#define MULTI_INIT_ADDR 0
#endif
#define NORMAL 0

View File

@ -62,7 +62,6 @@
*/
#include "rdp.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -89,9 +88,7 @@
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -629,9 +626,7 @@ rdp_attach(struct isa_device *isa_dev)
/*
* If BPF is in the kernel, call the attach for it
*/
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
return 1;
}
@ -814,11 +809,9 @@ rdp_start(struct ifnet *ifp)
/*
* Tap off here if there is a bpf listener.
*/
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, m);
}
#endif
m_freem(m);
@ -862,7 +855,6 @@ rdp_ioctl(struct ifnet *ifp, IOCTL_CMD_T command, caddr_t data)
}
}
#if NBPF > 0
/*
* Promiscuous flag may have changed, propagage this
* to the NIC.
@ -872,7 +864,6 @@ rdp_ioctl(struct ifnet *ifp, IOCTL_CMD_T command, caddr_t data)
MkHi((ifp->if_flags & IFF_PROMISC)?
CMR2_AM_ALL: CMR2_AM_PB));
#endif
break;
case SIOCADDMULTI:
@ -1164,8 +1155,6 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len)
outb(sc->baseaddr + lpt_control, Ctrl_SelData);
WrNib(sc, CMR1, CMR1_RDPAC);
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface. If so, hand off
* the raw packet to bpf.
@ -1185,7 +1174,6 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len)
return;
}
}
#endif
/*
* Remove link layer address.

View File

@ -53,7 +53,6 @@
#else
#define NFR 0
#endif
#include "bpf.h"
#include "sppp.h"
#if NSPPP <= 0
@ -71,9 +70,7 @@
#include <net/if.h>
#include <net/if_sppp.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/md_var.h>
@ -848,9 +845,7 @@ srattach(struct sr_hardc *hc)
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN);
#endif
}
if (hc->mempages)
@ -1119,10 +1114,8 @@ srstart(struct ifnet *ifp)
sc->unit, mtx, len);
#endif
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, mtx);
#endif
/*
* We can perform a straight copy because the tranmit
@ -2462,10 +2455,8 @@ sr_get_packets(struct sr_softc *sc)
*/
sr_copy_rxbuf(m, sc, len); /* copy from DPRAM */
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m);
#endif
#if BUGGY > 3
{

View File

@ -190,7 +190,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "wl.h"
#include "opt_wavelan.h"
#include "bpf.h"
#include "opt_inet.h"
#include <sys/param.h>
@ -215,9 +214,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <netinet/if_ether.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
@ -511,9 +508,7 @@ wlattach(struct isa_device *id)
if_attach(ifp);
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
bcopy(&sc->wl_addr[0], sc->wl_ac.ac_enaddr, WAVELAN_ADDR_SIZE);
printf("%s%d: address %6D, NWID 0x%02x%02x", ifp->if_name, ifp->if_unit,
@ -896,12 +891,10 @@ wlstart(struct ifnet *ifp)
ifp = &(sc->wl_if);
IF_DEQUEUE(&ifp->if_snd, m);
if (m != (struct mbuf *)0) {
#if NBPF > 0
/* let BPF see it before we commit it */
if (ifp->if_bpf) {
bpf_mtap(ifp, m);
}
#endif
sc->tbusy++;
/* set the watchdog timer so that if the board
* fails to interrupt we will restart
@ -1081,7 +1074,6 @@ wlread(int unit, u_short fd_p)
m->m_pkthdr.len = clen;
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface. If so, hand off
* the raw packet to bpf.
@ -1099,7 +1091,6 @@ wlread(int unit, u_short fd_p)
bpf_mtap(ifp, &m0);
}
#endif
/*
* 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

View File

@ -64,7 +64,6 @@ static char const zedummy[] = "code to use the includes of card.h and pcic.h";
#include "ze.h"
#if NZE > 0
#include "bpf.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -81,9 +80,7 @@ static char const zedummy[] = "code to use the includes of card.h and pcic.h";
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -639,9 +636,7 @@ ze_attach(isa_dev)
/*
* If BPF is in the kernel, call the attach for it
*/
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
#if NAPM > 0
sc->s_hook.ah_fun = ze_suspend;
@ -860,14 +855,12 @@ ze_init(unit)
for (i = 0; i < ETHER_ADDR_LEN; ++i)
outb(sc->nic_addr + ED_P1_PAR0 + i, sc->arpcom.ac_enaddr[i]);
#if NBPF > 0
/*
* Initialize multicast address hashing registers to accept
* all multicasts (only used when in promiscuous mode)
*/
for (i = 0; i < 8; ++i)
outb(sc->nic_addr + ED_P1_MAR0 + i, 0xff);
#endif
/*
* Set Current Page pointer to next_packet (initialized above)
@ -1031,11 +1024,9 @@ ze_start(ifp)
/*
* If there is BPF support in the configuration, tap off here.
*/
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, m0);
}
#endif
m_freem(m0);
@ -1359,7 +1350,6 @@ ze_ioctl(ifp, command, data)
((ifp->if_flags & IFF_RUNNING) == 0))
ze_init(ifp->if_unit);
}
#if NBPF > 0
if (ifp->if_flags & IFF_PROMISC) {
/*
* Set promiscuous mode on interface.
@ -1378,7 +1368,6 @@ ze_ioctl(ifp, command, data)
*/
outb(sc->nic_addr + ED_P0_RCR, ED_RCR_AB);
}
#endif
break;
default:
@ -1443,7 +1432,6 @@ ze_get_packet(sc, buf, len)
m = ze_ring_to_mbuf(sc, buf, m, len);
if (m == NULL) goto bad;
#if NBPF > 0
/*
* Check if there's a BPF listener on this interface.
* If so, hand off the raw packet to bpf.
@ -1468,7 +1456,6 @@ ze_get_packet(sc, buf, len)
return;
}
}
#endif
/*
* Fix up data start offset in mbuf to point past ether header

View File

@ -114,7 +114,6 @@ static char const zpdummy[] = "code to use the includes of card.h and pcic.h";
#include "zp.h"
#include "bpf.h"
#include "opt_inet.h"
#include "opt_ipx.h"
@ -134,9 +133,7 @@ static char const zpdummy[] = "code to use the includes of card.h and pcic.h";
#include <netinet/in.h>
#include <netinet/if_ether.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -557,9 +554,7 @@ zpattach(isa_dev)
if_attach(ifp);
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
#if NAPM > 0
sc->s_hook.ah_fun = zp_suspend;
sc->s_hook.ah_arg = (void *) isa_dev;
@ -750,11 +745,9 @@ zpstart(ifp)
while (pad--)
outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf) {
bpf_mtap(&sc->arpcom.ac_if, top);
}
#endif
m_freem(top);
++sc->arpcom.ac_if.if_opackets;
@ -964,7 +957,6 @@ zpread(sc)
outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
++sc->arpcom.ac_if.if_ipackets;
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf) {
bpf_mtap(&sc->arpcom.ac_if, top);
@ -981,7 +973,6 @@ zpread(sc)
return;
}
}
#endif
m_adj(top, sizeof(struct ether_header));
ether_input(&sc->arpcom.ac_if, eh, top);
return;

View File

@ -51,7 +51,6 @@
#include <net/route.h>
#include <net/bpf.h>
#include "bpf.h"
#include "opt_inet.h"
#ifdef TINY_DSMTU
@ -85,9 +84,7 @@ discattach(dummy)
ifp->if_hdrlen = 0;
ifp->if_addrlen = 0;
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_NULL, sizeof(u_int));
#endif
}
static int
@ -99,7 +96,6 @@ discoutput(ifp, m, dst, rt)
{
if ((m->m_flags & M_PKTHDR) == 0)
panic("discoutput no HDR");
#if NBPF > 0
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
dst->sa_family = *(mtod(m, int *));
@ -125,7 +121,6 @@ discoutput(ifp, m, dst, rt)
bpf_mtap(&discif, &m0);
}
#endif
m->m_pkthdr.rcvif = ifp;
ifp->if_opackets++;

View File

@ -105,8 +105,6 @@ extern u_char aarp_org_code[ 3 ];
extern struct ifqueue pkintrq;
#endif
#include "bpf.h"
#define senderr(e) { error = (e); goto bad;}
/*
@ -309,7 +307,6 @@ fddi_output(ifp, m0, dst, rt0)
break;
}
#if NBPF > 0
case AF_IMPLINK:
{
fh = mtod(m, struct fddi_header *);
@ -343,7 +340,6 @@ fddi_output(ifp, m0, dst, rt0)
m->m_flags |= (M_BCAST|M_MCAST);
goto queue_it;
}
#endif
default:
printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit,
dst->sa_family);

View File

@ -68,10 +68,7 @@
#include <netinet/if_ether.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#include <net/bpfdesc.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>

View File

@ -82,11 +82,6 @@
#include <netatalk/at_var.h>
#endif NETATALK
#include "bpf.h"
#if NBPF > 0
#include <net/bpfdesc.h>
#endif
static int loioctl __P((struct ifnet *, u_long, caddr_t));
static void lortrequest __P((int, struct rtentry *, struct sockaddr *));
@ -122,9 +117,7 @@ loopattach(dummy)
ifp->if_type = IFT_LOOP;
ifp->if_snd.ifq_maxlen = ifqmaxlen;
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_NULL, sizeof(u_int));
#endif
}
}
@ -186,7 +179,6 @@ if_simloop(ifp, m, dst, hlen)
if ((m->m_flags & M_PKTHDR) == 0)
panic("if_simloop: no HDR");
m->m_pkthdr.rcvif = ifp;
#if NBPF > 0
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
dst->sa_family = *(mtod(m, int *));
@ -199,22 +191,19 @@ if_simloop(ifp, m, dst, hlen)
struct mbuf m0, *n = m;
u_int af = dst->sa_family;
if (ifp->if_bpf->bif_dlt == DLT_NULL) {
/*
* We need to prepend the address family as
* a four byte field. Cons up a dummy header
* to pacify bpf. This is safe because bpf
* will only read from the mbuf (i.e., it won't
* try to free it or keep a pointer a to it).
*/
m0.m_next = m;
m0.m_len = 4;
m0.m_data = (char *)&af;
n = &m0;
}
/*
* We need to prepend the address family as
* a four byte field. Cons up a dummy header
* to pacify bpf. This is safe because bpf
* will only read from the mbuf (i.e., it won't
* try to free it or keep a pointer a to it).
*/
m0.m_next = m;
m0.m_len = 4;
m0.m_data = (char *)&af;
n = &m0;
bpf_mtap(ifp, n);
}
#endif
/* Strip away media header */
if (hlen > 0) {

View File

@ -113,9 +113,7 @@
#endif
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#if defined(PPP_FILTER) && NBPF == 0
#error "PPP_FILTER requires bpf"
@ -221,9 +219,7 @@ pppattach(dummy)
sc->sc_fastq.ifq_maxlen = IFQ_MAXLEN;
sc->sc_rawq.ifq_maxlen = IFQ_MAXLEN;
if_attach(&sc->sc_if);
#if NBPF > 0
bpfattach(&sc->sc_if, DLT_PPP, PPP_HDRLEN);
#endif
}
register_netisr(NETISR_PPP, pppintr);
/*
@ -828,13 +824,11 @@ pppoutput(ifp, m0, dst, rtp)
#endif /* PPP_FILTER */
}
#if NBPF > 0
/*
* See if bpf wants to look at the packet.
*/
if (ifp->if_bpf)
bpf_mtap(ifp, m0);
#endif
/*
* Put the packet on the appropriate queue.
@ -1463,11 +1457,9 @@ ppp_inproc(sc, m)
#endif /* PPP_FILTER */
}
#if NBPF > 0
/* See if bpf wants to look at the packet. */
if (sc->sc_if.if_bpf)
bpf_mtap(&sc->sc_if, m);
#endif
rv = 0;
switch (proto) {

View File

@ -68,7 +68,6 @@
#include "sl.h"
#if NSL > 0
#include "bpf.h"
#include "opt_inet.h"
#if !defined(ACTUALLY_LKM_NOT_KERNEL) && !defined(KLD_MODULE)
#include "opt_slip.h"
@ -105,9 +104,7 @@
#include <net/if_slvar.h>
#include <net/slip.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
static void slattach __P((void *));
PSEUDO_SET(slattach, if_sl);
@ -150,11 +147,7 @@ PSEUDO_SET(slattach, if_sl);
* time. So, setting SLIP_HIWAT to ~100 guarantees that we'll lose
* at most 1% while maintaining good interactive response.
*/
#if NBPF > 0
#define BUFOFFSET (128+sizeof(struct ifnet **)+SLIP_HDRLEN)
#else
#define BUFOFFSET (128+sizeof(struct ifnet **))
#endif
#define SLRMAX (MCLBYTES - BUFOFFSET)
#define SLBUFSIZE (SLRMAX + BUFOFFSET)
#ifndef SLMTU
@ -232,9 +225,7 @@ slattach(dummy)
sc->sc_if.if_linkmib = sc;
sc->sc_if.if_linkmiblen = sizeof *sc;
if_attach(&sc->sc_if);
#if NBPF > 0
bpfattach(&sc->sc_if, DLT_SLIP, SLIP_HDRLEN);
#endif
}
}
@ -539,10 +530,8 @@ slstart(tp)
register struct ip *ip;
int s;
struct mbuf *m2;
#if NBPF > 0
u_char bpfbuf[SLTMAX + SLIP_HDRLEN];
register int len = 0;
#endif
for (;;) {
/*
@ -584,7 +573,6 @@ slstart(tp)
* queueing, and the connection id compression will get
* munged when this happens.
*/
#if NBPF > 0
if (sc->sc_if.if_bpf) {
/*
* We need to save the TCP/IP header before it's
@ -606,14 +594,12 @@ slstart(tp)
len += mlen;
} while ((m1 = m1->m_next) != NULL);
}
#endif
ip = mtod(m, struct ip *);
if (ip->ip_v == IPVERSION && ip->ip_p == IPPROTO_TCP) {
if (sc->sc_if.if_flags & SC_COMPRESS)
*mtod(m, u_char *) |= sl_compress_tcp(m, ip,
&sc->sc_comp, 1);
}
#if NBPF > 0
if (sc->sc_if.if_bpf) {
/*
* Put the SLIP pseudo-"link header" in place. The
@ -624,7 +610,6 @@ slstart(tp)
bcopy(mtod(m, caddr_t), &bpfbuf[SLX_CHDR], CHDR_LEN);
bpf_tap(&sc->sc_if, bpfbuf, len + SLIP_HDRLEN);
}
#endif
/*
* If system is getting low on clists, just flush our
@ -776,9 +761,7 @@ slinput(c, tp)
register struct mbuf *m;
register int len;
int s;
#if NBPF > 0
u_char chdr[CHDR_LEN];
#endif
tk_nin++;
sc = (struct sl_softc *)tp->t_sc;
@ -845,7 +828,6 @@ slinput(c, tp)
/* less than min length packet - ignore */
goto newpack;
#if NBPF > 0
if (sc->sc_if.if_bpf) {
/*
* Save the compressed header, so we
@ -857,7 +839,6 @@ slinput(c, tp)
*/
bcopy(sc->sc_buf, chdr, CHDR_LEN);
}
#endif
if ((c = (*sc->sc_buf & 0xf0)) != (IPVERSION << 4)) {
if (c & 0x80)
@ -886,7 +867,6 @@ slinput(c, tp)
} else
goto error;
}
#if NBPF > 0
if (sc->sc_if.if_bpf) {
/*
* Put the SLIP pseudo-"link header" in place.
@ -900,7 +880,6 @@ slinput(c, tp)
bcopy(chdr, &hp[SLX_CHDR], CHDR_LEN);
bpf_tap(&sc->sc_if, hp, len + SLIP_HDRLEN);
}
#endif
m = sl_btom(sc, len);
if (m == NULL)
goto error;

View File

@ -12,6 +12,8 @@
* roots in a similar driver written by Phil Cockcroft (formerly) at
* UCL. This driver is based much more on read/write/poll mode of
* operation though.
*
* $FreeBSD$
*/
#include "tun.h"
@ -50,10 +52,7 @@
#include <netns/ns_if.h>
#endif
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <net/if_tunvar.h>
#include <net/if_tun.h>
@ -136,9 +135,7 @@ tuncreate(dev)
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ifp->if_softc = sc;
if_attach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_NULL, sizeof(u_int));
#endif
dev->si_drv1 = sc;
}
@ -336,7 +333,6 @@ tunoutput(ifp, m0, dst, rt)
return EHOSTDOWN;
}
#if NBPF > 0
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
dst->sa_family = *(mtod(m0, int *));
@ -362,7 +358,6 @@ tunoutput(ifp, m0, dst, rt)
bpf_mtap(ifp, &m);
}
#endif /* NBPF > 0 */
/* prepend sockaddr? this may abort if the mbuf allocation fails */
if (tp->tun_flags & TUN_LMODE) {
@ -628,7 +623,6 @@ tunwrite(dev, uio, flag)
top->m_pkthdr.len = tlen;
top->m_pkthdr.rcvif = ifp;
#if NBPF > 0
if (ifp->if_bpf) {
/*
* We need to prepend the address family as
@ -646,7 +640,6 @@ tunwrite(dev, uio, flag)
bpf_mtap(ifp, &m);
}
#endif
#ifdef INET
s = splimp();

View File

@ -57,7 +57,6 @@
#include "vlan.h"
#if NVLAN > 0
#include "opt_inet.h"
#include "bpf.h"
#include <sys/param.h>
#include <sys/kernel.h>
@ -69,9 +68,7 @@
#include <sys/sysctl.h>
#include <sys/systm.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
@ -176,9 +173,7 @@ vlaninit(void *dummy)
ifp->if_snd.ifq_maxlen = ifqmaxlen;
if_attach(ifp);
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
/* Now undo some of the damage... */
ifp->if_data.ifi_type = IFT_8021_VLAN;
ifp->if_data.ifi_hdrlen = EVL_ENCAPLEN;
@ -209,10 +204,8 @@ vlan_start(struct ifnet *ifp)
IF_DEQUEUE(&ifp->if_snd, m);
if (m == 0)
break;
#if NBPF > 0
if (ifp->if_bpf)
bpf_mtap(ifp, m);
#endif /* NBPF > 0 */
/*
* If the LINK0 flag is set, it means the underlying interface
@ -304,7 +297,6 @@ vlan_input_tag(struct ether_header *eh, struct mbuf *m, u_int16_t t)
*/
m->m_pkthdr.rcvif = &ifv->ifv_if;
#if NBPF > 0
if (ifv->ifv_if.if_bpf) {
/*
* Do the usual BPF fakery. Note that we don't support
@ -318,7 +310,6 @@ vlan_input_tag(struct ether_header *eh, struct mbuf *m, u_int16_t t)
m0.m_data = (char *)eh;
bpf_mtap(&ifv->ifv_if, &m0);
}
#endif
ifv->ifv_if.if_ipackets++;
ether_input(&ifv->ifv_if, eh, m);
return;
@ -356,7 +347,6 @@ vlan_input(struct ether_header *eh, struct mbuf *m)
m->m_len -= EVL_ENCAPLEN;
m->m_pkthdr.len -= EVL_ENCAPLEN;
#if NBPF > 0
if (ifv->ifv_if.if_bpf) {
/*
* Do the usual BPF fakery. Note that we don't support
@ -370,7 +360,6 @@ vlan_input(struct ether_header *eh, struct mbuf *m)
m0.m_data = (char *)eh;
bpf_mtap(&ifv->ifv_if, &m0);
}
#endif
ifv->ifv_if.if_ipackets++;
ether_input(&ifv->ifv_if, eh, m);
return 0;

View File

@ -140,10 +140,7 @@
#include <net/netisr.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#endif /* INET */
@ -944,9 +941,7 @@ lpattach (struct lpt_softc *sc, int unit)
if_attach(ifp);
printf("lp%d: TCP/IP capable interface\n", unit);
#if NBPF > 0
bpfattach(ifp, DLT_NULL, LPIPHDRLEN);
#endif
}
#ifndef PC98
@ -1218,11 +1213,9 @@ lpintr (int unit)
IF_DROP(&ipintrq);
goto done;
}
#if NBPF > 0
if (sc->sc_if.if_bpf) {
bpf_tap(&sc->sc_if, sc->sc_ifbuf, len);
}
#endif
len -= LPIPHDRLEN;
sc->sc_if.if_ipackets++;
sc->sc_if.if_ibytes += len;
@ -1410,7 +1403,6 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
} else {
ifp->if_opackets++;
ifp->if_obytes += m->m_pkthdr.len;
#if NBPF > 0
if (ifp->if_bpf) {
/*
* We need to prepend the packet type as
@ -1428,7 +1420,6 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
bpf_mtap(ifp, &m0);
}
#endif
}
m_freem(m);

View File

@ -60,7 +60,6 @@
*/
#include "ed.h"
#include "bpf.h"
#include "pnp.h"
#ifndef EXTRA_ED
@ -87,9 +86,7 @@
#include <net/if_dl.h>
#include <net/if_mib.h>
#if NBPF > 0
#include <net/bpf.h>
#endif
#include "opt_bdg.h"
#ifdef BRIDGE
#include <net/bridge.h>
@ -2465,9 +2462,7 @@ ed_attach(sc, unit, flags)
/*
* If BPF is in the kernel, call the attach for it
*/
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
return 1;
}
@ -2931,11 +2926,9 @@ ed_start(ifp)
/*
* Tap off here if there is a bpf listener.
*/
#if NBPF > 0
if (ifp->if_bpf) {
bpf_mtap(ifp, m0);
}
#endif
m_freem(m0);
@ -3373,13 +3366,11 @@ ed_ioctl(ifp, command, data)
}
}
#if NBPF > 0
/*
* Promiscuous flag may have changed, so reprogram the RCR.
*/
ed_setrcr(sc);
#endif
/*
* An unfortunate hack to provide the (required) software
@ -3504,13 +3495,11 @@ ed_get_packet(sc, buf, len, multicast)
struct ifnet *ifp ;
int need_more = 1 ; /* in case not bpf */
#if NBPF > 0
if (sc->arpcom.ac_if.if_bpf) {
need_more = 0 ;
ed_ring_copy(sc, buf, (char *)eh, len);
bpf_mtap(&sc->arpcom.ac_if, m);
} else
#endif
ed_ring_copy(sc, buf, (char *)eh, 14);
ifp = bridge_in(m);
if (ifp == BDG_DROP) {
@ -3535,15 +3524,12 @@ ed_get_packet(sc, buf, len, multicast)
*/
ed_ring_copy(sc, buf, (char *)eh, len);
#if NBPF > 0
/*
* 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);
#endif
/*
* If we are in promiscuous mode, we have to check whether
* this packet is really for us.

View File

@ -140,10 +140,7 @@
#include <net/netisr.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#endif /* INET */
@ -944,9 +941,7 @@ lpattach (struct lpt_softc *sc, int unit)
if_attach(ifp);
printf("lp%d: TCP/IP capable interface\n", unit);
#if NBPF > 0
bpfattach(ifp, DLT_NULL, LPIPHDRLEN);
#endif
}
#ifndef PC98
@ -1218,11 +1213,9 @@ lpintr (int unit)
IF_DROP(&ipintrq);
goto done;
}
#if NBPF > 0
if (sc->sc_if.if_bpf) {
bpf_tap(&sc->sc_if, sc->sc_ifbuf, len);
}
#endif
len -= LPIPHDRLEN;
sc->sc_if.if_ipackets++;
sc->sc_if.if_ibytes += len;
@ -1410,7 +1403,6 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
} else {
ifp->if_opackets++;
ifp->if_obytes += m->m_pkthdr.len;
#if NBPF > 0
if (ifp->if_bpf) {
/*
* We need to prepend the packet type as
@ -1428,7 +1420,6 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
bpf_mtap(ifp, &m0);
}
#endif
}
m_freem(m);

View File

@ -60,10 +60,7 @@
#include <net/netisr.h>
#endif
#include "bpf.h"
#if NBPF > 0
#include <net/bpf.h>
#endif
#ifdef INET
#include <netinet/in.h>
@ -3473,14 +3470,12 @@ tulip_rx_intr(
#endif /* TULIP_BUS_DMA */
eh = *mtod(ms, struct ether_header *);
#if NBPF > 0
if (sc->tulip_if.if_bpf != NULL) {
if (me == ms)
bpf_tap(&sc->tulip_if, mtod(ms, caddr_t), total_len);
else
bpf_mtap(&sc->tulip_if, ms);
}
#endif
sc->tulip_flags |= TULIP_RXACT;
#ifdef BRIDGE /* see code in if_ed.c */
@ -3737,10 +3732,8 @@ tulip_tx_intr(
TULIP_TXMAP_POSTSYNC(sc, map);
sc->tulip_txmaps[sc->tulip_txmaps_free++] = map;
#endif /* TULIP_BUS_DMA */
#if NBPF > 0
if (sc->tulip_if.if_bpf != NULL)
bpf_mtap(&sc->tulip_if, m);
#endif
m_freem(m);
#if defined(TULIP_DEBUG)
} else {
@ -4901,9 +4894,7 @@ tulip_attach(
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ether_ifattach(&(sc)->tulip_if);
#if NBPF > 0
bpfattach(&sc->tulip_if, DLT_EN10MB, sizeof(struct ether_header));
#endif
}
#if defined(TULIP_BUS_DMA)

View File

@ -34,8 +34,6 @@
* Intel EtherExpress Pro/100B PCI Fast Ethernet driver
*/
#include "bpf.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
@ -52,9 +50,7 @@
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
#if defined(__NetBSD__)
@ -419,10 +415,8 @@ fxp_attach(parent, self, aux)
*/
ifp->if_snd.ifq_maxlen = FXP_NTXCB - 1;
ether_ifattach(ifp, enaddr);
#if NBPF > 0
bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB,
sizeof(struct ether_header));
#endif
/*
* Add shutdown hook so that DMA is disabled prior to reboot. Not
@ -603,9 +597,7 @@ fxp_attach(device_t dev)
*/
ifp->if_snd.ifq_maxlen = FXP_NTXCB - 1;
ether_ifattach(ifp);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
splx(s);
return 0;
@ -993,13 +985,11 @@ fxp_start(ifp)
sc->tx_queued++;
#if NBPF > 0
/*
* Pass packet to bpf if there is a listener.
*/
if (ifp->if_bpf)
bpf_mtap(FXP_BPFTAP_ARG(ifp), mb_head);
#endif
}
/*
@ -1102,12 +1092,10 @@ fxp_intr(arg)
m->m_pkthdr.len = m->m_len =
total_len ;
eh = mtod(m, struct ether_header *);
#if NBPF > 0
if (ifp->if_bpf)
bpf_tap(FXP_BPFTAP_ARG(ifp),
mtod(m, caddr_t),
total_len);
#endif /* NBPF > 0 */
#ifdef BRIDGE
if (do_bridge) {
struct ifnet *bdg_ifp ;