summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2015-01-26 03:26:37 +0000
committerluigi <luigi@FreeBSD.org>2015-01-26 03:26:37 +0000
commit56e35bcee15b57f716afc619097aeeb529d263d0 (patch)
tree1377479f46567882ca18add9b4202d4581f2fd83 /contrib
parentefbb33d3cf761b71e78120f04ba76f3afae4da92 (diff)
downloadFreeBSD-src-56e35bcee15b57f716afc619097aeeb529d263d0.zip
FreeBSD-src-56e35bcee15b57f716afc619097aeeb529d263d0.tar.gz
Merge 272659:
Add netmap support to libpcap. Tcpdump and other native pcap clients can now run directly on netmap ports using netmap:foo or valeXX:YY as device names. Modifications to existing code are small and trivial, the netmap-specific code is all in a new file. Please be aware that in netmap mode the physical interface is disconnected from the host stack, so libpcap will steal the traffic not just make a copy. For the full version of the code (including linux and autotools support) see https://code.google.com/p/netmap-libpcap/
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libpcap/inet.c4
-rw-r--r--contrib/libpcap/pcap.c7
2 files changed, 11 insertions, 0 deletions
diff --git a/contrib/libpcap/inet.c b/contrib/libpcap/inet.c
index 6ae46ef..fbf996b 100644
--- a/contrib/libpcap/inet.c
+++ b/contrib/libpcap/inet.c
@@ -737,6 +737,10 @@ pcap_lookupnet(device, netp, maskp, errbuf)
#ifdef PCAP_SUPPORT_USB
|| strstr(device, "usbmon") != NULL
#endif
+#ifdef PCAP_SUPPORT_NETMAP
+ || !strncmp(device, "netmap:", 7)
+ || !strncmp(device, "vale", 4)
+#endif
#ifdef HAVE_SNF_API
|| strstr(device, "snf") != NULL
#endif
diff --git a/contrib/libpcap/pcap.c b/contrib/libpcap/pcap.c
index be884b8..00d44a0 100644
--- a/contrib/libpcap/pcap.c
+++ b/contrib/libpcap/pcap.c
@@ -106,6 +106,10 @@ static const char rcsid[] _U_ =
#include "pcap-netfilter-linux.h"
#endif
+#ifdef PCAP_SUPPORT_NETMAP
+pcap_t* pcap_netmap_create(const char *device, char *ebuf, int *is_ours);
+#endif
+
int
pcap_not_initialized(pcap_t *pcap)
{
@@ -301,6 +305,9 @@ struct capture_source_type {
int (*findalldevs_op)(pcap_if_t **, char *);
pcap_t *(*create_op)(const char *, char *, int *);
} capture_source_types[] = {
+#ifdef PCAP_SUPPORT_NETMAP
+ { NULL, pcap_netmap_create },
+#endif
#ifdef HAVE_DAG_API
{ dag_findalldevs, dag_create },
#endif
OpenPOWER on IntegriCloud