svn commit: r196340 - in stable/7/sys: . contrib/pf net
Jung-uk Kim
jkim at FreeBSD.org
Mon Aug 17 18:02:47 UTC 2009
Author: jkim
Date: Mon Aug 17 18:02:46 2009
New Revision: 196340
URL: http://svn.freebsd.org/changeset/base/196340
Log:
MFC: (partial) r196150
Always embed pointer to BPF JIT function in BPF descriptor
to avoid inconsistency when opt_bpf.h is not included.
Note: bpf_buffer.c and bpf_zerocopy.c do not exist on stable/7.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/net/bpf.c
stable/7/sys/net/bpfdesc.h
Modified: stable/7/sys/net/bpf.c
==============================================================================
--- stable/7/sys/net/bpf.c Mon Aug 17 17:31:42 2009 (r196339)
+++ stable/7/sys/net/bpf.c Mon Aug 17 18:02:46 2009 (r196340)
@@ -1288,6 +1288,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;
@@ -1298,8 +1301,9 @@ bpf_tap(struct bpf_if *bp, u_char *pkt,
BPFD_LOCK(d);
++d->bd_rcount;
#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);
@@ -1354,6 +1358,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;
@@ -1375,11 +1382,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: stable/7/sys/net/bpfdesc.h
==============================================================================
--- stable/7/sys/net/bpfdesc.h Mon Aug 17 17:31:42 2009 (r196339)
+++ stable/7/sys/net/bpfdesc.h Mon Aug 17 18:02:46 2009 (r196340)
@@ -71,9 +71,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_long bd_rcount; /* number of packets received */
u_long bd_dcount; /* number of packets dropped */
More information about the svn-src-all
mailing list