From ce6fcb57c3dcb25cfe2e5a2c8722a693d46bd072 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Tue, 20 Feb 2007 19:37:41 +0000 Subject: 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@ --- sys/netinet/ip_ether.c | 11 +++++------ 1 file 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 -- cgit v1.2.3