summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus/if_plip.c
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/dev/ppbus/if_plip.c
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/dev/ppbus/if_plip.c')
-rw-r--r--sys/dev/ppbus/if_plip.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c
index ab02841..32221c7 100644
--- a/sys/dev/ppbus/if_plip.c
+++ b/sys/dev/ppbus/if_plip.c
@@ -445,19 +445,8 @@ clpinbyte (int spin, device_t ppbus)
static void
lptap(struct ifnet *ifp, struct mbuf *m)
{
- /*
- * Send a packet through 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 to it).
- */
u_int32_t af = AF_INET;
- struct mbuf m0;
-
- m0.m_next = m;
- m0.m_len = sizeof(u_int32_t);
- m0.m_data = (char *)&af;
- BPF_MTAP(ifp, &m0);
+ BPF_MTAP2(ifp, &af, sizeof(af), m);
}
static void
OpenPOWER on IntegriCloud