diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2006-03-25 22:41:49 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2006-03-25 22:41:49 +0000 |
commit | 24436414aab60dc84348ec54f23b324b4ae862a3 (patch) | |
tree | ee35283622a78eeac5656cb5661954771faf6520 | |
parent | d1265a1a72755bd0209950654a6df47287781241 (diff) |
allow bpf(4) to ignore packets based on their direction (inbound or
outbound), using a new BIOCSDIRFILT ioctl;
guidance, feedback and ok canacar@
121 files changed, 466 insertions, 416 deletions
diff --git a/sys/arch/mac68k/dev/if_ae.c b/sys/arch/mac68k/dev/if_ae.c index 5553c765d79..f61eff22884 100644 --- a/sys/arch/mac68k/dev/if_ae.c +++ b/sys/arch/mac68k/dev/if_ae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ae.c,v 1.28 2006/01/09 20:51:48 miod Exp $ */ +/* $OpenBSD: if_ae.c,v 1.29 2006/03/25 22:41:41 djm Exp $ */ /* $NetBSD: if_ae.c,v 1.62 1997/04/24 16:52:05 scottr Exp $ */ /* @@ -429,7 +429,7 @@ outloop: #if NBPFILTER > 0 /* Tap off here if there is a BPF listener. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* txb_new points to next open buffer slot. */ @@ -870,7 +870,7 @@ aeread(sc, buf, len) * If so, hand off the raw packet to bpf. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/arch/mac68k/dev/if_mc.c b/sys/arch/mac68k/dev/if_mc.c index a7682087fe0..9f2fa230784 100644 --- a/sys/arch/mac68k/dev/if_mc.c +++ b/sys/arch/mac68k/dev/if_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mc.c,v 1.13 2005/06/08 17:03:02 henning Exp $ */ +/* $OpenBSD: if_mc.c,v 1.14 2006/03/25 22:41:41 djm Exp $ */ /* $NetBSD: if_mc.c,v 1.24 2004/10/30 18:08:34 thorpej Exp $ */ /*- @@ -274,7 +274,7 @@ mcstart(ifp) * see the packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -609,7 +609,7 @@ mace_read(sc, pkt, len) #if NBPFILTER > 0 /* Pass the packet to any BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass the packet up. */ diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index a0ea089ebfc..37edb8c0677 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.41 2006/03/23 18:51:37 brad Exp $ */ +/* $OpenBSD: if_sn.c,v 1.42 2006/03/25 22:41:41 djm Exp $ */ /* $NetBSD: if_sn.c,v 1.13 1997/04/25 03:40:10 briggs Exp $ */ /* @@ -371,7 +371,7 @@ outloop: * see the packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -1085,7 +1085,7 @@ sonic_read(struct sn_softc *sc, caddr_t pkt, int len) #if NBPFILTER > 0 /* Pass this up to any BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); return (1); diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c index 81d5545fb08..ded85e08d40 100644 --- a/sys/arch/macppc/dev/if_bm.c +++ b/sys/arch/macppc/dev/if_bm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bm.c,v 1.20 2005/10/09 19:22:23 brad Exp $ */ +/* $OpenBSD: if_bm.c,v 1.21 2006/03/25 22:41:41 djm Exp $ */ /* $NetBSD: if_bm.c,v 1.1 1999/01/01 01:27:52 tsubai Exp $ */ /*- @@ -553,7 +553,7 @@ bmac_rint(void *v) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); ifp->if_ipackets++; @@ -632,7 +632,7 @@ bmac_start(struct ifnet *ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index 191235e784a..763f798b8b5 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.33 2006/01/17 02:03:53 deraadt Exp $ */ +/* $OpenBSD: if_ie.c,v 1.34 2006/03/25 22:41:41 djm Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. @@ -924,7 +924,8 @@ iexmit(sc) if (sc->sc_arpcom.ac_if.if_bpf) bpf_tap(sc->sc_arpcom.ac_if.if_bpf, sc->xmit_cbuffs[sc->xctail], - sc->xmit_buffs[sc->xctail]->ie_xmit_flags); + sc->xmit_buffs[sc->xctail]->ie_xmit_flags, + BPF_DIRECTION_OUT); #endif #if 0 @@ -1201,7 +1202,7 @@ ie_readframe(sc, num) if (bpf_gets_it) { /* Pass it up. */ bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh, - sizeof(eh), m); + sizeof(eh), m, BPF_DIRECTION_IN); } /* * A signal passed up from the filtering code indicating that the diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c index e0933e658d6..db1f9a63ae0 100644 --- a/sys/arch/mvme88k/dev/if_ie.c +++ b/sys/arch/mvme88k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.37 2006/01/17 02:03:53 deraadt Exp $ */ +/* $OpenBSD: if_ie.c,v 1.38 2006/03/25 22:41:41 djm Exp $ */ /*- * Copyright (c) 1998 Steve Murphree, Jr. @@ -888,7 +888,8 @@ iexmit(sc) if (sc->sc_arpcom.ac_if.if_bpf) bpf_tap(sc->sc_arpcom.ac_if.if_bpf, sc->xmit_cbuffs[sc->xctail], - sc->xmit_buffs[sc->xctail]->ie_xmit_flags); + sc->xmit_buffs[sc->xctail]->ie_xmit_flags, + BPF_DIRECTION_OUT); #endif #if 0 @@ -1165,7 +1166,7 @@ ie_readframe(sc, num) if (bpf_gets_it) { /* Pass it up. */ bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh, - sizeof(eh), m); + sizeof(eh), m, BPF_DIRECTION_IN); } /* * A signal passed up from the filtering code indicating that the diff --git a/sys/arch/sgi/dev/if_mec.c b/sys/arch/sgi/dev/if_mec.c index ca824214a39..600a413ade3 100644 --- a/sys/arch/sgi/dev/if_mec.c +++ b/sys/arch/sgi/dev/if_mec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mec.c,v 1.9 2005/11/09 06:11:42 brad Exp $ */ +/* $OpenBSD: if_mec.c,v 1.10 2006/03/25 22:41:41 djm Exp $ */ /* $NetBSD: if_mec_mace.c,v 1.5 2004/08/01 06:36:36 tsutsui Exp $ */ /* @@ -932,7 +932,7 @@ mec_start(struct ifnet *ifp) * Pass packet to bpf if there is a listener. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* @@ -1377,7 +1377,7 @@ mec_rxintr(struct mec_softc *sc, uint32_t stat) * pass it up the stack it its for us. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass it on. */ diff --git a/sys/arch/sparc/dev/be.c b/sys/arch/sparc/dev/be.c index 1df4c0363ba..11837d898f1 100644 --- a/sys/arch/sparc/dev/be.c +++ b/sys/arch/sparc/dev/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.38 2005/11/09 06:14:50 brad Exp $ */ +/* $OpenBSD: be.c,v 1.39 2006/03/25 22:41:41 djm Exp $ */ /* * Copyright (c) 1998 Theo de Raadt and Jason L. Wright. @@ -279,7 +279,7 @@ bestart(ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -1039,7 +1039,7 @@ be_read(sc, idx, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass the packet up. */ ether_input_mbuf(ifp, m); diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c index fe77ee65139..bde14564916 100644 --- a/sys/arch/sparc/dev/hme.c +++ b/sys/arch/sparc/dev/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.51 2006/01/12 15:06:12 brad Exp $ */ +/* $OpenBSD: hme.c,v 1.52 2006/03/25 22:41:41 djm Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -299,7 +299,7 @@ hmestart(ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -977,7 +977,7 @@ hme_read(sc, idx, len, flags) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass the packet up. */ ether_input_mbuf(ifp, m); diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index 9db458de350..8e254a13a70 100644 --- a/sys/arch/sparc/dev/if_ie.c +++ b/sys/arch/sparc/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.33 2006/01/15 19:49:25 miod Exp $ */ +/* $OpenBSD: if_ie.c,v 1.34 2006/03/25 22:41:41 djm Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -1070,7 +1070,8 @@ iexmit(sc) if (sc->sc_arpcom.ac_if.if_bpf) bpf_tap(sc->sc_arpcom.ac_if.if_bpf, sc->xmit_cbuffs[sc->xctail], - SWAP(sc->xmit_buffs[sc->xctail]->ie_xmit_flags)); + SWAP(sc->xmit_buffs[sc->xctail]->ie_xmit_flags), + BPF_DIRECTION_OUT); #endif sc->xmit_buffs[sc->xctail]->ie_xmit_flags |= IE_XMIT_LAST; @@ -1339,7 +1340,7 @@ ie_readframe(sc, num) if (bpf_gets_it) { /* Pass it up. */ bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh, - sizeof(eh), m); + sizeof(eh), m, BPF_DIRECTION_IN); } /* * A signal passed up from the filtering code indicating that the diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c index 20affc88ea3..1dd81f668cb 100644 --- a/sys/arch/sparc/dev/qe.c +++ b/sys/arch/sparc/dev/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.28 2005/11/09 06:14:50 brad Exp $ */ +/* $OpenBSD: qe.c,v 1.29 2006/03/25 22:41:41 djm Exp $ */ /* * Copyright (c) 1998, 2000 Jason L. Wright. @@ -219,7 +219,7 @@ qestart(ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -798,7 +798,7 @@ qe_read(sc, idx, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass the packet up. */ ether_input_mbuf(ifp, m); diff --git a/sys/arch/vax/bi/if_ni.c b/sys/arch/vax/bi/if_ni.c index 78a9e484713..5dc1aecfec8 100644 --- a/sys/arch/vax/bi/if_ni.c +++ b/sys/arch/vax/bi/if_ni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ni.c,v 1.7 2006/01/17 20:26:14 miod Exp $ */ +/* $OpenBSD: if_ni.c,v 1.8 2006/03/25 22:41:41 djm Exp $ */ /* $NetBSD: if_ni.c,v 1.15 2002/05/22 16:03:14 wiz Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -544,7 +544,7 @@ nistart(ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif bdp = &bbd[(data->bufs[0]._index & 0x7fff)]; for (m0 = m, i = 0, mlen = 0; m0; m0 = m0->m_next) { @@ -631,7 +631,7 @@ niintr(void *arg) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif (*ifp->if_input)(ifp, m); break; diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index 2d43a41c411..37214187496 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.18 2004/07/07 23:10:45 deraadt Exp $ */ +/* $OpenBSD: if_qe.c,v 1.19 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -464,7 +464,7 @@ qestart(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* * m now points to a mbuf chain that can be loaded. @@ -560,7 +560,7 @@ qeintr(void *arg) eh = mtod(m, struct ether_header *); #if NBPFILTER > 0 if (ifp->if_bpf) { - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); if ((ifp->if_flags & IFF_PROMISC) != 0 && bcmp(sc->sc_ac.ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN) != 0 && diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index d7e45c5cad8..e47923cc0fd 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgec.c,v 1.9 2005/11/24 04:49:25 brad Exp $ */ +/* $OpenBSD: sgec.c,v 1.10 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -343,7 +343,7 @@ zestart(ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* * m now points to a mbuf chain that can be loaded. @@ -428,7 +428,7 @@ sgec_intr(sc) eh = mtod(m, struct ether_header *); #if NBPFILTER > 0 if (ifp->if_bpf) { - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); if ((ifp->if_flags & IFF_PROMISC) != 0 && ((eh->ether_dhost[0] & 1) == 0) && bcmp(sc->sc_ac.ac_enaddr, eh->ether_dhost, diff --git a/sys/arch/vax/qbus/if_de.c b/sys/arch/vax/qbus/if_de.c index 24fd2246ec5..c9bad964a39 100644 --- a/sys/arch/vax/qbus/if_de.c +++ b/sys/arch/vax/qbus/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.6 2006/01/17 20:26:16 miod Exp $ */ +/* $OpenBSD: if_de.c,v 1.7 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: if_de.c,v 1.11 2001/11/13 07:11:24 lukem Exp $ */ /* @@ -400,7 +400,7 @@ destart(struct ifnet *ifp) panic("deuna xmit in progress"); #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif len = if_ubaput(&sc->sc_ifuba, &sc->sc_ifw[sc->sc_xfree], m); @@ -521,7 +521,7 @@ derecv(struct de_softc *sc) } #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif (*ifp->if_input)(ifp, m); diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index 3ed233a2a5e..5afa5991fc4 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am7990.c,v 1.39 2005/11/07 03:20:00 brad Exp $ */ +/* $OpenBSD: am7990.c,v 1.40 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: am7990.c,v 1.22 1996/10/13 01:37:19 christos Exp $ */ /*- @@ -474,7 +474,7 @@ am7990_read(sc, boff, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif #ifdef LANCE_REVC_BUG @@ -780,7 +780,7 @@ am7990_start(ifp) * before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index 5cc9b48d1b4..35f28c40d3e 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.48 2006/03/04 04:43:28 brad Exp $ */ +/* $OpenBSD: an.c,v 1.49 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -452,7 +452,7 @@ an_rxeof(struct an_softc *sc) mb.m_len = sizeof(sc->sc_rxtapu); mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif /* NPBFILTER > 0 */ @@ -1131,7 +1131,7 @@ an_start(struct ifnet *ifp) ifp->if_opackets++; #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif if ((m = ieee80211_encap(ifp, m, &ni)) == NULL) { ifp->if_oerrors++; @@ -1141,7 +1141,7 @@ an_start(struct ifnet *ifp) ieee80211_release_node(ic, ni); #if NBPFILTER > 0 if (ic->ic_rawbpf) - bpf_mtap(ic->ic_rawbpf, m); + bpf_mtap(ic->ic_rawbpf, m, BPF_DIRECTION_OUT); #endif wh = mtod(m, struct ieee80211_frame *); @@ -1205,7 +1205,7 @@ an_start(struct ifnet *ifp) mb.m_len = sizeof(sc->sc_txtapu); mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, m); + bpf_mtap(sc->sc_drvbpf, m, BPF_DIRECTION_OUT); } #endif diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index ca7b959ed7b..2cdb1186f2b 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.46 2006/02/20 20:12:13 damien Exp $ */ +/* $OpenBSD: ath.c,v 1.47 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -936,7 +936,7 @@ ath_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -2008,7 +2008,7 @@ ath_rx_proc(void *arg, int npending) mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif @@ -2378,7 +2378,7 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, #if NBPFILTER > 0 if (ic->ic_rawbpf) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, BPF_DIRECTION_OUT); if (sc->sc_drvbpf) { struct mbuf mb; @@ -2399,7 +2399,7 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 950ce86bba1..0ee9e7938f1 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atw.c,v 1.44 2006/03/22 19:39:06 deraadt Exp $ */ +/* $OpenBSD: atw.c,v 1.45 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -3219,7 +3219,7 @@ atw_rxintr(struct atw_softc *sc) mb.m_len = tap->ar_ihdr.it_len; mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_radiobpf, &mb); + bpf_mtap(sc->sc_radiobpf, &mb, BPF_DIRECTION_IN); } #endif /* NPBFILTER > 0 */ @@ -3498,7 +3498,7 @@ atw_start(struct ifnet *ifp) break; #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* NBPFILTER > 0 */ if ((m0 = ieee80211_encap(ifp, m0, &ni)) == NULL) { ifp->if_oerrors++; @@ -3543,7 +3543,7 @@ atw_start(struct ifnet *ifp) * Pass the packet to any BPF listeners. */ if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, BPF_DIRECTION_OUT); if (sc->sc_radiobpf != NULL) { struct mbuf mb; @@ -3560,7 +3560,7 @@ atw_start(struct ifnet *ifp) mb.m_len = tap->at_ihdr.it_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_radiobpf, &mb); + bpf_mtap(sc->sc_radiobpf, &mb, BPF_DIRECTION_OUT); } #endif /* NBPFILTER > 0 */ diff --git a/sys/dev/ic/awi.c b/sys/dev/ic/awi.c index 4d14123f95d..ddd410b227b 100644 --- a/sys/dev/ic/awi.c +++ b/sys/dev/ic/awi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awi.c,v 1.20 2006/01/04 06:04:41 canacar Exp $ */ +/* $OpenBSD: awi.c,v 1.21 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: awi.c,v 1.26 2000/07/21 04:48:55 onoe Exp $ */ /*- @@ -223,18 +223,18 @@ int awi_dump_len = 28; #define AWI_BPF_NORM 0 #define AWI_BPF_RAW 1 #ifdef __FreeBSD__ -#define AWI_BPF_MTAP(sc, m, raw) do { \ +#define AWI_BPF_MTAP(sc, m, raw, dir) do { \ if ((sc)->sc_ifp->if_bpf && (sc)->sc_rawbpf == (raw)) \ bpf_mtap((sc)->sc_ifp, (m)); \ } while (0); #else -#define AWI_BPF_MTAP(sc, m, raw) do { \ +#define AWI_BPF_MTAP(sc, m, raw, dir) do { \ if ((sc)->sc_ifp->if_bpf && (sc)->sc_rawbpf == (raw)) \ - bpf_mtap((sc)->sc_ifp->if_bpf, (m)); \ + bpf_mtap((sc)->sc_ifp->if_bpf, (m), dir); \ } while (0); #endif #else -#define AWI_BPF_MTAP(sc, m, raw) +#define AWI_BPF_MTAP(sc, m, raw, dir) #endif #ifndef llc_snap @@ -994,7 +994,7 @@ awi_start(ifp) break; } IFQ_DEQUEUE(&ifp->if_snd, m0); - AWI_BPF_MTAP(sc, m0, AWI_BPF_NORM); + AWI_BPF_MTAP(sc, m0, AWI_BPF_NORM, BPF_DIRECTION_OUT); m0 = awi_fix_txhdr(sc, m0); if (sc->sc_wep_algo != NULL && m0 != NULL) m0 = awi_wep_encrypt(sc, m0, 1); @@ -1008,7 +1008,7 @@ awi_start(ifp) if (awi_dump) awi_dump_pkt(sc, m0, -1); #endif - AWI_BPF_MTAP(sc, m0, AWI_BPF_RAW); + AWI_BPF_MTAP(sc, m0, AWI_BPF_RAW, BPF_DIRECTION_OUT); len = 0; for (m = m0; m != NULL; m = m->m_next) { awi_write_bytes(sc, frame + len, mtod(m, u_int8_t *), @@ -1222,7 +1222,7 @@ awi_input(sc, m, rxts, rssi) /* trim CRC here for WEP can find its own CRC at the end of packet. */ m_adj(m, -ETHER_CRC_LEN); - AWI_BPF_MTAP(sc, m, AWI_BPF_RAW); + AWI_BPF_MTAP(sc, m, AWI_BPF_RAW, BPF_DIRECTION_IN); wh = mtod(m, struct ieee80211_frame *); if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != IEEE80211_FC0_VERSION_0) { @@ -1274,7 +1274,7 @@ awi_input(sc, m, rxts, rssi) } ifp->if_ipackets++; #if !(defined(__FreeBSD__) && __FreeBSD__ >= 4) - AWI_BPF_MTAP(sc, m, AWI_BPF_NORM); + AWI_BPF_MTAP(sc, m, AWI_BPF_NORM, BPF_DIRECTION_IN); #endif #ifdef __NetBSD__ (*ifp->if_input)(ifp, m); diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 928d9c16b22..df227d51e98 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.91 2006/01/28 10:08:38 brad Exp $ */ +/* $OpenBSD: dc.c,v 1.92 2006/03/25 22:41:42 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2269,7 +2269,7 @@ dc_rxeof(sc) ifp->if_ipackets++; #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); } @@ -2780,7 +2780,7 @@ dc_start(ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif if (sc->dc_flags & DC_TX_ONE) { ifp->if_flags |= IFF_OACTIVE; diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c index 2db24368ebf..12a6f0533ae 100644 --- a/sys/dev/ic/dp8390.c +++ b/sys/dev/ic/dp8390.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dp8390.c,v 1.30 2006/02/24 23:56:19 brad Exp $ */ +/* $OpenBSD: dp8390.c,v 1.31 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */ /* @@ -452,7 +452,7 @@ outloop: #if NBPFILTER > 0 /* Tap off here if there is a BPF listener. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* txb_new points to next open buffer slot. */ @@ -929,7 +929,7 @@ dp8390_read(sc, buf, len) * If so, hand off the raw packet to bpf. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index 559c823ddc5..f21dd9a2e87 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elink3.c,v 1.66 2005/11/21 18:16:39 millert Exp $ */ +/* $OpenBSD: elink3.c,v 1.67 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */ /* @@ -1025,7 +1025,7 @@ startagain: #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* @@ -1321,7 +1321,7 @@ again: * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index e322692567a..0873810805b 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.76 2006/03/04 03:34:38 brad Exp $ */ +/* $OpenBSD: fxp.c,v 1.77 2006/03/25 22:41:42 djm Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -787,7 +787,7 @@ fxp_start(ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif FXP_MBUF_SYNC(sc, txs->tx_map, BUS_DMASYNC_PREWRITE); @@ -973,7 +973,8 @@ rcvloop: total_len; #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, + BPF_DIRECTION_IN); #endif /* NBPFILTER > 0 */ ether_input_mbuf(ifp, m); } diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index a9037c1d07a..e22f9468f02 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gem.c,v 1.56 2006/02/21 19:46:52 brad Exp $ */ +/* $OpenBSD: gem.c,v 1.57 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */ /* @@ -976,7 +976,7 @@ gem_rint(sc) * pass it up the stack if its for us. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* NPBFILTER > 0 */ /* Pass it on. */ @@ -1656,7 +1656,7 @@ gem_start(ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index 6b73d056cfe..77eb4d1023e 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.41 2006/01/12 15:06:12 brad Exp $ */ +/* $OpenBSD: hme.c,v 1.42 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */ /*- @@ -656,7 +656,7 @@ hme_start(ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif if (hme_encap(sc, m, &bix)) { @@ -879,7 +879,7 @@ hme_rint(sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c index c163fff852e..0d8caf3803d 100644 --- a/sys/dev/ic/i82596.c +++ b/sys/dev/ic/i82596.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596.c,v 1.25 2005/01/15 05:24:11 brad Exp $ */ +/* $OpenBSD: i82596.c,v 1.26 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */ /*- @@ -1127,7 +1127,7 @@ i82596_readframe(sc, num) #if NBPFILTER > 0 /* Check for a BPF filter; if so, hand it up. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* NBPFILTER > 0 */ /* @@ -1258,7 +1258,7 @@ i82596_start(ifp) #if NBPFILTER > 0 /* Tap off here if there is a BPF listener. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif if (m0->m_pkthdr.len > IE_TBUF_SIZE) diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 9ca7996aab3..77f93be7a27 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.126 2005/12/03 21:11:47 brad Exp $ */ +/* $OpenBSD: if_wi.c,v 1.127 2006/03/25 22:41:43 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -105,7 +105,6 @@ #include <crypto/arc4.h> -#define BPF_MTAP(if,mbuf) bpf_mtap((if)->if_bpf, (mbuf)) #define BPFATTACH(if_bpf,if,dlt,sz) #define STATIC @@ -128,7 +127,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.126 2005/12/03 21:11:47 brad Exp $"; + "$OpenBSD: if_wi.c,v 1.127 2006/03/25 22:41:43 djm Exp $"; #endif /* lint */ #ifdef foo @@ -829,7 +828,7 @@ wi_rxeof(struct wi_softc *sc) #if NBPFILTER > 0 /* Handle BPF listeners. */ if (ifp->if_bpf) - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Receive packet unless in procframe or monitor mode. */ @@ -2358,7 +2357,7 @@ nextpkt: * this frame to him. */ if (ifp->if_bpf) - BPF_MTAP(ifp, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif m_freem(m0); diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c index 23c4d18d8d1..38acec88274 100644 --- a/sys/dev/ic/lemac.c +++ b/sys/dev/ic/lemac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lemac.c,v 1.8 2005/11/14 14:46:41 mickey Exp $ */ +/* $OpenBSD: lemac.c,v 1.9 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: lemac.c,v 1.20 2001/06/13 10:46:02 wiz Exp $ */ /*- @@ -310,7 +310,7 @@ lemac_input(struct lemac_softc *sc, bus_size_t offset, size_t length) #if NBPFILTER > 0 if (sc->sc_if.if_bpf != NULL) { m->m_pkthdr.len = m->m_len = length; - bpf_mtap(sc->sc_if.if_bpf, m); + bpf_mtap(sc->sc_if.if_bpf, m, BPF_DIRECTION_IN); } /* @@ -769,7 +769,7 @@ lemac_ifstart(struct ifnet *ifp) LEMAC_OUTB(sc, LEMAC_REG_TQ, tx_pg); #if NBPFILTER > 0 if (sc->sc_if.if_bpf != NULL) - bpf_mtap(sc->sc_if.if_bpf, m); + bpf_mtap(sc->sc_if.if_bpf, m, BPF_DIRECTION_OUT); #endif m_freem(m); /* free the mbuf */ } diff --git a/sys/dev/ic/midway.c b/sys/dev/ic/midway.c index 473b658fa48..1bcaef7a029 100644 --- a/sys/dev/ic/midway.c +++ b/sys/dev/ic/midway.c @@ -1,4 +1,4 @@ -/* $OpenBSD: midway.c,v 1.36 2006/03/15 20:04:37 miod Exp $ */ +/* $OpenBSD: midway.c,v 1.37 2006/03/25 22:41:43 djm Exp $ */ /* (sync'd to midway.c 1.68) */ /* @@ -177,8 +177,6 @@ #endif /* __FreeBSD__ */ -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) - #if NBPFILTER > 0 #include <net/bpf.h> #endif @@ -1940,7 +1938,7 @@ again: launch.t->m_data += size; launch.t->m_len -= size; - BPF_MTAP(&sc->enif, launch.t); + bpf_mtap(sc->enif.if_bpf, launch.t, BPF_DIRECTION_OUT); launch.t->m_data -= size; launch.t->m_len += size; @@ -2513,7 +2511,7 @@ void *arg; #if NBPFILTER > 0 if (sc->enif.if_bpf) - BPF_MTAP(&sc->enif, m); + bpf_mtap(sc->enif.if_bpf, m, BPF_DIRECTION_IN); #endif atm_input(&sc->enif, &ah, m, sc->rxslot[slot].rxhand); diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c index 02eadfc0dd8..aca220b2d07 100644 --- a/sys/dev/ic/mtd8xx.c +++ b/sys/dev/ic/mtd8xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtd8xx.c,v 1.11 2005/11/19 01:59:37 aaron Exp $ */ +/* $OpenBSD: mtd8xx.c,v 1.12 2006/03/25 22:41:43 djm Exp $ */ /* * Copyright (c) 2003 Oleg Safiullin <form@pdp11.org.ru> @@ -745,7 +745,7 @@ mtd_start(struct ifnet *ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif } @@ -965,7 +965,7 @@ mtd_rxeof(struct mtd_softc *sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); } diff --git a/sys/dev/ic/pdq_ifsubr.c b/sys/dev/ic/pdq_ifsubr.c index cb48c8bb3ce..9d499b2543b 100644 --- a/sys/dev/ic/pdq_ifsubr.c +++ b/sys/dev/ic/pdq_ifsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdq_ifsubr.c,v 1.17 2005/11/09 05:50:25 brad Exp $ */ +/* $OpenBSD: pdq_ifsubr.c,v 1.18 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: pdq_ifsubr.c,v 1.5 1996/05/20 00:26:21 thorpej Exp $ */ /*- @@ -187,7 +187,7 @@ pdq_os_receive_pdu( sc->sc_if.if_ipackets++; #if NBPFILTER > 0 if (sc->sc_bpf != NULL) - PDQ_BPF_MTAP(sc, m); + PDQ_BPF_MTAP(sc, m, BPF_DIRECTION_IN); if ((fh->fddi_fc & (FDDIFC_L|FDDIFC_F)) != FDDIFC_LLC_ASYNC) { m_freem(m); return; @@ -223,7 +223,7 @@ pdq_os_transmit_done( pdq_softc_t *sc = (pdq_softc_t *) pdq->pdq_os_ctx; #if NBPFILTER > 0 if (sc->sc_bpf != NULL) - PDQ_BPF_MTAP(sc, m); + PDQ_BPF_MTAP(sc, m, BPF_DIRECTION_OUT); #endif m_freem(m); sc->sc_if.if_opackets++; diff --git a/sys/dev/ic/pdqvar.h b/sys/dev/ic/pdqvar.h index d4e1644cf96..34b7d585096 100644 --- a/sys/dev/ic/pdqvar.h +++ b/sys/dev/ic/pdqvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pdqvar.h,v 1.17 2005/11/23 11:30:14 mickey Exp $ */ +/* $OpenBSD: pdqvar.h,v 1.18 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: pdqvar.h,v 1.11 1996/10/25 21:33:37 cgd Exp $ */ /*- @@ -110,8 +110,8 @@ typedef u_int16_t pdq_bus_ioport_t; typedef volatile pdq_uint32_t *pdq_bus_memaddr_t; typedef pdq_bus_memaddr_t pdq_bus_memoffset_t; #if BSD >= 199506 /* __FreeBSD__ */ -#define PDQ_BPF_MTAP(sc, m) bpf_mtap(&(sc)->sc_if, m) -#define PDQ_BPFATTACH(sc, t, s) bpfattach(&(sc)->sc_if, t, s) +#define PDQ_BPF_MTAP(sc, m, dir) bpf_mtap(&(sc)->sc_if, m, dir) +#define PDQ_BPFATTACH(sc, t, s) bpfattach(&(sc)->sc_if, t, s) #endif @@ -155,11 +155,11 @@ typedef pdq_uint32_t pdq_bus_memoffset_t; #endif #if !defined(PDQ_BPF_MTAP) -#define PDQ_BPF_MTAP(sc, m) bpf_mtap((sc)->sc_bpf, m) +#define PDQ_BPF_MTAP(sc, m, dir) bpf_mtap((sc)->sc_bpf, m, dir) #endif #if !defined(PDQ_BPFATTACH) -#define PDQ_BPFATTACH(sc, t, s) bpfattach(&(sc)->sc_bpf, &(sc)->sc_if, t, s) +#define PDQ_BPFATTACH(sc, t, s)bpfattach(&(sc)->sc_bpf, &(sc)->sc_if, t, s) #endif #if !defined(PDQ_OS_PTR_FMT) diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 6d7a02afc88..777c5b61f51 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.18 2006/03/04 03:47:08 brad Exp $ */ +/* $OpenBSD: re.c,v 1.19 2006/03/25 22:41:43 djm Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -1201,7 +1201,7 @@ re_rxeof(sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); } @@ -1510,7 +1510,7 @@ re_start(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif queued++; } diff --git a/sys/dev/ic/rln.c b/sys/dev/ic/rln.c index 1ce30d87060..5f0820abff2 100644 --- a/sys/dev/ic/rln.c +++ b/sys/dev/ic/rln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rln.c,v 1.17 2005/11/07 03:20:00 brad Exp $ */ +/* $OpenBSD: rln.c,v 1.18 2006/03/25 22:41:43 djm Exp $ */ /* * David Leonard <d@openbsd.org>, 1999. Public Domain. * @@ -249,7 +249,7 @@ rlnstart(ifp) #if NBPFILTER > 0 /* Tap packet stream here for BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* We need to use m->m_pkthdr.len, so require the header. */ @@ -587,7 +587,7 @@ rlnread(sc, hdr, len) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 3f7b843e45b..29619229467 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.12 2006/02/25 13:02:10 damien Exp $ */ +/* $OpenBSD: rt2560.c,v 1.13 2006/03/25 22:41:43 djm Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1353,7 +1353,7 @@ rt2560_decryption_intr(struct rt2560_softc *sc) mb.m_len = sc->sc_txtap_len; mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif @@ -1464,7 +1464,7 @@ rt2560_beacon_expire(struct rt2560_softc *sc) #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, data->m); + bpf_mtap(ic->ic_rawbpf, data->m, BPF_DIRECTION_OUT); #endif DPRINTFN(15, ("beacon expired\n")); @@ -1768,7 +1768,7 @@ rt2560_tx_mgt(struct rt2560_softc *sc, struct mbuf *m0, mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -2018,7 +2018,7 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -2090,7 +2090,8 @@ rt2560_start(struct ifnet *ifp) m0->m_pkthdr.rcvif = NULL; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, + BPF_DIRECTION_OUT); #endif if (rt2560_tx_mgt(sc, m0, ni) != 0) break; @@ -2108,14 +2109,15 @@ rt2560_start(struct ifnet *ifp) } #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif m0 = ieee80211_encap(ifp, m0, &ni); if (m0 == NULL) continue; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, + BPF_DIRECTION_OUT); #endif if (rt2560_tx_data(sc, m0, ni) != 0) { if (ni != NULL) diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index c2e7792327f..34a8b21db1b 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.13 2006/02/25 13:08:39 damien Exp $ */ +/* $OpenBSD: rt2661.c,v 1.14 2006/03/25 22:41:43 djm Exp $ */ /*- * Copyright (c) 2006 @@ -1251,7 +1251,7 @@ rt2661_rx_intr(struct rt2661_softc *sc) mb.m_len = sc->sc_txtap_len; mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif @@ -1597,7 +1597,7 @@ rt2661_tx_mgt(struct rt2661_softc *sc, struct mbuf *m0, mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -1847,7 +1847,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0, mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -1918,7 +1918,8 @@ rt2661_start(struct ifnet *ifp) m0->m_pkthdr.rcvif = NULL; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, + BPF_DIRECTION_OUT); #endif if (rt2661_tx_mgt(sc, m0, ni) != 0) break; @@ -1937,14 +1938,15 @@ rt2661_start(struct ifnet *ifp) } #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif m0 = ieee80211_encap(ifp, m0, &ni); if (m0 == NULL) continue; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, + BPF_DIRECTION_OUT); #endif if (rt2661_tx_data(sc, m0, ni, 0) != 0) { if (ni != NULL) diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index 18bbaf88f1f..b1bfcfe4e62 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.47 2005/11/07 03:20:00 brad Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.48 2006/03/25 22:41:43 djm Exp $ */ /* * Copyright (c) 1997, 1998 @@ -718,7 +718,7 @@ rl_rxeof(sc) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); @@ -926,7 +926,8 @@ void rl_start(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, RL_CUR_TXMBUF(sc)); + bpf_mtap(ifp->if_bpf, RL_CUR_TXMBUF(sc), + BPF_DIRECTION_OUT); #endif /* * Transmit the frame. diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 785187fd13e..5e91dfa13ce 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.53 2006/02/05 23:47:47 jsg Exp $ */ +/* $OpenBSD: rtw.c,v 1.54 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -1334,7 +1334,7 @@ rtw_intr_rx(struct rtw_softc *sc, u_int16_t isr) mb.m_len = sizeof(sc->sc_rxtapu); mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_radiobpf, &mb); + bpf_mtap(sc->sc_radiobpf, &mb, BPF_DIRECTION_IN); } #endif /* NPBFILTER > 0 */ @@ -2826,7 +2826,7 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp, ifp->if_opackets++; #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif if ((m0 = ieee80211_encap(ifp, m0, nip)) == NULL) { DPRINTF(sc, RTW_DEBUG_XMIT, @@ -3065,7 +3065,8 @@ rtw_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap((caddr_t)ic->ic_rawbpf, m0); + bpf_mtap((caddr_t)ic->ic_rawbpf, m0, + BPF_DIRECTION_OUT); if (sc->sc_radiobpf != NULL) { struct mbuf mb; @@ -3083,7 +3084,7 @@ rtw_start(struct ifnet *ifp) mb.m_len = sizeof(sc->sc_txtapu); mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_radiobpf, &mb); + bpf_mtap(sc->sc_radiobpf, &mb, BPF_DIRECTION_OUT); } #endif /* NPBFILTER > 0 */ diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c index 975f982631f..c03e6af3d46 100644 --- a/sys/dev/ic/smc83c170.c +++ b/sys/dev/ic/smc83c170.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc83c170.c,v 1.7 2005/12/15 23:40:19 krw Exp $ */ +/* $OpenBSD: smc83c170.c,v 1.8 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */ /*- @@ -496,7 +496,7 @@ epic_start(struct ifnet *ifp) * Pass the packet to any BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif } @@ -775,7 +775,7 @@ epic_intr(void *arg) * pass it up the stack if its for us. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass it on. */ diff --git a/sys/dev/ic/smc90cx6.c b/sys/dev/ic/smc90cx6.c index 327b5b79734..aeb365ad120 100644 --- a/sys/dev/ic/smc90cx6.c +++ b/sys/dev/ic/smc90cx6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc90cx6.c,v 1.11 2005/02/14 14:00:49 brad Exp $ */ +/* $OpenBSD: smc90cx6.c,v 1.12 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: smc90cx6.c,v 1.17 1996/05/07 01:43:18 thorpej Exp $ */ /* @@ -574,7 +574,7 @@ bah_start(ifp) * that RAM is just accessed as on every other byte) */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif #ifdef BAH_DEBUG @@ -871,7 +871,7 @@ bah_srint(vsc, dummy) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, head); + bpf_mtap(ifp->if_bpf, head, BPF_DIRECTION_IN); #endif arc_input(&sc->sc_arccom.ac_if, head); diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c index 0e050823229..75a428bae0e 100644 --- a/sys/dev/ic/smc91cxx.c +++ b/sys/dev/ic/smc91cxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc91cxx.c,v 1.23 2006/02/24 01:48:27 brad Exp $ */ +/* $OpenBSD: smc91cxx.c,v 1.24 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: smc91cxx.c,v 1.11 1998/08/08 23:51:41 mycroft Exp $ */ /*- @@ -707,7 +707,7 @@ smc91cxx_start(ifp) #if NBPFILTER > 0 /* Hand off a copy to the bpf. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, top); + bpf_mtap(ifp->if_bpf, top, BPF_DIRECTION_OUT); #endif ifp->if_opackets++; @@ -1010,7 +1010,7 @@ smc91cxx_read(sc) * we need to check if the packet is ours. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif m->m_pkthdr.len = m->m_len = packetlen; diff --git a/sys/dev/ic/tropic.c b/sys/dev/ic/tropic.c index ad3433d60c4..db6c8554fde 100644 --- a/sys/dev/ic/tropic.c +++ b/sys/dev/ic/tropic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tropic.c,v 1.10 2005/11/07 03:20:00 brad Exp $ */ +/* $OpenBSD: tropic.c,v 1.11 2006/03/25 22:41:43 djm Exp $ */ /* $NetBSD: tropic.c,v 1.6 1999/12/17 08:26:31 fvdl Exp $ */ /* @@ -737,7 +737,7 @@ next: return; #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif first_txbuf = txbuf = TXCA_INW(sc, TXCA_FREE_QUEUE_HEAD) - XMIT_NEXTBUF; framedata = txbuf + XMIT_FP_DATA; @@ -1280,7 +1280,7 @@ struct tr_softc *sc; #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif token_input(ifp, m); } @@ -1349,7 +1349,7 @@ struct tr_softc *sc; if (m0 != 0) { #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* Pull packet off interface send queue, fill DHB. */ trh = mtod(m0, struct token_header *); diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index fb2b44bd7d7..cf6223078dd 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.71 2006/03/04 23:31:20 brad Exp $ */ +/* $OpenBSD: xl.c,v 1.72 2006/03/25 22:41:43 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1305,7 +1305,7 @@ again: * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) { - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); } #endif @@ -1839,7 +1839,8 @@ xl_start(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, cur_tx->xl_mbuf); + bpf_mtap(ifp->if_bpf, cur_tx->xl_mbuf, + BPF_DIRECTION_OUT); #endif } @@ -1961,7 +1962,8 @@ xl_start_90xB(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, cur_tx->xl_mbuf); + bpf_mtap(ifp->if_bpf, cur_tx->xl_mbuf, + BPF_DIRECTION_OUT); #endif XL_INC(idx, XL_TX_LIST_CNT); diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c index f33096edd26..9b65b34ac00 100644 --- a/sys/dev/isa/if_ed.c +++ b/sys/dev/isa/if_ed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ed.c,v 1.55 2005/04/03 10:20:47 brad Exp $ */ +/* $OpenBSD: if_ed.c,v 1.56 2006/03/25 22:41:44 djm Exp $ */ /* $NetBSD: if_ed.c,v 1.105 1996/10/21 22:40:45 thorpej Exp $ */ /* @@ -2001,7 +2001,7 @@ outloop: #if NBPFILTER > 0 /* Tap off here if there is a BPF listener. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* txb_new points to next open buffer slot. */ @@ -2543,7 +2543,7 @@ edread(sc, buf, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/isa/if_ef_isapnp.c b/sys/dev/isa/if_ef_isapnp.c index f0a49a8f8f5..046a917117d 100644 --- a/sys/dev/isa/if_ef_isapnp.c +++ b/sys/dev/isa/if_ef_isapnp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ef_isapnp.c,v 1.20 2005/11/21 18:16:40 millert Exp $ */ +/* $OpenBSD: if_ef_isapnp.c,v 1.21 2006/03/25 22:41:44 djm Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -279,7 +279,7 @@ startagain: #if NBPFILTER if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif IFQ_DEQUEUE(&ifp->if_snd, m0); @@ -740,7 +740,7 @@ efread(sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index 9ffc03ca0b9..c5b4376c726 100644 --- a/sys/dev/isa/if_eg.c +++ b/sys/dev/isa/if_eg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_eg.c,v 1.27 2005/11/21 18:16:40 millert Exp $ */ +/* $OpenBSD: if_eg.c,v 1.28 2006/03/25 22:41:44 djm Exp $ */ /* $NetBSD: if_eg.c,v 1.26 1996/05/12 23:52:27 mycroft Exp $ */ /* @@ -555,7 +555,7 @@ loop: #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif sc->eg_pcb[0] = EG_CMD_SENDPACKET; @@ -706,7 +706,7 @@ egread(sc, buf, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c index 65271079c57..8e4d0b7b599 100644 --- a/sys/dev/isa/if_el.c +++ b/sys/dev/isa/if_el.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_el.c,v 1.19 2004/05/12 06:35:11 tedu Exp $ */ +/* $OpenBSD: if_el.c,v 1.20 2006/03/25 22:41:44 djm Exp $ */ /* $NetBSD: if_el.c,v 1.39 1996/05/12 23:52:32 mycroft Exp $ */ /* @@ -325,7 +325,7 @@ elstart(ifp) #if NBPFILTER > 0 /* Give the packet to the bpf, if any. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* Disable the receiver. */ @@ -520,7 +520,7 @@ elread(sc, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/isa/if_ex.c b/sys/dev/isa/if_ex.c index ff2bdfb5217..15fa160c3b8 100644 --- a/sys/dev/isa/if_ex.c +++ b/sys/dev/isa/if_ex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ex.c,v 1.14 2005/11/09 05:46:21 brad Exp $ */ +/* $OpenBSD: if_ex.c,v 1.15 2006/03/25 22:41:44 djm Exp $ */ /* * Copyright (c) 1997, Donald A. Schmidt * Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es) @@ -543,7 +543,8 @@ ex_start(ifp) sc->tx_tail = next; #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, opkt); + bpf_mtap(ifp->if_bpf, opkt, + BPF_DIRECTION_OUT); #endif ifp->if_timer = 2; ifp->if_opackets++; @@ -752,7 +753,8 @@ ex_rx_intr(sc) #endif #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, ipkt); + bpf_mtap(ifp->if_bpf, ipkt, + BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, ipkt); ifp->if_ipackets++; diff --git a/sys/dev/isa/if_fe.c b/sys/dev/isa/if_fe.c index 8a0ed81a147..826f413ce87 100644 --- a/sys/dev/isa/if_fe.c +++ b/sys/dev/isa/if_fe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fe.c,v 1.24 2005/05/23 23:26:56 tedu Exp $ */ +/* $OpenBSD: if_fe.c,v 1.25 2006/03/25 22:41:44 djm Exp $ */ /* * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 @@ -1502,7 +1502,7 @@ fe_start(ifp) #if NBPFILTER > 0 /* Tap off here if there is a BPF listener. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -2055,7 +2055,7 @@ fe_get_packet(sc, len) * the raw packet to bpf. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/isa/if_hp.c b/sys/dev/isa/if_hp.c index e1cbd70790d..30487d2e7d6 100644 --- a/sys/dev/isa/if_hp.c +++ b/sys/dev/isa/if_hp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_hp.c,v 1.15 2005/11/21 18:16:40 millert Exp $ */ +/* $OpenBSD: if_hp.c,v 1.16 2006/03/25 22:41:44 djm Exp $ */ /* $NetBSD: if_hp.c,v 1.21 1995/12/24 02:31:31 mycroft Exp $ */ /* XXX THIS DRIVER IS BROKEN. IT WILL NOT EVEN COMPILE. */ @@ -531,7 +531,7 @@ hpstart(ifp) #if NBPFILTER > 0 if (ns->ns_bpf) - bpf_mtap(ns->ns_bpf, m); + bpf_mtap(ns->ns_bpf, m, BPF_DIRECTION_OUT); #endif for (m0 = m; m != 0;) { @@ -796,7 +796,8 @@ hpread(ns, buf, len) #if NBPFILTER > 0 if (ns->ns_bpf) - bpf_tap(ns->ns_bpf, buf, len + sizeof(struct ether_header)); + bpf_tap(ns->ns_bpf, buf, len + sizeof(struct ether_header), + BPF_DIRECTION_IN); #endif /* * Pull packet off interface. Off is nonzero if packet diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c index b91288d13dc..834ccca6789 100644 --- a/sys/dev/isa/if_ie.c +++ b/sys/dev/isa/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.31 2005/07/31 03:52:19 pascoe Exp $ */ +/* $OpenBSD: if_ie.c,v 1.32 2006/03/25 22:41:44 djm Exp $ */ /* $NetBSD: if_ie.c,v 1.51 1996/05/12 23:52:48 mycroft Exp $ */ /*- @@ -1195,7 +1195,8 @@ iexmit(sc) if (sc->sc_arpcom.ac_if.if_bpf) bpf_tap(sc->sc_arpcom.ac_if.if_bpf, sc->xmit_cbuffs[sc->xctail], - sc->xmit_buffs[sc->xctail]->ie_xmit_flags); + sc->xmit_buffs[sc->xctail]->ie_xmit_flags, + BPF_DIRECTION_OUT); #endif sc->xmit_buffs[sc->xctail]->ie_xmit_flags |= IE_XMIT_LAST; @@ -1395,7 +1396,7 @@ ie_readframe(sc, num) if (bpf_gets_it) { /* Pass it up. */ bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh, - sizeof(eh), m); + sizeof(eh), m, BPF_DIRECTION_IN); /* * A signal passed up from the filtering code indicating that @@ -1488,7 +1489,7 @@ iestart(ifp) #if NBPFILTER > 0 /* Tap off here if there is a BPF listener. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif #ifdef IEDEBUG diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index 9ff8419da63..c0ece2f292a 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bce.c,v 1.11 2006/02/24 00:57:49 brad Exp $ */ +/* $OpenBSD: if_bce.c,v 1.12 2006/03/25 22:41:44 djm Exp $ */ /* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */ /* @@ -654,7 +654,7 @@ bce_start(ifp) #if NBPFILTER > 0 /* Pass the packet to any BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* NBPFILTER > 0 */ } if (txsfree == 0) { @@ -853,7 +853,7 @@ bce_rxintr(sc) * pass it up the stack if it's for us. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* NBPFILTER > 0 */ /* Pass it on. */ diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 7cde80b0e5e..053b38aa2e6 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.137 2006/03/16 02:40:16 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.138 2006/03/25 22:41:44 djm Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2309,7 +2309,7 @@ bge_rxeof(struct bge_softc *sc) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif #ifdef BGE_CHECKSUM @@ -2838,7 +2838,7 @@ bge_start(struct ifnet *ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif } if (pkts == 0) diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index 9f24873cc93..5b459888505 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.87 2005/11/07 00:03:16 brad Exp $ */ +/* $OpenBSD: if_de.c,v 1.88 2006/03/25 22:41:44 djm Exp $ */ /* $NetBSD: if_de.c,v 1.58 1998/01/12 09:39:58 thorpej Exp $ */ /*- @@ -3322,10 +3322,11 @@ tulip_rx_intr( #if NBPFILTER > 0 if (sc->tulip_bpf != NULL) { - if (me == ms) - bpf_tap(sc->tulip_if.if_bpf, mtod(ms, caddr_t), total_len); - else - bpf_mtap(sc->tulip_if.if_bpf, ms); + if (me == ms) { + bpf_tap(sc->tulip_if.if_bpf, mtod(ms, caddr_t), + total_len, BPF_DIRECTION_IN); + } else + bpf_mtap(sc->tulip_if.if_bpf, ms, BPF_DIRECTION_IN); } #endif sc->tulip_flags |= TULIP_RXACT; @@ -3543,7 +3544,7 @@ tulip_tx_intr( sc->tulip_txmaps[sc->tulip_txmaps_free++] = map; #if NBPFILTER > 0 if (sc->tulip_bpf != NULL) - bpf_mtap(sc->tulip_if.if_bpf, m); + bpf_mtap(sc->tulip_if.if_bpf, m, BPF_DIRECTION_OUT); #endif m_freem(m); #if defined(TULIP_DEBUG) diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index bfc32d6267d..9272e58372d 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.109 2006/02/24 06:09:44 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.110 2006/03/25 22:41:44 djm Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -417,7 +417,7 @@ em_start(struct ifnet *ifp) #if NBPFILTER > 0 /* Send a copy of the frame to the BPF listener */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif /* Set timeout in case hardware has problems transmitting */ @@ -2425,7 +2425,7 @@ em_process_receive_interrupts(struct em_softc *sc, int count) * user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index d4e977bdb19..43e048c5f65 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.55 2006/02/26 19:14:39 damien Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.56 2006/03/25 22:41:45 djm Exp $ */ /*- * Copyright (c) 2004-2006 @@ -915,7 +915,7 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status, mb.m_len = sc->sc_rxtap_len; mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif @@ -1173,7 +1173,7 @@ ipw_tx_start(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni) mb.m_len = sc->sc_txtap_len; mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -1338,7 +1338,7 @@ ipw_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif m = ieee80211_encap(ifp, m, &ni); @@ -1347,7 +1347,7 @@ ipw_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m); + bpf_mtap(ic->ic_rawbpf, m, BPF_DIRECTION_OUT); #endif if (ipw_tx_start(ifp, m, ni) != 0) { diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index a81b2b6c057..11f00cd9e6c 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.60 2006/02/26 19:14:40 damien Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.61 2006/03/25 22:41:45 djm Exp $ */ /*- * Copyright (c) 2004-2006 @@ -877,7 +877,7 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_buf *buf, int i, mb.m_len = sc->sc_rxtap_len; mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif @@ -1145,7 +1145,7 @@ iwi_tx_start(struct ifnet *ifp, struct mbuf *m0, struct ieee80211_node *ni) mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -1276,7 +1276,7 @@ iwi_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif m0 = ieee80211_encap(ifp, m0, &ni); @@ -1285,7 +1285,7 @@ iwi_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, BPF_DIRECTION_OUT); #endif if (iwi_tx_start(ifp, m0, ni) != 0) { diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index 0477a19e103..c55909cb055 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.10 2006/03/05 01:13:37 brad Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.11 2006/03/25 22:41:45 djm Exp $ */ #include <dev/pci/if_ixgb.h> @@ -323,7 +323,7 @@ ixgb_start(struct ifnet *ifp) #if NBPFILTER > 0 /* Send a copy of the frame to the BPF listener */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif /* Set timeout in case hardware has problems transmitting */ @@ -1753,7 +1753,8 @@ ixgb_process_receive_interrupts(struct ixgb_softc *sc, int count) * user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, sc->fmp); + bpf_mtap(ifp->if_bpf, sc->fmp, + BPF_DIRECTION_IN); #endif ixgb_receive_checksum(sc, current_desc, diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index 540a03ea3ca..2ef5f4dd960 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.37 2006/03/20 16:15:03 brad Exp $ */ +/* $OpenBSD: if_lge.c,v 1.38 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -956,7 +956,7 @@ lge_rxeof(struct lge_softc *sc, int cnt) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Do IP checksum checking. */ @@ -1212,7 +1212,7 @@ lge_start(struct ifnet *ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif } if (pkts == 0) diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c index 86b02a7abf9..a3a570bbc8b 100644 --- a/sys/dev/pci/if_lmc.c +++ b/sys/dev/pci/if_lmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmc.c,v 1.21 2006/03/16 21:36:58 miod Exp $ */ +/* $OpenBSD: if_lmc.c,v 1.22 2006/03/25 22:41:45 djm Exp $ */ /* $NetBSD: if_lmc.c,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -616,9 +616,10 @@ lmc_rx_intr(lmc_softc_t * const sc) #if NBPFILTER > 0 if (sc->lmc_bpf != NULL) { if (me == ms) - LMC_BPF_TAP(sc, mtod(ms, caddr_t), total_len); + LMC_BPF_TAP(sc, mtod(ms, caddr_t), + total_len, BPF_DIRECTION_IN); else - LMC_BPF_MTAP(sc, ms); + LMC_BPF_MTAP(sc, ms, BPF_DIRECTION_IN); } #endif sc->lmc_flags |= LMC_RXACT; @@ -772,7 +773,7 @@ lmc_tx_intr(lmc_softc_t * const sc) sc->lmc_txmaps[sc->lmc_txmaps_free++] = map; #if NBPFILTER > 0 if (sc->lmc_bpf != NULL) - LMC_BPF_MTAP(sc, m); + LMC_BPF_MTAP(sc, m, BPF_DIRECTION_OUT); #endif m_freem(m); #if defined(LMC_DEBUG) diff --git a/sys/dev/pci/if_lmcvar.h b/sys/dev/pci/if_lmcvar.h index 812c4c976ea..7e9d2014251 100644 --- a/sys/dev/pci/if_lmcvar.h +++ b/sys/dev/pci/if_lmcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmcvar.h,v 1.9 2006/03/16 21:36:58 miod Exp $ */ +/* $OpenBSD: if_lmcvar.h,v 1.10 2006/03/25 22:41:45 djm Exp $ */ /* $NetBSD: if_lmcvar.h,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -544,8 +544,8 @@ extern struct cfdriver lmc_cd; * it does add yet more conditional code to this driver. Sigh. */ #if !defined(LMC_BPF_MTAP) && NBPFILTER > 0 -#define LMC_BPF_MTAP(sc, m) bpf_mtap((sc)->lmc_bpf, m) -#define LMC_BPF_TAP(sc, p, l) bpf_tap((sc)->lmc_bpf, p, l) +#define LMC_BPF_MTAP(sc, m, d) bpf_mtap((sc)->lmc_bpf, m, d) +#define LMC_BPF_TAP(sc, p, l, d) bpf_tap((sc)->lmc_bpf, p, l, d) #define LMC_BPF_ATTACH(sc) bpfattach(&(sc)->lmc_bpf, &(sc)->lmc_sppp.pp_if, DLT_PPP, PPP_HEADER_LEN) #endif diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index bec5ec4070c..00b9c8017f8 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.52 2006/03/02 09:04:00 jsg Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.53 2006/03/25 22:41:45 djm Exp $ */ /*- * Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr> @@ -753,7 +753,7 @@ nfe_rxeof(struct nfe_softc *sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ifp->if_ipackets++; ether_input_mbuf(ifp, m); @@ -979,7 +979,7 @@ nfe_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif } if (sc->txq.cur == old) /* nothing sent */ diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c index b42edce6139..8fcb70f4099 100644 --- a/sys/dev/pci/if_nge.c +++ b/sys/dev/pci/if_nge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nge.c,v 1.50 2006/03/04 04:40:57 brad Exp $ */ +/* $OpenBSD: if_nge.c,v 1.51 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -1340,7 +1340,7 @@ nge_rxeof(sc) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Do IP checksum checking. */ @@ -1699,7 +1699,7 @@ nge_start(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif } if (pkts == 0) diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index b0f9c907451..1b112af8961 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pcn.c,v 1.9 2006/03/19 02:50:54 brad Exp $ */ +/* $OpenBSD: if_pcn.c,v 1.10 2006/03/25 22:41:45 djm Exp $ */ /* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */ /* @@ -1009,7 +1009,7 @@ pcn_start(struct ifnet *ifp) #if NBPFILTER > 0 /* Pass the packet to any BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* NBPFILTER > 0 */ } @@ -1472,7 +1472,7 @@ pcn_rxintr(struct pcn_softc *sc) #if NBPFILTER > 0 /* Pass this up to any BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* NBPFILTER > 0 */ /* Pass it on. */ diff --git a/sys/dev/pci/if_san_obsd.c b/sys/dev/pci/if_san_obsd.c index 26ad019f8ff..f964df216f8 100644 --- a/sys/dev/pci/if_san_obsd.c +++ b/sys/dev/pci/if_san_obsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_obsd.c,v 1.10 2005/12/13 05:56:22 canacar Exp $ */ +/* $OpenBSD: if_san_obsd.c,v 1.11 2006/03/25 22:41:45 djm Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -186,7 +186,7 @@ wanpipe_generic_start(struct ifnet *ifp) /* report the packet to BPF if present and attached */ #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, opkt); + bpf_mtap(ifp->if_bpf, opkt, BPF_DIRECTION_OUT); #endif /* NBPFILTER > 0 */ if (wan_mbuf_to_buffer(&opkt)) { @@ -379,7 +379,7 @@ wanpipe_generic_input(struct ifnet *ifp, struct mbuf *m) m->m_pkthdr.rcvif = ifp; #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* NBPFILTER > 0 */ ifp->if_ipackets ++; sppp_input(ifp, m); diff --git a/sys/dev/pci/if_sf.c b/sys/dev/pci/if_sf.c index 289b3470ede..e7b87448301 100644 --- a/sys/dev/pci/if_sf.c +++ b/sys/dev/pci/if_sf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sf.c,v 1.35 2006/03/20 16:15:03 brad Exp $ */ +/* $OpenBSD: if_sf.c,v 1.36 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -867,7 +867,7 @@ void sf_rxeof(sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* pass it on. */ @@ -1240,7 +1240,8 @@ void sf_start(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, cur_tx->sf_mbuf); + bpf_mtap(ifp->if_bpf, cur_tx->sf_mbuf, + BPF_DIRECTION_OUT); #endif SF_INC(i, SF_TX_DLIST_CNT); diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 72d2747a734..b1369c59944 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.65 2006/03/25 20:09:17 brad Exp $ */ +/* $OpenBSD: if_sis.c,v 1.66 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -1351,7 +1351,7 @@ sis_rxeof(struct sis_softc *sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* pass it on. */ @@ -1614,7 +1614,7 @@ sis_start(struct ifnet *ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif } diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index b6c4b8289ee..3c5f1f74e31 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.95 2006/02/13 01:23:05 brad Exp $ */ +/* $OpenBSD: if_sk.c,v 1.96 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1800,7 +1800,7 @@ sk_start(struct ifnet *ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif } if (pkts == 0) @@ -1926,7 +1926,7 @@ sk_rxeof(struct sk_if_softc *sc_if) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* pass it on. */ diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index b339229cecc..ae7aa22e746 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.34 2005/11/07 02:57:45 brad Exp $ */ +/* $OpenBSD: if_ste.c,v 1.35 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -705,7 +705,7 @@ void ste_rxeof(sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* pass it on. */ @@ -1499,7 +1499,8 @@ void ste_start(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, cur_tx->ste_mbuf); + bpf_mtap(ifp->if_bpf, cur_tx->ste_mbuf, + BPF_DIRECTION_OUT); #endif STE_INC(idx, STE_TX_LIST_CNT); diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c index 53e767c4ff8..c40416d5f9c 100644 --- a/sys/dev/pci/if_stge.c +++ b/sys/dev/pci/if_stge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_stge.c,v 1.22 2005/09/11 18:17:08 mickey Exp $ */ +/* $OpenBSD: if_stge.c,v 1.23 2006/03/25 22:41:45 djm Exp $ */ /* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */ /*- @@ -799,7 +799,7 @@ stge_start(struct ifnet *ifp) * Pass the packet to any BPF listeners. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* NBPFILTER > 0 */ } @@ -1234,7 +1234,7 @@ stge_rxintr(struct stge_softc *sc) * pass if up the stack if it's for us. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* NBPFILTER > 0 */ /* Pass it on. */ diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index 3150672c1d7..dcb333b74c2 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.78 2006/03/16 02:32:37 brad Exp $ */ +/* $OpenBSD: if_ti.c,v 1.79 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1816,7 +1816,7 @@ ti_rxeof(struct ti_softc *sc) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) @@ -2205,7 +2205,7 @@ ti_start(struct ifnet *ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif } if (pkts == 0) diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index 7ccc3ac1d92..6aadabe336d 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tl.c,v 1.39 2006/03/20 16:15:03 brad Exp $ */ +/* $OpenBSD: if_tl.c,v 1.40 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1166,7 +1166,7 @@ int tl_intvec_rxeof(xsc, type) * since it can be used again later. */ if (ifp->if_bpf) { - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); } #endif /* pass it on. */ @@ -1595,7 +1595,8 @@ void tl_start(ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, cur_tx->tl_mbuf); + bpf_mtap(ifp->if_bpf, cur_tx->tl_mbuf, + BPF_DIRECTION_OUT); #endif } diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index faa336966e8..ce0e23be18a 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.79 2006/02/16 21:02:34 brad Exp $ */ +/* $OpenBSD: if_txp.c,v 1.80 2006/03/25 22:41:45 djm Exp $ */ /* * Copyright (c) 2001 @@ -734,7 +734,7 @@ txp_rx_reclaim(sc, r, dma) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif if (rxd->rx_stat & htole32(RX_STAT_IPCKSUMBAD)) @@ -1521,7 +1521,7 @@ txp_start(ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif txd->tx_flags |= TX_FLAGS_VALID; diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 0fbb06d8d33..39852eed325 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.19 2006/03/20 16:15:03 brad Exp $ */ +/* $OpenBSD: if_vge.c,v 1.20 2006/03/25 22:41:46 djm Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1110,7 +1110,7 @@ vge_rxeof(struct vge_softc *sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); @@ -1435,7 +1435,7 @@ vge_start(struct ifnet *ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif if (vge_encap(sc, m_head, idx)) { diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c index 2a4b5d8260a..6e0076f4cee 100644 --- a/sys/dev/pci/if_vic.c +++ b/sys/dev/pci/if_vic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vic.c,v 1.5 2006/03/04 03:33:05 brad Exp $ */ +/* $OpenBSD: if_vic.c,v 1.6 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org> @@ -351,7 +351,7 @@ vic_rx_proc(struct vic_softc *sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); @@ -502,7 +502,7 @@ vic_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif if ((error = vic_tx_start(sc, m)) != 0) diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 548b3446fee..25c331e20ee 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.60 2006/03/20 16:15:03 brad Exp $ */ +/* $OpenBSD: if_vr.c,v 1.61 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1022,7 +1022,7 @@ vr_rxeof(struct vr_softc *sc) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_IN); #endif /* pass it on. */ ether_input_mbuf(ifp, m0); @@ -1345,7 +1345,8 @@ vr_start(struct ifnet *ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, cur_tx->vr_mbuf); + bpf_mtap(ifp->if_bpf, cur_tx->vr_mbuf, + BPF_DIRECTION_OUT); #endif cur_tx = cur_tx->vr_nextdesc; } diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 995e27e97ac..6fcdd2a6ff3 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.33 2006/03/20 16:15:03 brad Exp $ */ +/* $OpenBSD: if_wb.c,v 1.34 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1068,7 +1068,7 @@ void wb_rxeof(sc) * Handle BPF listeners. Let the BPF user see the packet. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* pass it on. */ ether_input_mbuf(ifp, m); @@ -1411,7 +1411,8 @@ void wb_start(ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, cur_tx->wb_mbuf); + bpf_mtap(ifp->if_bpf, cur_tx->wb_mbuf, + BPF_DIRECTION_OUT); #endif } diff --git a/sys/dev/pci/musycc.c b/sys/dev/pci/musycc.c index a2d0ad2dc19..d347381afa0 100644 --- a/sys/dev/pci/musycc.c +++ b/sys/dev/pci/musycc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: musycc.c,v 1.14 2006/01/27 13:57:03 claudio Exp $ */ +/* $OpenBSD: musycc.c,v 1.15 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 2004,2005 Internet Business Solutions AG, Zurich, Switzerland @@ -1103,7 +1103,7 @@ musycc_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* now we are committed to transmit the packet */ @@ -1213,7 +1213,7 @@ musycc_rxeom(struct musycc_group *mg, int channel, int forcekick) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* pass it on. */ diff --git a/sys/dev/pcmcia/if_cnw.c b/sys/dev/pcmcia/if_cnw.c index fdf7b662f8f..aa92f42f7b2 100644 --- a/sys/dev/pcmcia/if_cnw.c +++ b/sys/dev/pcmcia/if_cnw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnw.c,v 1.15 2005/01/27 17:04:55 millert Exp $ */ +/* $OpenBSD: if_cnw.c,v 1.16 2006/03/25 22:41:46 djm Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -477,7 +477,7 @@ cnw_start(ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif cnw_transmit(sc, m0); @@ -667,7 +667,7 @@ cnw_recv(sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* diff --git a/sys/dev/pcmcia/if_ray.c b/sys/dev/pcmcia/if_ray.c index 64364139125..1f7acae9c00 100644 --- a/sys/dev/pcmcia/if_ray.c +++ b/sys/dev/pcmcia/if_ray.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ray.c,v 1.30 2005/11/23 11:39:37 mickey Exp $ */ +/* $OpenBSD: if_ray.c,v 1.31 2006/03/25 22:41:46 djm Exp $ */ /* $NetBSD: if_ray.c,v 1.21 2000/07/05 02:35:54 onoe Exp $ */ /* @@ -1342,7 +1342,7 @@ ray_intr_start(sc) m0->m_len -= sizeof(struct ieee80211_frame); m0->m_pkthdr.len -= sizeof(struct ieee80211_frame); } - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); if (ifp->if_flags & IFF_LINK0) { m0->m_data -= sizeof(struct ieee80211_frame); m0->m_len += sizeof(struct ieee80211_frame); @@ -1633,7 +1633,7 @@ done: m_adj(m, (caddr_t)eh - (caddr_t)frame); #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ifp->if_ipackets++; diff --git a/sys/dev/pcmcia/if_xe.c b/sys/dev/pcmcia/if_xe.c index b1c0514df72..ab00415a002 100644 --- a/sys/dev/pcmcia/if_xe.c +++ b/sys/dev/pcmcia/if_xe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xe.c,v 1.31 2005/11/23 11:39:37 mickey Exp $ */ +/* $OpenBSD: if_xe.c,v 1.32 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas @@ -837,7 +837,7 @@ xe_get(sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, top); + bpf_mtap(ifp->if_bpf, top, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, top); @@ -1133,7 +1133,7 @@ xe_start(ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif /* diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index 09b700c5e92..3a2f7114daf 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.17 2005/06/08 17:03:01 henning Exp $ */ +/* $OpenBSD: be.c,v 1.18 2006/03/25 22:41:46 djm Exp $ */ /* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */ /*- @@ -571,7 +571,7 @@ be_read(struct be_softc *sc, int idx, int len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass the packet up. */ ether_input_mbuf(ifp, m); @@ -611,7 +611,7 @@ bestart(struct ifnet *ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index 0af3e693729..2bbca6fcd85 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.17 2005/06/08 17:03:01 henning Exp $ */ +/* $OpenBSD: qe.c,v 1.18 2006/03/25 22:41:46 djm Exp $ */ /* $NetBSD: qe.c,v 1.16 2001/03/30 17:30:18 christos Exp $ */ /*- @@ -442,7 +442,7 @@ qe_read(sc, idx, len) * If so, hand off the raw packet to BPF. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* Pass the packet up. */ ether_input_mbuf(ifp, m); @@ -485,7 +485,7 @@ qestart(ifp) * packet before we commit it to the wire. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index 3b0c96cebd1..4f98057d1aa 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.68 2006/02/20 20:12:14 damien Exp $ */ +/* $OpenBSD: if_atu.c,v 1.69 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -1748,7 +1748,7 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) mb.m_len = sizeof(sc->sc_txtapu); mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_radiobpf, &mb); + bpf_mtap(sc->sc_radiobpf, &mb, BPF_DIRECTION_IN); } #endif /* NPBFILTER > 0 */ @@ -1871,7 +1871,7 @@ atu_tx_start(struct atu_softc *sc, struct ieee80211_node *ni, mb.m_len = sizeof(sc->sc_txtapu); mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_radiobpf, &mb); + bpf_mtap(sc->sc_radiobpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -1992,7 +1992,7 @@ atu_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif m = ieee80211_encap(ifp, m, &ni); @@ -2002,7 +2002,7 @@ atu_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m); + bpf_mtap(ic->ic_rawbpf, m, BPF_DIRECTION_OUT); #endif } else { DPRINTFN(25, ("%s: atu_start: mgmt packet\n", diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 207503e0e42..2b33a46339d 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aue.c,v 1.44 2006/03/07 04:41:19 krw Exp $ */ +/* $OpenBSD: if_aue.c,v 1.45 2006/03/25 22:41:46 djm Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -106,8 +106,6 @@ #include <net/if_dl.h> #include <net/if_media.h> -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) - #if NBPFILTER > 0 #include <net/bpf.h> #endif @@ -1142,7 +1140,7 @@ aue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) * address or the interface is in promiscuous mode. */ if (ifp->if_bpf) - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->aue_dev), @@ -1349,7 +1347,7 @@ aue_start(struct ifnet *ifp) * to him. */ if (ifp->if_bpf) - BPF_MTAP(ifp, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 655192b1519..ca15d7b6f8d 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_axe.c,v 1.46 2006/03/07 04:41:19 krw Exp $ */ +/* $OpenBSD: if_axe.c,v 1.47 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 @@ -103,8 +103,6 @@ #include <net/if_dl.h> #include <net/if_media.h> -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) - #if NBPFILTER > 0 #include <net/bpf.h> #endif @@ -990,7 +988,7 @@ axe_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) s = splnet(); #if NBPFILTER > 0 if (ifp->if_bpf) - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif IF_INPUT(ifp, m); @@ -1206,7 +1204,7 @@ axe_start(struct ifnet *ifp) */ #if NBPFILTER > 0 if (ifp->if_bpf) - BPF_MTAP(ifp, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index faeccc80e9e..7ece38588a4 100644 --- a/sys/dev/usb/if_cdce.c +++ b/sys/dev/usb/if_cdce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cdce.c,v 1.15 2006/03/24 13:50:14 dlg Exp $ */ +/* $OpenBSD: if_cdce.c,v 1.16 2006/03/25 22:41:46 djm Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -57,7 +57,6 @@ #include <net/bpf.h> #if NBPFILTER > 0 -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) #endif #include <netinet/in.h> @@ -301,7 +300,7 @@ cdce_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - BPF_MTAP(ifp, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; @@ -663,7 +662,7 @@ cdce_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) #if NBPFILTER > 0 if (ifp->if_bpf) - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif IF_INPUT(ifp, m); diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index b96bc008085..5e36c6cc19f 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cue.c,v 1.29 2006/03/07 04:41:19 krw Exp $ */ +/* $OpenBSD: if_cue.c,v 1.30 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -84,8 +84,6 @@ #endif #include <net/if_dl.h> -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) - #if NBPFILTER > 0 #include <net/bpf.h> #endif @@ -805,7 +803,7 @@ cue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) * address or the interface is in promiscuous mode. */ if (ifp->if_bpf) - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->cue_dev), @@ -986,7 +984,7 @@ cue_start(struct ifnet *ifp) * to him. */ if (ifp->if_bpf) - BPF_MTAP(ifp, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 0893de73250..2fdc2160498 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_kue.c,v 1.40 2006/03/07 04:41:19 krw Exp $ */ +/* $OpenBSD: if_kue.c,v 1.41 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -803,7 +803,7 @@ kue_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) * address or the interface is in promiscuous mode. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->kue_dev), @@ -948,7 +948,7 @@ kue_start(struct ifnet *ifp) * to him. */ if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 6a9311e000b..ddb7f385887 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.66 2006/03/21 11:19:22 pedro Exp $ */ +/* $OpenBSD: if_ral.c,v 1.67 2006/03/25 22:41:47 djm Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -962,7 +962,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) mb.m_len = sc->sc_rxtap_len; mb.m_next = m; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif @@ -1258,7 +1258,7 @@ ural_tx_mgt(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -1358,7 +1358,7 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) mb.m_len = sc->sc_txtap_len; mb.m_next = m0; mb.m_pkthdr.len += mb.m_len; - bpf_mtap(sc->sc_drvbpf, &mb); + bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif @@ -1420,7 +1420,7 @@ ural_start(struct ifnet *ifp) m0->m_pkthdr.rcvif = NULL; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, BPF_DIRECTION_OUT); #endif if (ural_tx_mgt(sc, m0, ni) != 0) break; @@ -1439,14 +1439,14 @@ ural_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif m0 = ieee80211_encap(ifp, m0, &ni); if (m0 == NULL) continue; #if NBPFILTER > 0 if (ic->ic_rawbpf != NULL) - bpf_mtap(ic->ic_rawbpf, m0); + bpf_mtap(ic->ic_rawbpf, m0, BPF_DIRECTION_OUT); #endif if (ural_tx_data(sc, m0, ni) != 0) { if (ni != NULL) diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index 0e166f11b30..882cfe31b25 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_udav.c,v 1.16 2006/03/07 04:41:19 krw Exp $ */ +/* $OpenBSD: if_udav.c,v 1.17 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_udav.c,v 1.3 2004/04/23 17:25:25 itojun Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* @@ -66,7 +66,6 @@ #if NBPFILTER > 0 #include <net/bpf.h> #endif -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) #ifdef INET #include <netinet/in.h> @@ -982,7 +981,7 @@ udav_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; @@ -1161,7 +1160,7 @@ udav_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) #if NBPFILTER > 0 if (ifp->if_bpf) - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif DPRINTF(("%s: %s: deliver %d\n", USBDEVNAME(sc->sc_dev), diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index 540d3af9698..db109275a25 100644 --- a/sys/dev/usb/if_upl.c +++ b/sys/dev/usb/if_upl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upl.c,v 1.23 2006/03/07 04:41:19 krw Exp $ */ +/* $OpenBSD: if_upl.c,v 1.24 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -69,8 +69,6 @@ #include <net/if_dl.h> #include <net/netisr.h> -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) - #if NBPFILTER > 0 #include <net/bpf.h> #endif @@ -558,7 +556,7 @@ upl_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) * address or the interface is in promiscuous mode. */ if (ifp->if_bpf) { - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); } #endif @@ -705,7 +703,7 @@ upl_start(struct ifnet *ifp) * to him. */ if (ifp->if_bpf) - BPF_MTAP(ifp, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index 02aa5d4bebe..19a22eef9a4 100644 --- a/sys/dev/usb/if_url.c +++ b/sys/dev/usb/if_url.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_url.c,v 1.30 2006/03/07 04:41:19 krw Exp $ */ +/* $OpenBSD: if_url.c,v 1.31 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_url.c,v 1.6 2002/09/29 10:19:21 martin Exp $ */ /* * Copyright (c) 2001, 2002 @@ -71,7 +71,6 @@ #if NBPFILTER > 0 #include <net/bpf.h> #endif -#define BPF_MTAP(ifp, m) bpf_mtap((ifp)->if_bpf, (m)) #if defined(__NetBSD__) #include <net/if_ether.h> @@ -904,7 +903,7 @@ url_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT); #endif ifp->if_flags |= IFF_OACTIVE; @@ -1080,7 +1079,7 @@ url_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) #if NBPFILTER > 0 if (ifp->if_bpf) - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif DPRINTF(("%s: %s: deliver %d\n", USBDEVNAME(sc->sc_dev), diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c index 75d4e1fa10c..09fc623053d 100644 --- a/sys/dev/usb/ueagle.c +++ b/sys/dev/usb/ueagle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ueagle.c,v 1.9 2006/01/29 03:22:52 brad Exp $ */ +/* $OpenBSD: ueagle.c,v 1.10 2006/03/25 22:41:47 djm Exp $ */ /*- * Copyright (c) 2003-2005 @@ -875,7 +875,7 @@ ueagle_push_cell(struct ueagle_softc *sc, uint8_t *cell) #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif /* send the AAL5 CPCS-PDU to the ATM layer */ @@ -1088,7 +1088,7 @@ ueagle_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf != NULL) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif m_freem(m0); diff --git a/sys/net/bpf.c b/sys/net/bpf.c index b8c3447a68c..20d609edff4 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.61 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: bpf.c,v 1.62 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -630,6 +630,7 @@ bpfioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) case BIOCSRTIMEOUT: case BIOCIMMEDIATE: case TIOCGPGRP: + case BIOCGDIRFILT: break; default: return (EPERM); @@ -847,6 +848,15 @@ bpfioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) d->bd_fildrop = *(u_int *)addr ? 1 : 0; break; + case BIOCGDIRFILT: /* get direction filter */ + *(u_int *)addr = d->bd_dirfilt; + break; + + case BIOCSDIRFILT: /* set direction filter */ + d->bd_dirfilt = (*(u_int *)addr) & + (BPF_DIRECTION_IN|BPF_DIRECTION_OUT); + break; + case FIONBIO: /* Non-blocking I/O */ if (*(int *)addr) d->bd_rtout = -1; @@ -1104,7 +1114,7 @@ filt_bpfread(struct knote *kn, long hint) * buffer. */ int -bpf_tap(caddr_t arg, u_char *pkt, u_int pktlen) +bpf_tap(caddr_t arg, u_char *pkt, u_int pktlen, u_int direction) { struct bpf_if *bp; struct bpf_d *d; @@ -1119,7 +1129,10 @@ bpf_tap(caddr_t arg, u_char *pkt, u_int pktlen) bp = (struct bpf_if *)arg; for (d = bp->bif_dlist; d != 0; d = d->bd_next) { ++d->bd_rcount; - slen = bpf_filter(d->bd_rfilter, pkt, pktlen, pktlen); + if ((direction & d->bd_dirfilt) != 0) + slen = 0; + else + slen = bpf_filter(d->bd_rfilter, pkt, pktlen, pktlen); if (slen != 0) { bpf_catchpacket(d, pkt, pktlen, slen, bcopy); if (d->bd_fildrop) @@ -1158,7 +1171,7 @@ bpf_mcopy(const void *src_arg, void *dst_arg, size_t len) * Incoming linkage from device drivers, when packet is in an mbuf chain. */ void -bpf_mtap(caddr_t arg, struct mbuf *m) +bpf_mtap(caddr_t arg, struct mbuf *m, u_int direction) { struct bpf_if *bp = (struct bpf_if *)arg; struct bpf_d *d; @@ -1174,7 +1187,11 @@ bpf_mtap(caddr_t arg, struct mbuf *m) for (d = bp->bif_dlist; d != 0; d = d->bd_next) { ++d->bd_rcount; - slen = bpf_filter(d->bd_rfilter, (u_char *)m, pktlen, 0); + if ((direction & d->bd_dirfilt) != 0) + slen = 0; + else + slen = bpf_filter(d->bd_rfilter, (u_char *)m, + pktlen, 0); if (slen == 0) continue; @@ -1195,7 +1212,8 @@ bpf_mtap(caddr_t arg, struct mbuf *m) * it or keep a pointer to it. */ void -bpf_mtap_hdr(caddr_t arg, caddr_t data, u_int dlen, struct mbuf *m) +bpf_mtap_hdr(caddr_t arg, caddr_t data, u_int dlen, struct mbuf *m, + u_int direction) { struct m_hdr mh; @@ -1204,7 +1222,7 @@ bpf_mtap_hdr(caddr_t arg, caddr_t data, u_int dlen, struct mbuf *m) mh.mh_len = dlen; mh.mh_data = data; - bpf_mtap(arg, (struct mbuf *) &mh); + bpf_mtap(arg, (struct mbuf *) &mh, direction); m->m_flags |= mh.mh_flags & M_FILDROP; } @@ -1218,7 +1236,7 @@ bpf_mtap_hdr(caddr_t arg, caddr_t data, u_int dlen, struct mbuf *m) * it or keep a pointer to it. */ void -bpf_mtap_af(caddr_t arg, u_int32_t af, struct mbuf *m) +bpf_mtap_af(caddr_t arg, u_int32_t af, struct mbuf *m, u_int direction) { struct m_hdr mh; @@ -1227,7 +1245,7 @@ bpf_mtap_af(caddr_t arg, u_int32_t af, struct mbuf *m) mh.mh_len = 4; mh.mh_data = (caddr_t)⁡ - bpf_mtap(arg, (struct mbuf *) &mh); + bpf_mtap(arg, (struct mbuf *) &mh, direction); m->m_flags |= mh.mh_flags & M_FILDROP; } diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 3a435af6ed4..1b19c30a46f 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.h,v 1.32 2005/11/03 20:00:18 reyk Exp $ */ +/* $OpenBSD: bpf.h,v 1.33 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */ /* @@ -117,6 +117,14 @@ struct bpf_version { #define BIOCSFILDROP _IOW('B',121, u_int) #define BIOCSDLT _IOW('B',122, u_int) #define BIOCGDLTLIST _IOWR('B',123, struct bpf_dltlist) +#define BIOCGDIRFILT _IOR('B',124, u_int) +#define BIOCSDIRFILT _IOW('B',125, u_int) + +/* + * Direction filters for BIOCSDIRFILT/BIOCGDIRFILT + */ +#define BPF_DIRECTION_IN 1 +#define BPF_DIRECTION_OUT (1<<1) struct bpf_timeval { u_int32_t tv_sec; @@ -260,10 +268,10 @@ struct bpf_dltlist { #ifdef _KERNEL int bpf_validate(struct bpf_insn *, int); -int bpf_tap(caddr_t, u_char *, u_int); -void bpf_mtap(caddr_t, struct mbuf *); -void bpf_mtap_hdr(caddr_t, caddr_t, u_int, struct mbuf *); -void bpf_mtap_af(caddr_t, u_int32_t, struct mbuf *); +int bpf_tap(caddr_t, u_char *, u_int, u_int); +void bpf_mtap(caddr_t, struct mbuf *, u_int); +void bpf_mtap_hdr(caddr_t, caddr_t, u_int, struct mbuf *, u_int); +void bpf_mtap_af(caddr_t, u_int32_t, struct mbuf *, u_int); void bpfattach(caddr_t *, struct ifnet *, u_int, u_int); void bpfdetach(struct ifnet *); void bpfilterattach(int); diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h index b077f085ca0..a98f2f0f012 100644 --- a/sys/net/bpfdesc.h +++ b/sys/net/bpfdesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpfdesc.h,v 1.16 2005/11/21 18:16:45 millert Exp $ */ +/* $OpenBSD: bpfdesc.h,v 1.17 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */ /* @@ -77,6 +77,7 @@ struct bpf_d { u_char bd_immediate; /* true to return on packet arrival */ u_char bd_locked; /* true if descriptor is locked */ u_char bd_fildrop; /* true if filtered packets will be dropped */ + u_char bd_dirfilt; /* direction filter */ int bd_hdrcmplt; /* false to fill in src lladdr automatically */ int bd_async; /* non-zero if packet reception should generate signal */ int bd_sig; /* signal to send upon packet reception */ diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 0a74a12de73..402310ce684 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.150 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.151 2006/03/25 22:41:47 djm Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -1144,7 +1144,7 @@ bridgeintr_frame(struct bridge_softc *sc, struct mbuf *m) #if NBPFILTER > 0 if (sc->sc_if.if_bpf) - bpf_mtap(sc->sc_if.if_bpf, m); + bpf_mtap(sc->sc_if.if_bpf, m, BPF_DIRECTION_IN); #endif sc->sc_if.if_ipackets++; diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index e61a9b191ef..cf73950da1e 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_faith.c,v 1.21 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_faith.c,v 1.22 2006/03/25 22:41:47 djm Exp $ */ /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. @@ -149,7 +149,7 @@ faithoutput(ifp, m, dst, rt) } if (ifp->if_bpf) - bpf_mtap_af(ifp->if_bpf, dst->sa_family, m); + bpf_mtap_af(ifp->if_bpf, dst->sa_family, m, BPF_DIRECTION_OUT); #endif if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) { diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index cf74f68ca26..32d4d817864 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.35 2006/03/11 03:58:37 brad Exp $ */ +/* $OpenBSD: if_gif.c,v 1.36 2006/03/25 22:41:47 djm Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -230,7 +230,7 @@ gif_output(ifp, m, dst, rt) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap_af(ifp->if_bpf, dst->sa_family, m); + bpf_mtap_af(ifp->if_bpf, dst->sa_family, m, BPF_DIRECTION_OUT); #endif ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index cf2a24a0c80..66af9942c6d 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.39 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_gre.c,v 1.40 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -233,7 +233,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, #if NBPFILTER >0 if (ifp->if_bpf) - bpf_mtap_af(ifp->if_bpf, dst->sa_family, m); + bpf_mtap_af(ifp->if_bpf, dst->sa_family, m, BPF_DIRECTION_OUT); #endif if (sc->g_proto == IPPROTO_MOBILE) { diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 59c4f3d4922..84cf8471e84 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.39 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_loop.c,v 1.40 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -248,7 +248,8 @@ looutput(ifp, m, dst, rt) * packets for local use. But don't dup them to bpf. */ if (ifp->if_bpf && (ifp->if_flags & IFF_LOOPBACK)) - bpf_mtap_af(ifp->if_bpf, htonl(dst->sa_family), m); + bpf_mtap_af(ifp->if_bpf, htonl(dst->sa_family), m, + BPF_DIRECTION_OUT); #endif m->m_pkthdr.rcvif = ifp; diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c index ee11c042de8..e25eb25873f 100644 --- a/sys/net/if_pflog.c +++ b/sys/net/if_pflog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflog.c,v 1.16 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_pflog.c,v 1.17 2006/03/25 22:41:47 djm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -228,7 +228,8 @@ pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, } #endif /* INET */ - bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, PFLOG_HDRLEN, m); + bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, PFLOG_HDRLEN, m, + BPF_DIRECTION_OUT); #endif return (0); diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 67ed402a2b1..3c9e1107c73 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.61 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.62 2006/03/25 22:41:47 djm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -1453,7 +1453,7 @@ pfsync_sendout(struct pfsync_softc *sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif if (sc->sc_mbuf_net) { @@ -1484,7 +1484,7 @@ pfsync_tdb_sendout(struct pfsync_softc *sc) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif return pfsync_sendout_mbuf(sc, m); diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 3330cff27fc..87c873148a2 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.45 2006/03/12 00:18:07 brad Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.46 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -841,7 +841,7 @@ pppoutput(ifp, m0, dst, rtp) * See if bpf wants to look at the packet. */ if (sc->sc_bpf) - bpf_mtap(sc->sc_bpf, m0); + bpf_mtap(sc->sc_bpf, m0, BPF_DIRECTION_OUT); #endif /* @@ -1506,7 +1506,7 @@ ppp_inproc(sc, m) #if NBPFILTER > 0 /* See if bpf wants to look at the packet. */ if (sc->sc_bpf) - bpf_mtap(sc->sc_bpf, m); + bpf_mtap(sc->sc_bpf, m, BPF_DIRECTION_IN); #endif rv = 0; diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index 413e8082dfe..0ca6dbe3c33 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppoe.c,v 1.7 2006/03/04 22:40:15 brad Exp $ */ +/* $OpenBSD: if_pppoe.c,v 1.8 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */ /* @@ -769,7 +769,7 @@ pppoe_data_input(struct mbuf *m) #if NBPFILTER > 0 if(sc->sc_sppp.pp_if.if_bpf) - bpf_mtap(sc->sc_sppp.pp_if.if_bpf, m); + bpf_mtap(sc->sc_sppp.pp_if.if_bpf, m, BPF_DIRECTION_IN); #endif m_adj(m, PPPOE_HEADERLEN); @@ -1433,7 +1433,8 @@ pppoe_start(struct ifnet *ifp) #if NBPFILTER > 0 if(sc->sc_sppp.pp_if.if_bpf) - bpf_mtap(sc->sc_sppp.pp_if.if_bpf, m); + bpf_mtap(sc->sc_sppp.pp_if.if_bpf, m, + BPF_DIRECTION_OUT); #endif pppoe_output(sc, m); diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 7e4e02e6221..d8ca585064a 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sl.c,v 1.31 2006/03/11 22:44:47 brad Exp $ */ +/* $OpenBSD: if_sl.c,v 1.32 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */ /* @@ -580,7 +580,8 @@ slstart(tp) */ bpfbuf[SLX_DIR] = SLIPDIR_OUT; bcopy(mtod(m, caddr_t), &bpfbuf[SLX_CHDR], CHDR_LEN); - bpf_tap(sc->sc_bpf, bpfbuf, len + SLIP_HDRLEN); + bpf_tap(sc->sc_bpf, bpfbuf, len + SLIP_HDRLEN, + BPF_DIRECTION_OUT); } #endif getmicrotime(&sc->sc_lastpacket); @@ -866,7 +867,7 @@ slinput(c, tp) memcpy(&hp[SLX_CHDR], chdr, CHDR_LEN); s = splnet(); - bpf_mtap(sc->sc_bpf, m); + bpf_mtap(sc->sc_bpf, m, BPF_DIRECTION_IN); splx(s); m_adj(m, SLIP_HDRLEN); diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c index 75e3038d7a2..7fc7024046f 100644 --- a/sys/net/if_strip.c +++ b/sys/net/if_strip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_strip.c,v 1.31 2006/03/11 22:44:47 brad Exp $ */ +/* $OpenBSD: if_strip.c,v 1.32 2006/03/25 22:41:47 djm Exp $ */ /* $NetBSD: if_strip.c,v 1.2.4.3 1996/08/03 00:58:32 jtc Exp $ */ /* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */ @@ -1000,7 +1000,8 @@ stripstart(tp) cp[SLX_DIR] = SLIPDIR_OUT; bcopy(mtod(m, caddr_t)+STRIP_HDRLEN, &cp[SLX_CHDR], CHDR_LEN); - bpf_tap(sc->sc_bpf, cp, len + SLIP_HDRLEN); + bpf_tap(sc->sc_bpf, cp, len + SLIP_HDRLEN, + BPF_DIRECTION_OUT); } #endif getmicrotime(&sc->sc_lastpacket); @@ -1252,7 +1253,7 @@ stripinput(c, tp) hp[SLX_DIR] = SLIPDIR_IN; bcopy(chdr, &hp[SLX_CHDR], CHDR_LEN); - bpf_tap(sc->sc_bpf, hp, len + SLIP_HDRLEN); + bpf_tap(sc->sc_bpf, hp, len + SLIP_HDRLEN, BPF_DIRECTION_IN); } #endif m = strip_btom(sc, len); diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 09c042ba43f..3b6c97e6106 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.22 2006/03/11 03:12:36 brad Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.23 2006/03/25 22:41:47 djm Exp $ */ /* * Copyright (c) 2005 Reyk Floeter <reyk@openbsd.org> @@ -874,7 +874,7 @@ trunk_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif if (tr->tr_proto != TRUNK_PROTO_NONE) @@ -931,7 +931,8 @@ trunk_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m) #if NBPFILTER > 0 if (trifp->if_bpf) - bpf_mtap_hdr(trifp->if_bpf, (char *)eh, ETHER_HDR_LEN, m); + bpf_mtap_hdr(trifp->if_bpf, (char *)eh, ETHER_HDR_LEN, m, + BPF_DIRECTION_IN); #endif trifp->if_ipackets++; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 9ce9528390a..a11b0e8ada0 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.78 2006/03/20 10:03:49 henning Exp $ */ +/* $OpenBSD: if_tun.c,v 1.79 2006/03/25 22:41:48 djm Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -581,7 +581,7 @@ tun_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m0); + bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT); #endif len = m0->m_pkthdr.len + sizeof(*af); @@ -870,7 +870,7 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, top); + bpf_mtap(ifp->if_bpf, top, BPF_DIRECTION_IN); #endif if (tp->tun_flags & TUN_LAYER2) { @@ -1118,7 +1118,7 @@ tunstart(struct ifnet *ifp) if (tp->tun_flags & TUN_LAYER2) { #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif ifp->if_opackets++; } diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index cbece492c66..739dcbef0c2 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.64 2006/03/04 22:40:16 brad Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.65 2006/03/25 22:41:48 djm Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -201,7 +201,7 @@ vlan_start(struct ifnet *ifp) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT); #endif /* @@ -315,7 +315,8 @@ vlan_input(eh, m) #if NBPFILTER > 0 if (ifv->ifv_if.if_bpf) - bpf_mtap_hdr(ifv->ifv_if.if_bpf, (char *)eh, ETHER_HDR_LEN, m); + bpf_mtap_hdr(ifv->ifv_if.if_bpf, (char *)eh, ETHER_HDR_LEN, + m, BPF_DIRECTION_IN); #endif ifv->ifv_if.if_ipackets++; ether_input(&ifv->ifv_if, eh, m); diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index d2838bfc3df..53f5889af89 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,5 +1,5 @@ /* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */ -/* $OpenBSD: ieee80211_input.c,v 1.14 2006/01/11 00:18:17 millert Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.15 2006/03/25 22:41:48 djm Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe @@ -302,7 +302,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, #if NBPFILTER > 0 /* copy to listener after decrypt */ if (ic->ic_rawbpf) - bpf_mtap(ic->ic_rawbpf, m); + bpf_mtap(ic->ic_rawbpf, m, BPF_DIRECTION_IN); #endif m = ieee80211_decap(ifp, m); if (m == NULL) { @@ -352,7 +352,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, * we don't need to duplicate for DLT_EN10MB. */ if (ifp->if_bpf && m1 == NULL) - bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ether_input_mbuf(ifp, m); } @@ -407,7 +407,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, } #if NBPFILTER > 0 if (ic->ic_rawbpf) - bpf_mtap(ic->ic_rawbpf, m); + bpf_mtap(ic->ic_rawbpf, m, BPF_DIRECTION_IN); /* * Drop mbuf if it was filtered by bpf. Normally, this is * done in ether_input() but IEEE 802.11 management frames @@ -449,7 +449,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni, if (m != NULL) { #if NBPFILTER > 0 if (ic->ic_rawbpf) - bpf_mtap(ic->ic_rawbpf, m); + bpf_mtap(ic->ic_rawbpf, m, BPF_DIRECTION_IN); #endif m_freem(m); } diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 4b2a1ba82d7..58b2ae3c5af 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.83 2005/12/20 13:36:28 markus Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.84 2006/03/25 22:41:48 djm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -963,7 +963,8 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, hdr.spi = tdb->tdb_spi; hdr.flags |= M_AUTH | M_AUTH_AH; - bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, ENC_HDRLEN, m); + bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, ENC_HDRLEN, m, + BPF_DIRECTION_OUT); } #endif diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 11bad1f38f6..d9922e4b4dc 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.121 2006/03/23 14:18:55 mcbride Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.122 2006/03/25 22:41:48 djm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -1308,7 +1308,8 @@ carp_input(struct mbuf *m, u_int8_t *shost, u_int8_t *dhost, u_int16_t etype) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap_hdr(ifp->if_bpf, (char *)&eh, ETHER_HDR_LEN, m); + bpf_mtap_hdr(ifp->if_bpf, (char *)&eh, ETHER_HDR_LEN, m, + BPF_DIRECTION_IN); #endif ifp->if_ipackets++; ether_input(ifp, &eh, m); diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index bf3e4aab7ad..40643e1ffb4 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.96 2005/12/20 13:36:28 markus Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.97 2006/03/25 22:41:48 djm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -752,7 +752,8 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, if (esph) hdr.flags |= M_AUTH; - bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, ENC_HDRLEN, m); + bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, ENC_HDRLEN, m, + BPF_DIRECTION_OUT); } #endif diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index cd53c0b5513..92ec9076f86 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.48 2005/07/31 03:52:19 pascoe Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.49 2006/03/25 22:41:48 djm Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -243,7 +243,8 @@ etherip_input(struct mbuf *m, ...) } #if NBPFILTER > 0 if (sc->gif_if.if_bpf) - bpf_mtap_af(sc->gif_if.if_bpf, sdst.sa.sa_family, m); + bpf_mtap_af(sc->gif_if.if_bpf, sdst.sa.sa_family, m, + BPF_DIRECTION_IN); #endif #if NBRIDGE > 0 diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index d6948648d25..01bf634c90d 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_gre.c,v 1.28 2006/03/04 22:40:16 brad Exp $ */ +/* $OpenBSD: ip_gre.c,v 1.29 2006/03/25 22:41:48 djm Exp $ */ /* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -193,7 +193,7 @@ gre_input2(m , hlen, proto) #if NBPFILTER > 0 if (sc->sc_if.if_bpf) - bpf_mtap_af(sc->sc_if.if_bpf, af, m); + bpf_mtap_af(sc->sc_if.if_bpf, af, m, BPF_DIRECTION_IN); #endif s = splnet(); /* possible */ @@ -319,7 +319,7 @@ gre_mobile_input(struct mbuf *m, ...) #if NBPFILTER > 0 if (sc->sc_if.if_bpf) - bpf_mtap_af(sc->sc_if.if_bpf, AF_INET, m); + bpf_mtap_af(sc->sc_if.if_bpf, AF_INET, m, BPF_DIRECTION_IN); #endif s = splnet(); /* possible */ diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index a7a52dd1bc6..3e07cb66eae 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.19 2005/12/20 13:36:28 markus Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.20 2006/03/25 22:41:48 djm Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -398,7 +398,8 @@ ipcomp_output(m, tdb, mp, skip, protoff) hdr.af = tdb->tdb_dst.sa.sa_family; hdr.spi = tdb->tdb_spi; - bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, ENC_HDRLEN, m); + bpf_mtap_hdr(ifn->if_bpf, (char *)&hdr, ENC_HDRLEN, m, + BPF_DIRECTION_OUT); } #endif hlen = IPCOMP_HLENGTH; diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index 01976eeed4c..f14d2e2d82d 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.35 2006/03/05 21:48:56 miod Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.36 2006/03/25 22:41:48 djm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -360,7 +360,7 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp) #if NBPFILTER > 0 if (gifp && gifp->if_bpf) bpf_mtap_af(gifp->if_bpf, ifq == &ipintrq ? AF_INET : AF_INET6, - m); + m, BPF_DIRECTION_IN); #endif s = splnet(); /* isn't it already? */ diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 84292f88471..2617482c6b2 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.78 2006/03/04 22:40:16 brad Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.79 2006/03/25 22:41:48 djm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -566,7 +566,8 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, hdr.spi = tdbp->tdb_spi; hdr.flags = m->m_flags & (M_AUTH|M_CONF|M_AUTH_AH); - bpf_mtap_hdr(bpfif->if_bpf, (char *)&hdr, ENC_HDRLEN, m); + bpf_mtap_hdr(bpfif->if_bpf, (char *)&hdr, ENC_HDRLEN, m, + BPF_DIRECTION_IN); } #endif |