summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-05-23 08:31:05 +0000
committermpi <mpi@openbsd.org>2015-05-23 08:31:05 +0000
commit38dfad8c2a59ad794bf75d30d4d9e9c7c476dc45 (patch)
tree463c10e8f75500f89bb40736a3e47276dee973f7
parentCanonicalize all devices to DUIDs in order to make -w and -W output consistent. (diff)
downloadwireguard-openbsd-38dfad8c2a59ad794bf75d30d4d9e9c7c476dc45.tar.xz
wireguard-openbsd-38dfad8c2a59ad794bf75d30d4d9e9c7c476dc45.zip
Pass output packets to bpf(4). This is helpful when debugging stack
issues. ok reyk@
-rw-r--r--sys/net/if_vether.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c
index 2dc92e015ec..5854e04c839 100644
--- a/sys/net/if_vether.c
+++ b/sys/net/if_vether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vether.c,v 1.23 2015/03/14 03:38:51 jsg Exp $ */
+/* $OpenBSD: if_vether.c,v 1.24 2015/05/23 08:31:05 mpi Exp $ */
/*
* Copyright (c) 2009 Theo de Raadt
@@ -29,6 +29,11 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
+#include "bpfilter.h"
+#if NBPFILTER > 0
+#include <net/bpf.h>
+#endif
+
void vetherattach(int);
int vetherioctl(struct ifnet *, u_long, caddr_t);
void vetherstart(struct ifnet *);
@@ -117,15 +122,17 @@ void
vetherstart(struct ifnet *ifp)
{
struct mbuf *m;
- int s;
for (;;) {
- s = splnet();
IFQ_DEQUEUE(&ifp->if_snd, m);
- splx(s);
-
if (m == NULL)
return;
+
+#if NBPFILTER > 0
+ if (ifp->if_bpf)
+ bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
+#endif /* NBPFILTER > 0 */
+
ifp->if_opackets++;
m_freem(m);
}