summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_gre.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/netinet/ip_gre.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/netinet/ip_gre.c')
-rw-r--r--sys/netinet/ip_gre.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c
index fc6468b..05d3e09 100644
--- a/sys/netinet/ip_gre.c
+++ b/sys/netinet/ip_gre.c
@@ -196,14 +196,8 @@ gre_input2(struct mbuf *m ,int hlen, u_char proto)
m->m_pkthdr.len -= hlen;
if (sc->sc_if.if_bpf) {
- struct mbuf m0;
u_int32_t af = AF_INET;
-
- m0.m_next = m;
- m0.m_len = 4;
- m0.m_data = (char *)&af;
-
- BPF_MTAP(&(sc->sc_if), &m0);
+ bpf_mtap2(sc->sc_if.if_bpf, &af, sizeof(af), m);
}
m->m_pkthdr.rcvif = &sc->sc_if;
@@ -283,14 +277,8 @@ gre_mobile_input(m, va_alist)
ip->ip_sum = in_cksum(m, (ip->ip_hl << 2));
if (sc->sc_if.if_bpf) {
- struct mbuf m0;
- u_int af = AF_INET;
-
- m0.m_next = m;
- m0.m_len = 4;
- m0.m_data = (char *)&af;
-
- BPF_MTAP(&(sc->sc_if), &m0);
+ u_int32_t af = AF_INET;
+ bpf_mtap2(sc->sc_if.if_bpf, &af, sizeof(af), m);
}
m->m_pkthdr.rcvif = &sc->sc_if;
OpenPOWER on IntegriCloud