Date: Tue, 3 Apr 2012 09:16:42 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r233835 - projects/pf/head/sys/contrib/pf/net Message-ID: <201204030916.q339Gg1D041584@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Tue Apr 3 09:16:41 2012 New Revision: 233835 URL: http://svn.freebsd.org/changeset/base/233835 Log: FreeBSD always has bpf(9) API regardless whether kernel was or not compiled with 'device bpf'. Modified: projects/pf/head/sys/contrib/pf/net/if_pflog.c projects/pf/head/sys/contrib/pf/net/if_pfsync.c Modified: projects/pf/head/sys/contrib/pf/net/if_pflog.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pflog.c Tue Apr 3 09:13:35 2012 (r233834) +++ projects/pf/head/sys/contrib/pf/net/if_pflog.c Tue Apr 3 09:16:41 2012 (r233835) @@ -41,12 +41,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#ifdef DEV_BPF -#define NBPFILTER DEV_BPF -#else -#define NBPFILTER 0 -#endif - #ifdef DEV_PFLOG #define NPFLOG DEV_PFLOG #else @@ -152,9 +146,7 @@ pflog_clone_create(struct if_clone *ifc, ifp->if_hdrlen = PFLOG_HDRLEN; if_attach(ifp); -#if NBPFILTER > 0 bpfattach(ifp, DLT_PFLOG, PFLOG_HDRLEN); -#endif /* XXX: Why pf(4) lock?! Better add a pflog lock?! */ PF_LOCK(); @@ -175,9 +167,7 @@ pflog_clone_destroy(struct ifnet *ifp) LIST_REMOVE(pflogif, sc_list); PF_UNLOCK(); -#if NBPFILTER > 0 bpfdetach(ifp); -#endif if_detach(ifp); if_free(ifp); free(pflogif, M_DEVBUF); @@ -235,7 +225,6 @@ pflog_packet(struct pfi_kif *kif, struct u_int8_t reason, struct pf_rule *rm, struct pf_rule *am, struct pf_ruleset *ruleset, struct pf_pdesc *pd) { -#if NBPFILTER > 0 struct ifnet *ifn; struct pfloghdr hdr; @@ -292,7 +281,6 @@ pflog_packet(struct pfi_kif *kif, struct ifn->if_opackets++; ifn->if_obytes += m->m_pkthdr.len; BPF_MTAP2(ifn, &hdr, PFLOG_HDRLEN, m); -#endif return (0); } Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Tue Apr 3 09:13:35 2012 (r233834) +++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Tue Apr 3 09:16:41 2012 (r233835) @@ -59,8 +59,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#define NBPFILTER 1 - #include <sys/param.h> #include <sys/kernel.h> #include <sys/bus.h> @@ -343,9 +341,7 @@ pfsync_clone_create(struct if_clone *ifc if_attach(ifp); -#if NBPFILTER > 0 bpfattach(ifp, DLT_PFSYNC, PFSYNC_HDRLEN); -#endif V_pfsyncif = sc; @@ -364,9 +360,7 @@ pfsync_clone_destroy(struct ifnet *ifp) PF_UNLOCK(); if (!sc->pfsync_sync_ok && carp_demote_adj_p) (*carp_demote_adj_p)(-V_pfsync_carp_adj, "pfsync destroy"); -#if NBPFILTER > 0 bpfdetach(ifp); -#endif if_detach(ifp); pfsync_drop(sc); @@ -1508,9 +1502,7 @@ static void pfsync_sendout(int schedswi) { struct pfsync_softc *sc = V_pfsyncif; -#if NBPFILTER > 0 struct ifnet *ifp = sc->sc_ifp; -#endif struct mbuf *m; struct ip *ip; struct pfsync_header *ph; @@ -1525,11 +1517,7 @@ pfsync_sendout(int schedswi) if (sc == NULL || sc->sc_len == PFSYNC_MINPKT) return; -#if NBPFILTER > 0 if (ifp->if_bpf == NULL && sc->sc_sync_if == NULL) { -#else - if (sc->sc_sync_if == NULL) { -#endif pfsync_drop(sc); return; } @@ -1625,7 +1613,6 @@ pfsync_sendout(int schedswi) /* XXX write checksum in EOF here */ /* we're done, let's put it on the wire */ -#if NBPFILTER > 0 if (ifp->if_bpf) { m->m_data += sizeof(*ip); m->m_len = m->m_pkthdr.len = sc->sc_len - sizeof(*ip); @@ -1639,7 +1626,6 @@ pfsync_sendout(int schedswi) m_freem(m); return; } -#endif sc->sc_ifp->if_opackets++; sc->sc_ifp->if_obytes += m->m_pkthdr.len;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204030916.q339Gg1D041584>