summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2007-02-20 19:37:40 +0000
committerclaudio <claudio@openbsd.org>2007-02-20 19:37:40 +0000
commit7ae94e6edc22e48b51a1162b688626b41504773b (patch)
tree938c7210c0b40f11fba4147a5262726b19b890aa
parentfor vfsconf sysctl, do not leak kernel sensors out to userland (diff)
downloadwireguard-openbsd-7ae94e6edc22e48b51a1162b688626b41504773b.tar.xz
wireguard-openbsd-7ae94e6edc22e48b51a1162b688626b41504773b.zip
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@
Diffstat (limited to '')
-rw-r--r--sys/netinet/ip_ether.c11
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