From c165a87f8dfc070bceb68d9c3ff183ec2135e060 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 28 Dec 2003 03:56:00 +0000 Subject: 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 --- sys/net/if_disc.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'sys/net/if_disc.c') diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c index 48935b3..bc1f0ad 100644 --- a/sys/net/if_disc.c +++ b/sys/net/if_disc.c @@ -164,21 +164,8 @@ discoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, } if (ifp->if_bpf) { - /* - * We need to prepend the address family as - * a four byte field. Cons up a dummy header - * to pacify bpf. This is safe because bpf - * will only read from the mbuf (i.e., it won't - * try to free it or keep a pointer a to it). - */ - struct mbuf m0; u_int af = dst->sa_family; - - m0.m_next = m; - m0.m_len = 4; - m0.m_data = (char *)⁡ - - BPF_MTAP(ifp, &m0); + bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); } m->m_pkthdr.rcvif = ifp; -- cgit v1.1