summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-03-25 22:41:49 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-03-25 22:41:49 +0000
commit24436414aab60dc84348ec54f23b324b4ae862a3 (patch)
treeee35283622a78eeac5656cb5661954771faf6520 /sys/arch
parentd1265a1a72755bd0209950654a6df47287781241 (diff)
allow bpf(4) to ignore packets based on their direction (inbound or
outbound), using a new BIOCSDIRFILT ioctl; guidance, feedback and ok canacar@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mac68k/dev/if_ae.c6
-rw-r--r--sys/arch/mac68k/dev/if_mc.c6
-rw-r--r--sys/arch/mac68k/dev/if_sn.c6
-rw-r--r--sys/arch/macppc/dev/if_bm.c6
-rw-r--r--sys/arch/mvme68k/dev/if_ie.c7
-rw-r--r--sys/arch/mvme88k/dev/if_ie.c7
-rw-r--r--sys/arch/sgi/dev/if_mec.c6
-rw-r--r--sys/arch/sparc/dev/be.c6
-rw-r--r--sys/arch/sparc/dev/hme.c6
-rw-r--r--sys/arch/sparc/dev/if_ie.c7
-rw-r--r--sys/arch/sparc/dev/qe.c6
-rw-r--r--sys/arch/vax/bi/if_ni.c6
-rw-r--r--sys/arch/vax/if/if_qe.c6
-rw-r--r--sys/arch/vax/if/sgec.c6
-rw-r--r--sys/arch/vax/qbus/if_de.c6
15 files changed, 48 insertions, 45 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);