From 4add8d9302f95e90df2c7b01613648b4f8c2a8a7 Mon Sep 17 00:00:00 2001 From: silby Date: Sun, 19 Oct 2003 22:33:41 +0000 Subject: Add a new macro M_ASSERTVALID which ensures that the mbuf in question is non-free. (More checks can/should be added in the future.) Use M_ASSERTVALID in BPF_MTAP so that we catch when freed mbufs are passed in, even if no bpf listeners are active. Inspired by a bug in if_dc caught by Kenjiro Cho. --- sys/net/bpf.h | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/net/bpf.h') diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 6d3e800..a5942ae 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -366,6 +366,7 @@ 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 { \ + M_ASSERTVALID(_m); \ if ((_ifp)->if_bpf) \ bpf_mtap((_ifp)->if_bpf, (_m)); \ } while (0) -- cgit v1.1