diff options
author | Campus <campus@ntop.org> | 2017-07-13 16:22:34 +0200 |
---|---|---|
committer | Campus <campus@ntop.org> | 2017-07-13 16:22:34 +0200 |
commit | 6d7f5552de5cf88a6dc994b0d2a93dadbbe23509 (patch) | |
tree | 1d32603670f4dcf9bcd3a67e4af4b27ed8c891d9 | |
parent | c5bc91145f9ce6553678b1ea3a6c0ddc1e6afdfb (diff) |
changed name from _bpf_filter to bpfFilter to avoid compilation error in OpenBSD caused by redefinition by https://github.com/openbsd/src/blob/master/sys/net/bpf.h#L296
-rw-r--r-- | example/ndpiReader.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index f2fefa0a1..e2dfc9d14 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -62,9 +62,7 @@ static char *_pcap_file[MAX_NUM_READER_THREADS]; /**< Ingress pcap file/interfac static FILE *playlist_fp[MAX_NUM_READER_THREADS] = { NULL }; /**< Ingress playlist */ static FILE *results_file = NULL; static char *results_path = NULL; -#ifndef __OpenBSD__ -static const char *_bpf_filter = NULL; /**< bpf filter */ -#endif +static char * bpfFilter = NULL; /**< bpf filter */ static char *_protoFilePath = NULL; /**< Protocol file path */ static char *_statsFilePath = NULL; /**< Top stats file path */ #ifdef HAVE_JSON_C @@ -449,7 +447,7 @@ static void parseOptions(int argc, char **argv) { case 'f': case '6': - _bpf_filter = optarg; + bpfFilter = optarg; break; case 'g': @@ -1944,16 +1942,16 @@ static int getNextPcapFileFromPlaylist(u_int16_t thread_id, char filename[], u_i */ static void configurePcapHandle(pcap_t * pcap_handle) { - if(_bpf_filter != NULL) { + if(bpfFilter != NULL) { struct bpf_program fcode; - if(pcap_compile(pcap_handle, &fcode, _bpf_filter, 1, 0xFFFFFF00) < 0) { + if(pcap_compile(pcap_handle, &fcode, bpfFilter, 1, 0xFFFFFF00) < 0) { printf("pcap_compile error: '%s'\n", pcap_geterr(pcap_handle)); } else { if(pcap_setfilter(pcap_handle, &fcode) < 0) { printf("pcap_setfilter error: '%s'\n", pcap_geterr(pcap_handle)); } else - printf("Successfully set BPF filter to '%s'\n", _bpf_filter); + printf("Successfully set BPF filter to '%s'\n", bpfFilter); } } } |