diff options
author | sam <sam@FreeBSD.org> | 2003-12-28 03:56:00 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2003-12-28 03:56:00 +0000 |
commit | c165a87f8dfc070bceb68d9c3ff183ec2135e060 (patch) | |
tree | f663da0db11fcecb5ff2d3e93732492fb4d7bd29 /sys/net/bpf.h | |
parent | 853a4ae85d691a2f3500efc16c2eab14e3c117b0 (diff) | |
download | FreeBSD-src-c165a87f8dfc070bceb68d9c3ff183ec2135e060.zip FreeBSD-src-c165a87f8dfc070bceb68d9c3ff183ec2135e060.tar.gz |
o eliminate widespread on-stack mbuf use for bpf by introducing
a new bpf_mtap2 routine that does the right thing for an mbuf
and a variable-length chunk of data that should be prepended.
o while we're sweeping the drivers, use u_int32_t uniformly when
when prepending the address family (several places were assuming
sizeof(int) was 4)
o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated
mbufs have been eliminated; this may better be moved to the bpf
routines
Reviewed by: arch@ and several others
Diffstat (limited to 'sys/net/bpf.h')
-rw-r--r-- | sys/net/bpf.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 6d3e800..c4b31d4 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -354,6 +354,7 @@ struct bpf_if; int bpf_validate(const struct bpf_insn *, int); void bpf_tap(struct bpf_if *, u_char *, u_int); void bpf_mtap(struct bpf_if *, struct mbuf *); +void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *); void bpfattach(struct ifnet *, u_int, u_int); void bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **); void bpfdetach(struct ifnet *); @@ -366,8 +367,16 @@ u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ } while (0) #define BPF_MTAP(_ifp,_m) do { \ - if ((_ifp)->if_bpf) \ + if ((_ifp)->if_bpf) { \ + M_ASSERTVALID(_m); \ bpf_mtap((_ifp)->if_bpf, (_m)); \ + } \ +} while (0) +#define BPF_MTAP2(_ifp,_data,_dlen,_m) do { \ + if ((_ifp)->if_bpf) { \ + M_ASSERTVALID(_m); \ + bpf_mtap2((_ifp)->if_bpf,(_data),(_dlen),(_m)); \ + } \ } while (0) #endif |