From 38dfad8c2a59ad794bf75d30d4d9e9c7c476dc45 Mon Sep 17 00:00:00 2001 From: mpi Date: Sat, 23 May 2015 08:31:05 +0000 Subject: [PATCH] Pass output packets to bpf(4). This is helpful when debugging stack issues. ok reyk@ --- sys/net/if_vether.c | 17 ++++++++++++----- 1 file 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 #include +#include "bpfilter.h" +#if NBPFILTER > 0 +#include +#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); } -- 2.20.1