summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2020-07-21 22:44:55 +0000
committerdlg <dlg@openbsd.org>2020-07-21 22:44:55 +0000
commit0918526a4b077332bde6e58017c9a114d03110f9 (patch)
treed81f6cb342512b1f50f6ce49a60e411bd4b72976
parentGENERIC.MP (diff)
downloadwireguard-openbsd-0918526a4b077332bde6e58017c9a114d03110f9.tar.xz
wireguard-openbsd-0918526a4b077332bde6e58017c9a114d03110f9.zip
DLT_LOOP does have a link header, so tell pcap-filter so it can use it.
matthieu@ reported that asking tcpdump to look at ip or ip6 traffic on a wg(4) interface caused all packets to be captured. this is because pcap assumes that if your link type doesn't have a link header then it is always ip or ip6 (which is weird anyway) and captures everything. there was already code to generate a filter for the DLT_LOOP link header, it was just bypassed cos earlier code said that there wasn't one. debugged with and ok kn@
-rw-r--r--lib/libpcap/gencode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c
index 44d791b0644..2adb0f92a9e 100644
--- a/lib/libpcap/gencode.c
+++ b/lib/libpcap/gencode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gencode.c,v 1.52 2018/12/09 15:07:06 denis Exp $ */
+/* $OpenBSD: gencode.c,v 1.53 2020/07/21 22:44:55 dlg Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
@@ -770,7 +770,7 @@ init_linktype(type)
return;
case DLT_LOOP:
- off_linktype = -1;
+ off_linktype = 0;
off_nl = 4;
return;