From owner-svn-src-all@FreeBSD.ORG Wed Aug 12 17:28:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA4CA1065693; Wed, 12 Aug 2009 17:28:53 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8BD88FC58; Wed, 12 Aug 2009 17:28:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7CHSrTm071528; Wed, 12 Aug 2009 17:28:53 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7CHSrxF071523; Wed, 12 Aug 2009 17:28:53 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200908121728.n7CHSrxF071523@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 12 Aug 2009 17:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196150 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Aug 2009 17:28:54 -0000 Author: jkim Date: Wed Aug 12 17:28:53 2009 New Revision: 196150 URL: http://svn.freebsd.org/changeset/base/196150 Log: Always embed pointer to BPF JIT function in BPF descriptor to avoid inconsistency when opt_bpf.h is not included. Reviewed by: rwatson Approved by: re (rwatson) Modified: head/sys/net/bpf.c head/sys/net/bpf_buffer.c head/sys/net/bpf_zerocopy.c head/sys/net/bpfdesc.h Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpf.c Wed Aug 12 17:28:53 2009 (r196150) @@ -1585,6 +1585,9 @@ void bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen) { struct bpf_d *d; +#ifdef BPF_JITTER + bpf_jit_filter *bf; +#endif u_int slen; int gottime; struct timeval tv; @@ -1601,8 +1604,9 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, * the interface pointers on the mbuf to figure it out. */ #ifdef BPF_JITTER - if (bpf_jitter_enable != 0 && d->bd_bfilter != NULL) - slen = (*(d->bd_bfilter->func))(pkt, pktlen, pktlen); + bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; + if (bf != NULL) + slen = (*(bf->func))(pkt, pktlen, pktlen); else #endif slen = bpf_filter(d->bd_rfilter, pkt, pktlen, pktlen); @@ -1634,6 +1638,9 @@ void bpf_mtap(struct bpf_if *bp, struct mbuf *m) { struct bpf_d *d; +#ifdef BPF_JITTER + bpf_jit_filter *bf; +#endif u_int pktlen, slen; int gottime; struct timeval tv; @@ -1655,11 +1662,10 @@ bpf_mtap(struct bpf_if *bp, struct mbuf BPFD_LOCK(d); ++d->bd_rcount; #ifdef BPF_JITTER + bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; /* XXX We cannot handle multiple mbufs. */ - if (bpf_jitter_enable != 0 && d->bd_bfilter != NULL && - m->m_next == NULL) - slen = (*(d->bd_bfilter->func))(mtod(m, u_char *), - pktlen, pktlen); + if (bf != NULL && m->m_next == NULL) + slen = (*(bf->func))(mtod(m, u_char *), pktlen, pktlen); else #endif slen = bpf_filter(d->bd_rfilter, (u_char *)m, pktlen, 0); Modified: head/sys/net/bpf_buffer.c ============================================================================== --- head/sys/net/bpf_buffer.c Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpf_buffer.c Wed Aug 12 17:28:53 2009 (r196150) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include /* Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpf_zerocopy.c Wed Aug 12 17:28:53 2009 (r196150) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/net/bpfdesc.h ============================================================================== --- head/sys/net/bpfdesc.h Wed Aug 12 16:27:51 2009 (r196149) +++ head/sys/net/bpfdesc.h Wed Aug 12 17:28:53 2009 (r196150) @@ -72,9 +72,7 @@ struct bpf_d { u_long bd_rtout; /* Read timeout in 'ticks' */ struct bpf_insn *bd_rfilter; /* read filter code */ struct bpf_insn *bd_wfilter; /* write filter code */ -#ifdef BPF_JITTER - bpf_jit_filter *bd_bfilter; /* binary filter code */ -#endif + void *bd_bfilter; /* binary filter code */ u_int64_t bd_rcount; /* number of packets received */ u_int64_t bd_dcount; /* number of packets dropped */