summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-12-28 03:56:00 +0000
committersam <sam@FreeBSD.org>2003-12-28 03:56:00 +0000
commitc165a87f8dfc070bceb68d9c3ff183ec2135e060 (patch)
treef663da0db11fcecb5ff2d3e93732492fb4d7bd29 /sys/netgraph
parent853a4ae85d691a2f3500efc16c2eab14e3c117b0 (diff)
downloadFreeBSD-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/netgraph')
-rw-r--r--sys/netgraph/ng_iface.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c
index ca637e7..430e0e6 100644
--- a/sys/netgraph/ng_iface.c
+++ b/sys/netgraph/ng_iface.c
@@ -485,16 +485,10 @@ ng_iface_start(struct ifnet *ifp)
static void
ng_iface_bpftap(struct ifnet *ifp, struct mbuf *m, sa_family_t family)
{
- int32_t family4 = (int32_t)family;
- struct mbuf m0;
-
KASSERT(family != AF_UNSPEC, ("%s: family=AF_UNSPEC", __func__));
if (ifp->if_bpf != NULL) {
- bzero(&m0, sizeof(m0));
- m0.m_next = m;
- m0.m_len = sizeof(family4);
- m0.m_data = (char *)&family4;
- BPF_MTAP(ifp, &m0);
+ int32_t family4 = (int32_t)family;
+ bpf_mtap2(ifp->if_bpf, &family4, sizeof(family4), m);
}
}
OpenPOWER on IntegriCloud