diff options
-rw-r--r-- | example/ndpiReader.c | 10 | ||||
-rw-r--r-- | example/reader_util.c | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index a2d9885bb..908afb176 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -21,7 +21,9 @@ #include "ndpi_config.h" #ifdef linux +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include <sched.h> #endif #include <stdio.h> @@ -2696,6 +2698,7 @@ static pcap_t * openPcapFileOrDevice(u_int16_t thread_id, const u_char * pcap_fi if(dpdk_port_init(dpdk_port_id, mbuf_pool) != 0) rte_exit(EXIT_FAILURE, "DPDK: Cannot init port %u: please see README.dpdk\n", dpdk_port_id); #else + /* Trying to open the interface */ if((pcap_handle = pcap_open_live((char*)pcap_file, snaplen, promisc, 500, pcap_error_buffer)) == NULL) { capture_for = capture_until = 0; @@ -2703,15 +2706,18 @@ static pcap_t * openPcapFileOrDevice(u_int16_t thread_id, const u_char * pcap_fi live_capture = 0; num_threads = 1; /* Open pcap files in single threads mode */ - /* trying to open a pcap file */ + /* Trying to open a pcap file */ if((pcap_handle = pcap_open_offline((char*)pcap_file, pcap_error_buffer)) == NULL) { char filename[256] = { 0 }; if(strstr((char*)pcap_file, (char*)".pcap")) printf("ERROR: could not open pcap file %s: %s\n", pcap_file, pcap_error_buffer); + + /* Trying to open as a playlist as last attempt */ else if((getNextPcapFileFromPlaylist(thread_id, filename, sizeof(filename)) != 0) || ((pcap_handle = pcap_open_offline(filename, pcap_error_buffer)) == NULL)) { - printf("ERROR: could not open playlist %s: %s\n", filename, pcap_error_buffer); + /* This probably was a bad interface name, printing a generic error */ + printf("ERROR: could not open %s: %s\n", filename, pcap_error_buffer); exit(-1); } else { if((!quiet_mode)) diff --git a/example/reader_util.c b/example/reader_util.c index f8dd315d0..1376f9b8d 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1792,8 +1792,15 @@ u_int32_t ethernet_crc32(const void* data, size_t n_bytes) { #ifdef USE_DPDK +#include <rte_version.h> +#include <rte_ether.h> + static const struct rte_eth_conf port_conf_default = { +#if (RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0)) .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } +#else + .rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN } +#endif }; /* ************************************ */ |