netmap: netmap_transmit should honor bpf packet tap hook

This allows tcpdump to capture outbound kernel packets while
in netmap mode

Submitted by:	Marc de la Gueronniere <mdelagueronniere@verisign.com>
Reviewed by:	vmaffione
MFC after:	1 week
Sponsored by:	Verisign, Inc.
Differential Revision:	https://reviews.freebsd.org/D17896
This commit is contained in:
Vincenzo Maffione 2018-12-06 09:45:25 +00:00
parent 037479ff5e
commit 89a9a5b5c9

View File

@ -449,6 +449,7 @@ ports attached to the switch)
#include <machine/bus.h> /* bus_dmamap_* */
#include <sys/endian.h>
#include <sys/refcount.h>
#include <net/ethernet.h> /* ETHER_BPF_MTAP */
#elif defined(linux)
@ -3860,6 +3861,10 @@ netmap_transmit(struct ifnet *ifp, struct mbuf *m)
goto done;
}
#ifdef __FreeBSD__
ETHER_BPF_MTAP(ifp, m);
#endif /* __FreeBSD__ */
/* protect against netmap_rxsync_from_host(), netmap_sw_to_nic()
* and maybe other instances of netmap_transmit (the latter
* not possible on Linux).