Index: contrib/pf/net/if_pfsync.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/contrib/pf/net/if_pfsync.c,v retrieving revision 1.19.2.4 diff -u -r1.19.2.4 if_pfsync.c --- contrib/pf/net/if_pfsync.c 10 Aug 2006 13:45:59 -0000 1.19.2.4 +++ contrib/pf/net/if_pfsync.c 29 Dec 2006 16:06:50 -0000 @@ -1761,9 +1761,13 @@ KASSERT(m != NULL, ("pfsync_sendout: null mbuf")); #endif #if NBPFILTER > 0 +#ifdef __FreeBSD__ + BPF_MTAP(ifp, m); +#else if (ifp->if_bpf) bpf_mtap(ifp->if_bpf, m); #endif +#endif if (sc->sc_mbuf_net) { m_freem(m); Index: dev/arl/if_arl.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/arl/if_arl.c,v retrieving revision 1.10.2.1 diff -u -r1.10.2.1 if_arl.c --- dev/arl/if_arl.c 25 Aug 2005 05:01:04 -0000 1.10.2.1 +++ dev/arl/if_arl.c 29 Dec 2006 16:06:50 -0000 @@ -980,7 +980,7 @@ * Check if there's a bpf filter listening on this interface. * If so, hand off the raw packet to bpf. */ - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { /* * Note that the interface cannot be in promiscuous mode if * there are no bpf listeners. And if el are in promiscuous Index: dev/ath/if_ath.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/ath/if_ath.c,v retrieving revision 1.94.2.28 diff -u -r1.94.2.28 if_ath.c --- dev/ath/if_ath.c 16 Oct 2006 01:01:41 -0000 1.94.2.28 +++ dev/ath/if_ath.c 29 Dec 2006 16:18:34 -0000 @@ -3019,7 +3019,7 @@ * pass decrypt+mic errors but others may be * interesting (e.g. crc). */ - if (sc->sc_drvbpf != NULL && + if (bpf_peers_present(sc->sc_drvbpf) && (ds->ds_rxstat.rs_status & sc->sc_monpass)) { bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, BUS_DMASYNC_POSTREAD); @@ -3050,7 +3050,8 @@ sc->sc_stats.ast_ant_rx[ds->ds_rxstat.rs_antenna]++; - if (sc->sc_drvbpf != NULL && !ath_rx_tap(sc, m, ds, tsf, nf)) { + if (bpf_peers_present(sc->sc_drvbpf) && + !ath_rx_tap(sc, m, ds, tsf, nf)) { m_freem(m); /* XXX reclaim */ goto rx_next; } @@ -3752,9 +3753,9 @@ ieee80211_dump_pkt(mtod(m0, caddr_t), m0->m_len, sc->sc_hwmap[txrate].ieeerate, -1); - if (ic->ic_rawbpf) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); - if (sc->sc_drvbpf) { + if (bpf_peers_present(sc->sc_drvbpf)) { u_int64_t tsf = ath_hal_gettsf64(ah); sc->sc_tx_th.wt_tsf = htole64(tsf); Index: dev/awi/awi.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/awi/awi.c,v retrieving revision 1.37.2.4 diff -u -r1.37.2.4 awi.c --- dev/awi/awi.c 3 Sep 2005 22:46:42 -0000 1.37.2.4 +++ dev/awi/awi.c 29 Dec 2006 16:20:00 -0000 @@ -796,7 +796,7 @@ } IFQ_DEQUEUE(&ifp->if_snd, m0); #if NBPFILTER > 0 - if (ifp->if_bpf) + if (bpf_peers_present(ifp->if_bpf)) bpf_mtap(ifp->if_bpf, m0); #endif if ((ifp->if_flags & IFF_LINK0) || sc->sc_adhoc_ap) @@ -839,7 +839,7 @@ ifp->if_opackets++; } #if NBPFILTER > 0 - if (ic->ic_rawbpf) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); #endif if (dowep) { Index: dev/ce/if_ce.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/ce/if_ce.c,v retrieving revision 1.3.6.1 diff -u -r1.3.6.1 if_ce.c --- dev/ce/if_ce.c 10 Mar 2006 22:57:36 -0000 1.3.6.1 +++ dev/ce/if_ce.c 29 Dec 2006 16:06:50 -0000 @@ -1069,10 +1069,10 @@ if (! m) return; #ifndef NETGRAPH - if (d->ifp->if_bpf) #if __FreeBSD_version >= 500000 - BPF_MTAP (d->ifp, m); + BPF_MTAP (d->ifp, m); #else + if (d->ifp->if_bpf) bpf_mtap (d->ifp, m); #endif #endif @@ -1191,10 +1191,10 @@ m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ - if (d->ifp->if_bpf) #if __FreeBSD_version >= 500000 - BPF_TAP (d->ifp, data, len); + BPF_TAP (d->ifp, data, len); #else + if (d->ifp->if_bpf) bpf_tap (d->ifp, data, len); #endif IF_ENQUEUE(&d->rqueue, m); Index: dev/cp/if_cp.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/cp/if_cp.c,v retrieving revision 1.24.2.1 diff -u -r1.24.2.1 if_cp.c --- dev/cp/if_cp.c 25 Aug 2005 05:01:06 -0000 1.24.2.1 +++ dev/cp/if_cp.c 29 Dec 2006 16:06:50 -0000 @@ -821,8 +821,7 @@ if (! m) return; #ifndef NETGRAPH - if (d->ifp->if_bpf) - BPF_MTAP (d->ifp, m); + BPF_MTAP (d->ifp, m); #endif len = m_length (m, NULL); if (len >= BUFSZ) @@ -931,8 +930,7 @@ m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ - if (d->ifp->if_bpf) - BPF_TAP (d->ifp, data, len); + BPF_TAP (d->ifp, data, len); IF_ENQUEUE (&d->queue, m); #endif } Index: dev/ctau/if_ct.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/ctau/if_ct.c,v retrieving revision 1.25.2.1 diff -u -r1.25.2.1 if_ct.c --- dev/ctau/if_ct.c 25 Aug 2005 05:01:06 -0000 1.25.2.1 +++ dev/ctau/if_ct.c 29 Dec 2006 16:06:50 -0000 @@ -1030,8 +1030,7 @@ if (! m) return; #ifndef NETGRAPH - if (d->ifp->if_bpf) - BPF_MTAP (d->ifp, m); + BPF_MTAP (d->ifp, m); #endif len = m_length (m, NULL); if (! m->m_next) @@ -1151,8 +1150,7 @@ m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ - if (d->ifp->if_bpf) - BPF_TAP (d->ifp, data, len); + BPF_TAP (d->ifp, data, len); IF_ENQUEUE (&d->queue, m); #endif } Index: dev/cx/if_cx.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/cx/if_cx.c,v retrieving revision 1.45.2.2 diff -u -r1.45.2.2 if_cx.c --- dev/cx/if_cx.c 10 Mar 2006 19:37:31 -0000 1.45.2.2 +++ dev/cx/if_cx.c 29 Dec 2006 16:06:50 -0000 @@ -1185,8 +1185,7 @@ if (! m) return; #ifndef NETGRAPH - if (d->ifp->if_bpf) - BPF_MTAP (d->ifp, m); + BPF_MTAP (d->ifp, m); #endif len = m_length (m, NULL); if (! m->m_next) @@ -1342,8 +1341,7 @@ m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ - if (d->ifp->if_bpf) - BPF_TAP (d->ifp, data, len); + BPF_TAP (d->ifp, data, len); IF_ENQUEUE (&d->queue, m); #endif } Index: dev/en/midway.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/en/midway.c,v retrieving revision 1.65.2.1 diff -u -r1.65.2.1 midway.c --- dev/en/midway.c 25 Aug 2005 05:01:07 -0000 1.65.2.1 +++ dev/en/midway.c 29 Dec 2006 16:37:16 -0000 @@ -776,7 +776,7 @@ sc->vccs[tx.vci]->obytes += tx.datalen; #ifdef ENABLE_BPF - if (sc->ifp->if_bpf != NULL) { + if (bpf_peers_present(sc->ifp->if_bpf)) { /* * adjust the top of the mbuf to skip the TBD if present * before passing the packet to bpf. @@ -794,7 +794,7 @@ tx.m->m_pkthdr.len = tx.datalen; } - BPF_MTAP(sc->ifp, tx.m); + bpf_mtap(sc->ifp->if_bpf, tx.m); } #endif Index: dev/firewire/if_fwip.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/firewire/if_fwip.c,v retrieving revision 1.7.2.3 diff -u -r1.7.2.3 if_fwip.c --- dev/firewire/if_fwip.c 7 Oct 2005 14:00:03 -0000 1.7.2.3 +++ dev/firewire/if_fwip.c 29 Dec 2006 16:07:00 -0000 @@ -838,7 +838,7 @@ * Record the sender ID for possible BPF usage. */ src = ntohl(p[1]) >> 16; - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { mtag = m_tag_alloc(MTAG_FIREWIRE, MTAG_FIREWIRE_SENDER_EUID, 2*sizeof(uint32_t), M_NOWAIT); @@ -939,7 +939,7 @@ return; } - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { /* * Record the sender ID for possible BPF usage. */ Index: dev/gem/if_gem.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/gem/if_gem.c,v retrieving revision 1.29.2.5 diff -u -r1.29.2.5 if_gem.c --- dev/gem/if_gem.c 5 Oct 2005 22:08:17 -0000 1.29.2.5 +++ dev/gem/if_gem.c 29 Dec 2006 03:57:24 -0000 @@ -1205,8 +1205,7 @@ bus_space_write_4(sc->sc_bustag, sc->sc_h, GEM_TX_KICK, sc->sc_txnext); - if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + BPF_MTAP(ifp, m0); } while (1); if (txmfail == -1 || sc->sc_txfree == 0) { Index: dev/ipw/if_ipw.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/ipw/if_ipw.c,v retrieving revision 1.7.2.5 diff -u -r1.7.2.5 if_ipw.c --- dev/ipw/if_ipw.c 10 Apr 2006 18:27:00 -0000 1.7.2.5 +++ dev/ipw/if_ipw.c 29 Dec 2006 03:57:53 -0000 @@ -1071,7 +1071,7 @@ m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = le32toh(status->len); - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct ipw_rx_radiotap_header *tap = &sc->sc_rxtap; tap->wr_flags = 0; @@ -1348,7 +1348,7 @@ wh = mtod(m0, struct ieee80211_frame *); } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct ipw_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1516,7 +1516,7 @@ continue; } - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (ipw_tx_start(ifp, m0, ni) != 0) { Index: dev/iwi/if_iwi.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/iwi/if_iwi.c,v retrieving revision 1.8.2.10 diff -u -r1.8.2.10 if_iwi.c --- dev/iwi/if_iwi.c 29 Oct 2006 08:29:31 -0000 1.8.2.10 +++ dev/iwi/if_iwi.c 29 Dec 2006 03:58:12 -0000 @@ -1302,7 +1302,7 @@ m_adj(m, sizeof (struct iwi_hdr) + sizeof (struct iwi_frame)); - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct iwi_rx_radiotap_header *tap = &sc->sc_rxtap; tap->wr_flags = 0; @@ -1831,7 +1831,7 @@ wh = mtod(m0, struct ieee80211_frame *); } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct iwi_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1986,7 +1986,7 @@ continue; } - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (iwi_tx_start(ifp, m0, ni, ac) != 0) { Index: dev/my/if_my.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/my/if_my.c,v retrieving revision 1.29.2.4 diff -u -r1.29.2.4 if_my.c --- dev/my/if_my.c 19 Jun 2006 19:40:59 -0000 1.29.2.4 +++ dev/my/if_my.c 29 Dec 2006 16:37:16 -0000 @@ -1153,8 +1153,8 @@ * broadcast packet, multicast packet, matches our ethernet * address or the interface is in promiscuous mode. */ - if (ifp->if_bpf) { - BPF_MTAP(ifp, m); + if (bpf_peers_present(ifp->if_bpf)) { + bpf_mtap(ifp->if_bpf, m); if (ifp->if_flags & IFF_PROMISC && (bcmp(eh->ether_dhost, IFP2ENADDR(sc->my_ifp), ETHER_ADDR_LEN) && Index: dev/ppbus/if_plip.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/ppbus/if_plip.c,v retrieving revision 1.37.2.2 diff -u -r1.37.2.2 if_plip.c --- dev/ppbus/if_plip.c 19 Jul 2006 16:31:12 -0000 1.37.2.2 +++ dev/ppbus/if_plip.c 29 Dec 2006 16:37:17 -0000 @@ -455,7 +455,7 @@ lptap(struct ifnet *ifp, struct mbuf *m) { u_int32_t af = AF_INET; - BPF_MTAP2(ifp, &af, sizeof(af), m); + bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); } static void @@ -514,7 +514,7 @@ sc->sc_ifp->if_ibytes += len; top = m_devget(sc->sc_ifbuf + CLPIPHDRLEN, len, 0, sc->sc_ifp, 0); if (top) { - if (sc->sc_ifp->if_bpf) + if (bpf_peers_present(sc->sc_ifp->if_bpf)) lptap(sc->sc_ifp, top); netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ } @@ -559,7 +559,7 @@ sc->sc_ifp->if_ibytes += len; top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, sc->sc_ifp, 0); if (top) { - if (sc->sc_ifp->if_bpf) + if (bpf_peers_present(sc->sc_ifp->if_bpf)) lptap(sc->sc_ifp, top); netisr_queue(NETISR_IP, top); /* mbuf is free'd on failure. */ } @@ -694,7 +694,7 @@ } else { ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; - if (ifp->if_bpf) + if (bpf_peers_present(ifp->if_bpf)) lptap(ifp, m); } @@ -739,7 +739,7 @@ } else { ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; - if (ifp->if_bpf) + if (bpf_peers_present(ifp->if_bpf)) lptap(ifp, m); } Index: dev/ral/rt2560.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/ral/rt2560.c,v retrieving revision 1.9.2.1 diff -u -r1.9.2.1 rt2560.c --- dev/ral/rt2560.c 23 Dec 2006 07:14:42 -0000 1.9.2.1 +++ dev/ral/rt2560.c 29 Dec 2006 03:38:33 -0000 @@ -1225,7 +1225,7 @@ m->m_pkthdr.len = m->m_len = (le32toh(desc->flags) >> 16) & 0xfff; - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct rt2560_rx_radiotap_header *tap = &sc->sc_rxtap; uint32_t tsf_lo, tsf_hi; @@ -1346,7 +1346,7 @@ ieee80211_beacon_update(ic, data->ni, &sc->sc_bo, data->m, 1); - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, data->m); rt2560_tx_bcn(sc, data->m, data->ni); @@ -1606,7 +1606,7 @@ return error; } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1663,7 +1663,7 @@ return error; } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1882,7 +1882,7 @@ wh = mtod(m0, struct ieee80211_frame *); } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1961,7 +1961,7 @@ ni = (struct ieee80211_node *)m0->m_pkthdr.rcvif; m0->m_pkthdr.rcvif = NULL; - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (rt2560_tx_mgt(sc, m0, ni) != 0) @@ -1997,7 +1997,7 @@ continue; } - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (rt2560_tx_data(sc, m0, ni) != 0) { Index: dev/ral/rt2661.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/ral/rt2661.c,v retrieving revision 1.10.2.1 diff -u -r1.10.2.1 rt2661.c --- dev/ral/rt2661.c 23 Dec 2006 07:14:42 -0000 1.10.2.1 +++ dev/ral/rt2661.c 29 Dec 2006 03:58:52 -0000 @@ -1136,7 +1136,7 @@ m->m_pkthdr.len = m->m_len = (le32toh(desc->flags) >> 16) & 0xfff; - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct rt2661_rx_radiotap_header *tap = &sc->sc_rxtap; uint32_t tsf_lo, tsf_hi; @@ -1484,7 +1484,7 @@ return error; } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct rt2661_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1708,7 +1708,7 @@ wh = mtod(m0, struct ieee80211_frame *); } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct rt2661_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1786,7 +1786,7 @@ ni = (struct ieee80211_node *)m0->m_pkthdr.rcvif; m0->m_pkthdr.rcvif = NULL; - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (rt2661_tx_mgt(sc, m0, ni) != 0) @@ -1840,7 +1840,7 @@ continue; } - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (rt2661_tx_data(sc, m0, ni, ac) != 0) { Index: dev/usb/if_ural.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/usb/if_ural.c,v retrieving revision 1.10.2.9 diff -u -r1.10.2.9 if_ural.c --- dev/usb/if_ural.c 14 Nov 2006 12:54:38 -0000 1.10.2.9 +++ dev/usb/if_ural.c 29 Dec 2006 03:59:19 -0000 @@ -958,7 +958,7 @@ m->m_pkthdr.len = m->m_len = (le32toh(desc->flags) >> 16) & 0xfff; m->m_flags |= M_HASFCS; /* h/w leaves FCS */ - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct ural_rx_radiotap_header *tap = &sc->sc_rxtap; tap->wr_flags = IEEE80211_RADIOTAP_F_FCS; @@ -1206,7 +1206,7 @@ flags |= RAL_TX_TIMESTAMP; } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct ural_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1295,7 +1295,7 @@ *(uint16_t *)wh->i_dur = htole16(dur); } - if (sc->sc_drvbpf != NULL) { + if (bpf_peers_present(sc->sc_drvbpf)) { struct ural_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; @@ -1357,7 +1357,7 @@ ni = (struct ieee80211_node *)m0->m_pkthdr.rcvif; m0->m_pkthdr.rcvif = NULL; - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (ural_tx_mgt(sc, m0, ni) != 0) @@ -1393,7 +1393,7 @@ continue; } - if (ic->ic_rawbpf != NULL) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); if (ural_tx_data(sc, m0, ni) != 0) { Index: dev/wi/if_wi.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/dev/wi/if_wi.c,v retrieving revision 1.180.2.8 diff -u -r1.180.2.8 if_wi.c --- dev/wi/if_wi.c 1 Aug 2006 07:37:22 -0000 1.180.2.8 +++ dev/wi/if_wi.c 29 Dec 2006 03:38:33 -0000 @@ -966,7 +966,7 @@ wh = mtod(m0, struct ieee80211_frame *); } #if NBPFILTER > 0 - if (ic->ic_rawbpf) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m0); #endif frmhdr.wi_tx_ctl = htole16(WI_ENC_TX_802_11|WI_TXCNTL_TX_EX); @@ -985,7 +985,7 @@ frmhdr.wi_tx_ctl |= htole16(WI_TXCNTL_NOCRYPT); } #if NBPFILTER > 0 - if (sc->sc_drvbpf) { + if (bpf_peers_present(ic->ic_rawbpf)) { sc->sc_tx_th.wt_rate = ni->ni_rates.rs_rates[ni->ni_txrate]; bpf_mtap2(sc->sc_drvbpf, @@ -1539,7 +1539,7 @@ } #if NBPFILTER > 0 - if (sc->sc_drvbpf) { + if (bpf_peers_present(sc->sc_drvbpf)) { /* XXX replace divide by table */ sc->sc_rx_th.wr_rate = frmhdr.wi_rx_rate / 5; sc->sc_rx_th.wr_antsignal = frmhdr.wi_rx_signal; Index: i4b/driver/i4b_ipr.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/i4b/driver/i4b_ipr.c,v retrieving revision 1.34.2.1 diff -u -r1.34.2.1 i4b_ipr.c --- i4b/driver/i4b_ipr.c 25 Aug 2005 05:01:19 -0000 1.34.2.1 +++ i4b/driver/i4b_ipr.c 29 Dec 2006 16:37:17 -0000 @@ -883,7 +883,7 @@ } #endif - if(sc->sc_ifp->if_bpf) + if(bpf_peers_present(sc->sc_ifp->if_bpf)) { /* prepend the address family as a four byte field */ struct mbuf mm; @@ -891,7 +891,7 @@ mm.m_next = m; mm.m_len = 4; mm.m_data = (char *)⁡ - BPF_MTAP(sc->sc_ifp, &mm); + bpf_mtap(sc->sc_ifp->if_bpf, &mm); } if(netisr_queue(NETISR_IP, m)) /* (0) on success. */ @@ -936,7 +936,7 @@ microtime(&sc->sc_ifp->if_lastchange); - if(sc->sc_ifp->if_bpf) + if(bpf_peers_present(sc->sc_ifp->if_bpf)) { /* prepend the address family as a four byte field */ @@ -945,7 +945,7 @@ mm.m_next = m; mm.m_len = 4; mm.m_data = (char *)⁡ - BPF_MTAP(sc->sc_ifp, &mm); + bpf_mtap(sc->sc_ifp->if_bpf, &mm); } #if I4BIPRACCT Index: net/bpf.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/bpf.c,v retrieving revision 1.153.2.8 diff -u -r1.153.2.8 bpf.c --- net/bpf.c 18 Aug 2006 15:58:16 -0000 1.153.2.8 +++ net/bpf.c 29 Dec 2006 05:04:34 -0000 @@ -299,7 +299,6 @@ LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); bpf_bpfd_cnt++; - *bp->bif_driverp = bp; BPFIF_UNLOCK(bp); } @@ -325,12 +324,6 @@ LIST_REMOVE(d, bd_next); bpf_bpfd_cnt--; - /* - * Let the driver know that there are no more listeners. - */ - if (LIST_EMPTY(&bp->bif_dlist)) - *bp->bif_driverp = NULL; - d->bd_bif = NULL; BPFD_UNLOCK(d); BPFIF_UNLOCK(bp); @@ -1080,51 +1073,33 @@ struct ifnet *theywant; theywant = ifunit(ifr->ifr_name); - if (theywant == NULL) - return ENXIO; + if (theywant == NULL || theywant->if_bpf == NULL) + return (ENXIO); + bp = theywant->if_bpf; /* - * Look through attached interfaces for the named one. + * Allocate the packet buffers if we need to. + * If we're already attached to requested interface, + * just flush the buffer. */ - mtx_lock(&bpf_mtx); - LIST_FOREACH(bp, &bpf_iflist, bif_next) { - struct ifnet *ifp = bp->bif_ifp; - - if (ifp == NULL || ifp != theywant) - continue; - /* skip additional entry */ - if (bp->bif_driverp != &ifp->if_bpf) - continue; - - mtx_unlock(&bpf_mtx); - /* - * We found the requested interface. - * Allocate the packet buffers if we need to. - * If we're already attached to requested interface, - * just flush the buffer. - */ - if (d->bd_sbuf == NULL) { - error = bpf_allocbufs(d); - if (error != 0) - return (error); - } - if (bp != d->bd_bif) { - if (d->bd_bif) - /* - * Detach if attached to something else. - */ - bpf_detachd(d); + if (d->bd_sbuf == NULL) { + error = bpf_allocbufs(d); + if (error != 0) + return (error); + } + if (bp != d->bd_bif) { + if (d->bd_bif) + /* + * Detach if attached to something else. + */ + bpf_detachd(d); - bpf_attachd(d, bp); - } - BPFD_LOCK(d); - reset_d(d); - BPFD_UNLOCK(d); - return (0); + bpf_attachd(d, bp); } - mtx_unlock(&bpf_mtx); - /* Not found. */ - return (ENXIO); + BPFD_LOCK(d); + reset_d(d); + BPFD_UNLOCK(d); + return (0); } /* @@ -1244,13 +1219,6 @@ int gottime; struct timeval tv; - /* - * Lockless read to avoid cost of locking the interface if there are - * no descriptors attached. - */ - if (LIST_EMPTY(&bp->bif_dlist)) - return; - gottime = 0; BPFIF_LOCK(bp); LIST_FOREACH(d, &bp->bif_dlist, bd_next) { @@ -1315,13 +1283,6 @@ gottime = 0; - /* - * Lockless read to avoid cost of locking the interface if there are - * no descriptors attached. - */ - if (LIST_EMPTY(&bp->bif_dlist)) - return; - pktlen = m_length(m, NULL); BPFIF_LOCK(bp); @@ -1367,13 +1328,6 @@ gottime = 0; - /* - * Lockless read to avoid cost of locking the interface if there are - * no descriptors attached. - */ - if (LIST_EMPTY(&bp->bif_dlist)) - return; - pktlen = m_length(m, NULL); /* * Craft on-stack mbuf suitable for passing to bpf_filter. @@ -1566,17 +1520,16 @@ panic("bpfattach"); LIST_INIT(&bp->bif_dlist); - bp->bif_driverp = driverp; bp->bif_ifp = ifp; bp->bif_dlt = dlt; mtx_init(&bp->bif_mtx, "bpf interface lock", NULL, MTX_DEF); + KASSERT(*driverp == NULL, ("bpfattach2: driverp already initialized")); + *driverp = bp; mtx_lock(&bpf_mtx); LIST_INSERT_HEAD(&bpf_iflist, bp, bif_next); mtx_unlock(&bpf_mtx); - *bp->bif_driverp = NULL; - /* * Compute the length of the bpf header. This is not necessarily * equal to SIZEOF_BPF_HDR because we want to insert spacing such @@ -1815,6 +1768,7 @@ * A 'better' implementation would allow the core bpf functionality * to be loaded at runtime. */ +static struct bpf_if bp_null; void bpf_tap(bp, pkt, pktlen) @@ -1845,6 +1799,8 @@ struct ifnet *ifp; u_int dlt, hdrlen; { + + bpfattach2(ifp, dlt, hdrlen, &ifp->if_bpf); } void @@ -1853,6 +1809,8 @@ u_int dlt, hdrlen; struct bpf_if **driverp; { + + *driverp = &bp_null; } void @@ -1880,3 +1838,50 @@ } #endif /* !DEV_BPF && !NETGRAPH_BPF */ + +/* + * ABI compatibility hacks. Older drivers check if_bpf against NULL + * to see if there are active listeners. In the new ABI, if_bpf is + * always non-NULL, so bpf_*tap() are always invoked. We check for + * listeners in these wrappers and call the real functions if needed. + */ +#undef bpf_tap +#undef bpf_mtap +#undef bpf_mtap2 + +void bpf_tap(struct bpf_if *, u_char *, u_int); +void bpf_mtap(struct bpf_if *, struct mbuf *); +void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *); + +void +bpf_tap(bp, pkt, pktlen) + struct bpf_if *bp; + u_char *pkt; + u_int pktlen; +{ + + if (bpf_peers_present(bp)) + bpf_tap_new(bp, pkt, pktlen); +} + +void +bpf_mtap(bp, m) + struct bpf_if *bp; + struct mbuf *m; +{ + + if (bpf_peers_present(bp)) + bpf_mtap_new(bp, m); +} + +void +bpf_mtap2(bp, d, l, m) + struct bpf_if *bp; + void *d; + u_int l; + struct mbuf *m; +{ + + if (bpf_peers_present(bp)) + bpf_mtap2_new(bp, d, l, m); +} Index: net/bpf.h =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/bpf.h,v retrieving revision 1.39.2.2 diff -u -r1.39.2.2 bpf.h --- net/bpf.h 16 Oct 2006 00:47:36 -0000 1.39.2.2 +++ net/bpf.h 29 Dec 2006 04:59:18 -0000 @@ -615,7 +615,23 @@ }; #ifdef _KERNEL -struct bpf_if; +/* + * Descriptor associated with each attached hardware interface. + */ +struct bpf_if { + LIST_ENTRY(bpf_if) bif_next; /* list of all interfaces */ + LIST_HEAD(, bpf_d) bif_dlist; /* descriptor list */ + u_int bif_dlt; /* link layer type */ + u_int bif_hdrlen; /* length of header (with padding) */ + struct ifnet *bif_ifp; /* corresponding interface */ + struct mtx bif_mtx; /* mutex for interface */ +}; + +/* ABI compatibility hacks. */ +#define bpf_tap bpf_tap_new +#define bpf_mtap bpf_mtap_new +#define bpf_mtap2 bpf_mtap2_new + int bpf_validate(const struct bpf_insn *, int); void bpf_tap(struct bpf_if *, u_char *, u_int); void bpf_mtap(struct bpf_if *, struct mbuf *); @@ -627,18 +643,27 @@ void bpfilterattach(int); u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); +static __inline int +bpf_peers_present(struct bpf_if *bpf) +{ + + if (!LIST_EMPTY(&bpf->bif_dlist)) + return (1); + return (0); +} + #define BPF_TAP(_ifp,_pkt,_pktlen) do { \ - if ((_ifp)->if_bpf) \ + if (bpf_peers_present((_ifp)->if_bpf)) \ bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ } while (0) #define BPF_MTAP(_ifp,_m) do { \ - if ((_ifp)->if_bpf) { \ + if (bpf_peers_present((_ifp)->if_bpf)) { \ M_ASSERTVALID(_m); \ bpf_mtap((_ifp)->if_bpf, (_m)); \ } \ } while (0) #define BPF_MTAP2(_ifp,_data,_dlen,_m) do { \ - if ((_ifp)->if_bpf) { \ + if (bpf_peers_present((_ifp)->if_bpf)) { \ M_ASSERTVALID(_m); \ bpf_mtap2((_ifp)->if_bpf,(_data),(_dlen),(_m)); \ } \ Index: net/bpfdesc.h =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/bpfdesc.h,v retrieving revision 1.29.2.2 diff -u -r1.29.2.2 bpfdesc.h --- net/bpfdesc.h 29 Sep 2005 23:48:04 -0000 1.29.2.2 +++ net/bpfdesc.h 29 Dec 2006 03:38:33 -0000 @@ -118,19 +118,6 @@ (bd)->bd_slen != 0)) /* - * Descriptor associated with each attached hardware interface. - */ -struct bpf_if { - LIST_ENTRY(bpf_if) bif_next; /* list of all interfaces */ - LIST_HEAD(, bpf_d) bif_dlist; /* descriptor list */ - struct bpf_if **bif_driverp; /* pointer into softc */ - u_int bif_dlt; /* link layer type */ - u_int bif_hdrlen; /* length of header (with padding) */ - struct ifnet *bif_ifp; /* corresponding interface */ - struct mtx bif_mtx; /* mutex for interface */ -}; - -/* * External representation of the bpf descriptor */ struct xbpf_d { Index: net/if_disc.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_disc.c,v retrieving revision 1.48.2.1 diff -u -r1.48.2.1 if_disc.c --- net/if_disc.c 25 Nov 2005 14:41:31 -0000 1.48.2.1 +++ net/if_disc.c 29 Dec 2006 03:38:33 -0000 @@ -187,7 +187,7 @@ dst->sa_family = af; } - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { u_int af = dst->sa_family; bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); } Index: net/if_enc.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_enc.c,v retrieving revision 1.5.2.1 diff -u -r1.5.2.1 if_enc.c --- net/if_enc.c 24 Jul 2006 23:20:58 -0000 1.5.2.1 +++ net/if_enc.c 29 Dec 2006 16:07:00 -0000 @@ -280,7 +280,7 @@ if ((encif->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - if (encif->if_bpf) { + if (bpf_peers_present(encif->if_bpf)) { flags = 0; if (sav->alg_enc != SADB_EALG_NONE) flags |= M_CONF; Index: net/if_faith.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_faith.c,v retrieving revision 1.36.2.1 diff -u -r1.36.2.1 if_faith.c --- net/if_faith.c 25 Aug 2005 05:01:19 -0000 1.36.2.1 +++ net/if_faith.c 29 Dec 2006 16:26:28 -0000 @@ -235,7 +235,7 @@ dst->sa_family = af; } - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { af = dst->sa_family; bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); } Index: net/if_fwsubr.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_fwsubr.c,v retrieving revision 1.12.2.5 diff -u -r1.12.2.5 if_fwsubr.c --- net/if_fwsubr.c 24 Jan 2006 06:30:51 -0000 1.12.2.5 +++ net/if_fwsubr.c 29 Dec 2006 16:27:17 -0000 @@ -190,7 +190,7 @@ /* * Let BPF tap off a copy before we encapsulate. */ - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { struct fw_bpfhdr h; if (unicast) bcopy(destfw, h.firewire_dhost, 8); @@ -565,7 +565,7 @@ * Give bpf a chance at the packet. The link-level driver * should have left us a tag with the EUID of the sender. */ - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { struct fw_bpfhdr h; struct m_tag *mtag; Index: net/if_gif.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_gif.c,v retrieving revision 1.52.2.6 diff -u -r1.52.2.6 if_gif.c --- net/if_gif.c 10 Aug 2006 10:22:07 -0000 1.52.2.6 +++ net/if_gif.c 29 Dec 2006 03:38:33 -0000 @@ -442,9 +442,7 @@ } af = dst->sa_family; - if (ifp->if_bpf) { - bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); - } + BPF_MTAP2(ifp, &af, sizeof(af), m); ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; @@ -501,7 +499,7 @@ mac_create_mbuf_from_ifnet(ifp, m); #endif - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { u_int32_t af1 = af; bpf_mtap2(ifp->if_bpf, &af1, sizeof(af1), m); } Index: net/if_gre.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_gre.c,v retrieving revision 1.32.2.6 diff -u -r1.32.2.6 if_gre.c --- net/if_gre.c 9 Jun 2006 18:19:16 -0000 1.32.2.6 +++ net/if_gre.c 29 Dec 2006 03:38:33 -0000 @@ -282,7 +282,7 @@ dst->sa_family = af; } - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { af = dst->sa_family; bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); } Index: net/if_loop.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_loop.c,v retrieving revision 1.106.2.2 diff -u -r1.106.2.2 if_loop.c --- net/if_loop.c 29 Sep 2006 04:24:50 -0000 1.106.2.2 +++ net/if_loop.c 29 Dec 2006 03:49:31 -0000 @@ -269,11 +269,11 @@ * -> passes to lo0's BPF (even in case of IPv6, where ifp!=lo0) */ if (hlen > 0) { - if (ifp->if_bpf != NULL) { + if (bpf_peers_present(ifp->if_bpf)) { bpf_mtap(ifp->if_bpf, m); } } else { - if (loif->if_bpf != NULL) { + if (bpf_peers_present(loif->if_bpf)) { if ((m->m_flags & M_MCAST) == 0 || loif == ifp) { /* XXX beware sizeof(af) != 4 */ u_int32_t af1 = af; Index: net/if_sl.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_sl.c,v retrieving revision 1.129 diff -u -r1.129 if_sl.c --- net/if_sl.c 10 Jun 2005 16:49:18 -0000 1.129 +++ net/if_sl.c 29 Dec 2006 03:38:33 -0000 @@ -662,7 +662,7 @@ * queueing, and the connection id compression will get * munged when this happens. */ - if (SL2IFP(sc)->if_bpf) { + if (bpf_peers_present(SL2IFP(sc)->if_bpf)) { /* * We need to save the TCP/IP header before it's * compressed. To avoid complicated code, we just @@ -696,7 +696,7 @@ *mtod(m, u_char *) |= sl_compress_tcp(m, ip, &sc->sc_comp, 1); } - if (SL2IFP(sc)->if_bpf && sc->bpfbuf) { + if (bpf_peers_present(SL2IFP(sc)->if_bpf) && sc->bpfbuf) { /* * Put the SLIP pseudo-"link header" in place. The * compressed header is now at the beginning of the @@ -922,7 +922,7 @@ /* less than min length packet - ignore */ goto newpack; - if (SL2IFP(sc)->if_bpf) { + if (bpf_peers_present(SL2IFP(sc)->if_bpf)) { /* * Save the compressed header, so we * can tack it on later. Note that we @@ -961,7 +961,7 @@ } else goto error; } - if (SL2IFP(sc)->if_bpf) { + if (bpf_peers_present(SL2IFP(sc)->if_bpf)) { /* * Put the SLIP pseudo-"link header" in place. * We couldn't do this any earlier since Index: net/if_stf.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_stf.c,v retrieving revision 1.50.2.1 diff -u -r1.50.2.1 if_stf.c --- net/if_stf.c 16 Nov 2005 10:31:21 -0000 1.50.2.1 +++ net/if_stf.c 29 Dec 2006 03:38:33 -0000 @@ -509,7 +509,7 @@ } bcopy(ptr, &in4, sizeof(in4)); - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { /* * We need to prepend the address family as * a four byte field. Cons up a dummy header @@ -756,7 +756,7 @@ m->m_pkthdr.rcvif = ifp; - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { /* * We need to prepend the address family as * a four byte field. Cons up a dummy header Index: net/if_tun.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net/if_tun.c,v retrieving revision 1.152.2.3 diff -u -r1.152.2.3 if_tun.c --- net/if_tun.c 18 Aug 2006 14:05:17 -0000 1.152.2.3 +++ net/if_tun.c 29 Dec 2006 03:38:33 -0000 @@ -536,7 +536,7 @@ dst->sa_family = af; } - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { af = dst->sa_family; bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m0); } Index: net80211/ieee80211_input.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.62.2.14 diff -u -r1.62.2.14 ieee80211_input.c --- net80211/ieee80211_input.c 2 Sep 2006 15:16:12 -0000 1.62.2.14 +++ net80211/ieee80211_input.c 29 Dec 2006 03:38:33 -0000 @@ -423,7 +423,7 @@ } /* copy to listener after decrypt */ - if (ic->ic_rawbpf) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m); /* @@ -534,7 +534,7 @@ wh = mtod(m, struct ieee80211_frame *); wh->i_fc[1] &= ~IEEE80211_FC1_WEP; } - if (ic->ic_rawbpf) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m); (*ic->ic_recv_mgmt)(ic, m, ni, subtype, rssi, rstamp); m_freem(m); @@ -561,7 +561,7 @@ ifp->if_ierrors++; out: if (m != NULL) { - if (ic->ic_rawbpf) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m); m_freem(m); } @@ -731,7 +731,7 @@ return; out: if (m != NULL) { - if (ic->ic_rawbpf) + if (bpf_peers_present(ic->ic_rawbpf)) bpf_mtap(ic->ic_rawbpf, m); m_freem(m); } Index: netgraph/ng_iface.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/netgraph/ng_iface.c,v retrieving revision 1.43.2.2 diff -u -r1.43.2.2 ng_iface.c --- netgraph/ng_iface.c 9 Nov 2005 11:36:07 -0000 1.43.2.2 +++ netgraph/ng_iface.c 29 Dec 2006 03:59:39 -0000 @@ -418,7 +418,7 @@ ng_iface_bpftap(struct ifnet *ifp, struct mbuf *m, sa_family_t family) { KASSERT(family != AF_UNSPEC, ("%s: family=AF_UNSPEC", __func__)); - if (ifp->if_bpf != NULL) { + if (bpf_peers_present(ifp->if_bpf)) { int32_t family4 = (int32_t)family; bpf_mtap2(ifp->if_bpf, &family4, sizeof(family4), m); } Index: netgraph/ng_sppp.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/netgraph/ng_sppp.c,v retrieving revision 1.8.2.2 diff -u -r1.8.2.2 ng_sppp.c --- netgraph/ng_sppp.c 1 Feb 2006 04:50:07 -0000 1.8.2.2 +++ netgraph/ng_sppp.c 29 Dec 2006 16:07:00 -0000 @@ -219,8 +219,7 @@ ifp->if_drv_flags |= IFF_DRV_OACTIVE; while ((m = sppp_dequeue (ifp)) != NULL) { - if (ifp->if_bpf) - BPF_MTAP (ifp, m); + BPF_MTAP (ifp, m); len = m->m_pkthdr.len; NG_SEND_DATA_ONLY (error, priv->hook, m); @@ -382,8 +381,7 @@ m->m_pkthdr.rcvif = SP2IFP(pp); /* Berkeley packet filter */ - if (SP2IFP(pp)->if_bpf) - BPF_MTAP (SP2IFP(pp), m); + BPF_MTAP (SP2IFP(pp), m); /* Send packet */ sppp_input (SP2IFP(pp), m); Index: netinet/ip_carp.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.27.2.9 diff -u -r1.27.2.9 ip_carp.c --- netinet/ip_carp.c 10 Oct 2006 18:39:38 -0000 1.27.2.9 +++ netinet/ip_carp.c 29 Dec 2006 03:38:33 -0000 @@ -658,7 +658,7 @@ SC2IFP(sc)->if_ipackets++; SC2IFP(sc)->if_ibytes += m->m_pkthdr.len; - if (SC2IFP(sc)->if_bpf) { + if (bpf_peers_present(SC2IFP(sc)->if_bpf)) { struct ip *ip = mtod(m, struct ip *); uint32_t af1 = af; Index: netinet/ip_gre.c =================================================================== RCS file: /host/cvs/usr/cvs/src/sys/netinet/ip_gre.c,v retrieving revision 1.19.2.3 diff -u -r1.19.2.3 ip_gre.c --- netinet/ip_gre.c 10 Aug 2006 10:51:52 -0000 1.19.2.3 +++ netinet/ip_gre.c 29 Dec 2006 03:38:33 -0000 @@ -206,7 +206,7 @@ /* Unlike NetBSD, in FreeBSD m_adj() adjusts m->m_pkthdr.len as well */ m_adj(m, hlen); - if (GRE2IFP(sc)->if_bpf) { + if (bpf_peers_present(GRE2IFP(sc)->if_bpf)) { bpf_mtap2(GRE2IFP(sc)->if_bpf, &af, sizeof(af), m); } @@ -289,7 +289,7 @@ ip->ip_sum = 0; ip->ip_sum = in_cksum(m, (ip->ip_hl << 2)); - if (GRE2IFP(sc)->if_bpf) { + if (bpf_peers_present(GRE2IFP(sc)->if_bpf)) { u_int32_t af = AF_INET; bpf_mtap2(GRE2IFP(sc)->if_bpf, &af, sizeof(af), m); }