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 /sys/dev/usb | |
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@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_atu.c | 10 | ||||
-rw-r--r-- | sys/dev/usb/if_aue.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_axe.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_cdce.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/if_cue.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_kue.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/if_ral.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/if_udav.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/if_upl.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_url.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/ueagle.c | 6 |
11 files changed, 39 insertions, 50 deletions
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); |