diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-02-20 19:37:41 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-02-20 19:37:41 +0000 |
commit | ce6fcb57c3dcb25cfe2e5a2c8722a693d46bd072 (patch) | |
tree | 53d2369695485ff686d147a6ee898aa24c09e42d | |
parent | 1f5cbd2ae792a0919c6a50c051e5b6db956dc42c (diff) |
Fix the bpf hook in etherip_input() by using the right address family and
moving the m_adj() down to prevent so that the ethernet header is preserved.
This fixes tcpdump on bridged gif(4) interfaces. OK mglocker@
-rw-r--r-- | sys/netinet/ip_ether.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index 92ec9076f86..eca7269af15 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.49 2006/03/25 22:41:48 djm Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.50 2007/02/20 19:37:40 claudio Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -217,9 +217,6 @@ etherip_input(struct mbuf *m, ...) m->m_flags |= M_MCAST; } - /* Trim the beginning of the mbuf, to remove the ethernet header. */ - m_adj(m, sizeof(struct ether_header)); - #if NGIF > 0 /* Find appropriate gif(4) interface */ LIST_FOREACH(sc, &gif_softc_list, gif_list) { @@ -243,10 +240,12 @@ etherip_input(struct mbuf *m, ...) } #if NBPFILTER > 0 if (sc->gif_if.if_bpf) - bpf_mtap_af(sc->gif_if.if_bpf, sdst.sa.sa_family, m, - BPF_DIRECTION_IN); + bpf_mtap_af(sc->gif_if.if_bpf, AF_LINK, m, BPF_DIRECTION_IN); #endif + /* Trim the beginning of the mbuf, to remove the ethernet header. */ + m_adj(m, sizeof(struct ether_header)); + #if NBRIDGE > 0 /* * Tap the packet off here for a bridge. bridge_input() returns |