diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-01-08 00:07:19 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-01-08 00:07:19 +0000 |
commit | 2bf3b2729eb3eae50b6c140c57a21b4512d6500b (patch) | |
tree | 9c067fabcbac2c84f5ebad6b3247c09d1a1b2ca2 | |
parent | 8dd062d96b8a3e9947333aac09e82100990916c8 (diff) |
Incoming bpf tap.
-rw-r--r-- | sys/netinet/ip_gre.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index ac7da27ece7..e0157e2d887 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_gre.c,v 1.3 2000/01/07 21:57:02 angelos Exp $ */ +/* $OpenBSD: ip_gre.c,v 1.4 2000/01/08 00:07:18 angelos Exp $ */ /* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -167,6 +167,26 @@ gre_input2(struct mbuf *m ,int hlen,u_char proto) m->m_len -= hlen; m->m_pkthdr.len -= hlen; +#if NBPFILTER >0 + if (sc->sc_if->if_bpf) { + /* + * We need to prepend the address family as + * a four byte field. Cons up a fake 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(sc->sc_if->if_bpf, &m0); + } +#endif + s = splimp(); /* possible */ if (IF_QFULL(ifq)) { IF_DROP(ifq); @@ -286,6 +306,26 @@ gre_mobile_input(m, va_alist) ifq = &ipintrq; +#if NBPFILTER >0 + if (sc->sc_if->if_bpf) { + /* + * We need to prepend the address family as + * a four byte field. Cons up a fake 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(sc->sc_if->if_bpf, &m0); + } +#endif + s = splimp(); /* possible */ if (IF_QFULL(ifq)) { IF_DROP(ifq); |