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)
This commit is contained in:
parent
0990c0a12c
commit
a36599cce7
@ -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, u_int pktlen)
|
||||
* 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 *m)
|
||||
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);
|
||||
|
@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/if.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/bpf_buffer.h>
|
||||
#include <net/bpf_jitter.h>
|
||||
#include <net/bpfdesc.h>
|
||||
|
||||
/*
|
||||
|
@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/bpf_jitter.h>
|
||||
#include <net/bpf_zerocopy.h>
|
||||
#include <net/bpfdesc.h>
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user