summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2021-02-20 04:37:26 +0000
committerdlg <dlg@openbsd.org>2021-02-20 04:37:26 +0000
commit4a6e2859c993caade441dd378b49d622981a2511 (patch)
treeb7a98bf60cb93f1cc679d339612892ce8716aca6
parentgive interfaces an if_bpf_mtap handler. (diff)
downloadwireguard-openbsd-4a6e2859c993caade441dd378b49d622981a2511.tar.xz
wireguard-openbsd-4a6e2859c993caade441dd378b49d622981a2511.zip
default interfaces to bpf_mtap_ether for their if_bpf_mtap handler.
call (*ifp->if_bpf_mtap) instead of bpf_mtap_ether in ifiq_input and if_vinput.
-rw-r--r--sys/net/if.c8
-rw-r--r--sys/net/ifq.c4
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 6e01d40fdd7..9377bda5b44 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.630 2021/02/20 01:11:43 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.631 2021/02/20 04:37:26 dlg Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -629,6 +629,10 @@ if_attach_common(struct ifnet *ifp)
ifp->if_rtrequest = if_rtrequest_dummy;
if (ifp->if_enqueue == NULL)
ifp->if_enqueue = if_enqueue_ifq;
+#if NBPFILTER > 0
+ if (ifp->if_bpf_mtap == NULL)
+ ifp->if_bpf_mtap = bpf_mtap_ether;
+#endif
ifp->if_llprio = IFQ_DEFPRIO;
}
@@ -852,7 +856,7 @@ if_vinput(struct ifnet *ifp, struct mbuf *m)
#if NBPFILTER > 0
if_bpf = ifp->if_bpf;
if (if_bpf) {
- if (bpf_mtap_ether(if_bpf, m, BPF_DIRECTION_IN)) {
+ if ((*ifp->if_bpf_mtap)(if_bpf, m, BPF_DIRECTION_IN)) {
m_freem(m);
return;
}
diff --git a/sys/net/ifq.c b/sys/net/ifq.c
index 1aa126f614f..51eaaf44343 100644
--- a/sys/net/ifq.c
+++ b/sys/net/ifq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifq.c,v 1.42 2021/02/20 01:11:44 dlg Exp $ */
+/* $OpenBSD: ifq.c,v 1.43 2021/02/20 04:37:26 dlg Exp $ */
/*
* Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
@@ -693,7 +693,7 @@ ifiq_input(struct ifiqueue *ifiq, struct mbuf_list *ml)
ml_init(ml);
while ((m = ml_dequeue(&ml0)) != NULL) {
- if (bpf_mtap_ether(if_bpf, m, BPF_DIRECTION_IN))
+ if ((*ifp->if_bpf_mtap)(if_bpf, m, BPF_DIRECTION_IN))
m_freem(m);
else
ml_enqueue(ml, m);