I find it really useful to be able see output packets when tcpdump'ing
a vether(4) interface.
ok?
Index: net/if_vether.c
===================================================================
RCS file: /cvs/src/sys/net/if_vether.c,v
retrieving revision 1.23
diff -u -p -r1.23 if_vether.c
--- net/if_vether.c 14 Mar 2015 03:38:51 -0000 1.23
+++ net/if_vether.c 22 May 2015 13:19:30 -0000
@@ -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);
}