summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2020-12-12 00:15:34 +0000
committerdlg <dlg@openbsd.org>2020-12-12 00:15:34 +0000
commit71ecc90e87e973bd7d24f26e03925c57713d4197 (patch)
treee1ecdd5a6ee15bf8ac3880bd30f7b8742e405bcc /sys
parenttry to read the mbuf timestamp from the mbuf with the pkthdrs in it. (diff)
downloadwireguard-openbsd-71ecc90e87e973bd7d24f26e03925c57713d4197.tar.xz
wireguard-openbsd-71ecc90e87e973bd7d24f26e03925c57713d4197.zip
get bpf_mtap_ether to call _bpf_mtap directly instead of via bpf_mtap.
this is so _bpf_mtap can look at the mbuf with packet headers on it so it can fill in more stuff in the bpf_hdr struct. ive been running this in production for most of a month now and it's working well.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/bpf.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 39198698d69..a0f13505874 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.195 2020/12/12 00:01:37 dlg Exp $ */
+/* $OpenBSD: bpf.c,v 1.196 2020/12/12 00:15:34 dlg Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -1437,13 +1437,13 @@ bpf_mtap_ether(caddr_t arg, const struct mbuf *m, u_int direction)
{
#if NVLAN > 0
struct ether_vlan_header evh;
- struct m_hdr mh;
+ struct m_hdr mh, md;
uint8_t prio;
if ((m->m_flags & M_VLANTAG) == 0)
#endif
{
- return bpf_mtap(arg, m, direction);
+ return _bpf_mtap(arg, m, m, direction);
}
#if NVLAN > 0
@@ -1460,12 +1460,16 @@ bpf_mtap_ether(caddr_t arg, const struct mbuf *m, u_int direction)
(prio << EVL_PRIO_BITS));
mh.mh_flags = 0;
- mh.mh_data = m->m_data + ETHER_HDR_LEN;
- mh.mh_len = m->m_len - ETHER_HDR_LEN;
- mh.mh_next = m->m_next;
+ mh.mh_data = (caddr_t)&evh;
+ mh.mh_len = sizeof(evh);
+ mh.mh_next = (struct mbuf *)&md;
+
+ md.mh_flags = 0;
+ md.mh_data = m->m_data + ETHER_HDR_LEN;
+ md.mh_len = m->m_len - ETHER_HDR_LEN;
+ md.mh_next = m->m_next;
- return bpf_mtap_hdr(arg, &evh, sizeof(evh),
- (struct mbuf *)&mh, direction);
+ return _bpf_mtap(arg, m, (struct mbuf *)&mh, direction);
#endif
}