diff options
author | luigi <luigi@FreeBSD.org> | 2014-10-06 15:48:28 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2014-10-06 15:48:28 +0000 |
commit | 9012a745116d83288fd8bd32fb19bf7ccc83b96d (patch) | |
tree | c5862b67e705a3c7407d656cc6e63636b1359c7a /contrib/libpcap | |
parent | f5d5f98306a369046fc8ba0db8d2c0b97ae2fba5 (diff) | |
download | FreeBSD-src-9012a745116d83288fd8bd32fb19bf7ccc83b96d.zip FreeBSD-src-9012a745116d83288fd8bd32fb19bf7ccc83b96d.tar.gz |
Add netmap support to libpcap. Tcpdump and other native pcap application can now
run directly on netmap ports using netmap:foo or valeXX:YY 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/
MFC after: 3 days
Diffstat (limited to 'contrib/libpcap')
-rw-r--r-- | contrib/libpcap/inet.c | 4 | ||||
-rw-r--r-- | contrib/libpcap/pcap.c | 7 |
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 |