Changeset d47ca18
- Timestamp:
- 06/21/17 15:41:47 (4 years ago)
- Branches:
- cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
- Children:
- e9c089a
- Parents:
- f398c61
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
configure.in
rd759ee1 rd47ca18 250 250 LIBTRACE_LIBS="$LIBTRACE_LIBS -lpcap" 251 251 AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support]) 252 AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])253 252 254 253 LIBS="-lpcap" -
lib/format_linux_common.c
rdb84bb2 rd47ca18 61 61 static int linuxnative_configure_bpf(libtrace_t *libtrace, 62 62 libtrace_filter_t *filter) { 63 #if def HAVE_LIBPCAP63 #if defined(HAVE_LIBPCAP) && defined(HAVE_BPF) 64 64 struct ifreq ifr; 65 65 unsigned int arphrd; … … 125 125 return 0; 126 126 #else 127 return -1 127 return -1; 128 128 #endif 129 129 } … … 404 404 * pre-compiled. 405 405 */ 406 #ifdef HAVE_BPF 406 407 if (filter != NULL) { 407 408 /* Check if the filter was successfully compiled. If not, … … 424 425 } 425 426 } 427 #endif 426 428 427 429 /* Consume any buffered packets that were received before the socket -
lib/format_pcap.c
r5e3f16c rd47ca18 128 128 129 129 /* If a filter has been configured, compile and apply it */ 130 #ifdef HAVE_BPF 130 131 if (DATA(libtrace)->filter) { 131 132 if (DATA(libtrace)->filter->flag == 0) { … … 143 144 } 144 145 } 146 #endif 145 147 return 0; 146 148 } … … 152 154 switch(option) { 153 155 case TRACE_OPTION_FILTER: 156 #ifdef HAVE_BPF 154 157 DATA(libtrace)->filter=data; 155 158 return 0; 159 #else 160 return -1; 161 #endif 156 162 case TRACE_OPTION_SNAPLEN: 157 163 /* Snapping isn't supported directly, so fall thru … … 211 217 switch(option) { 212 218 case TRACE_OPTION_FILTER: 219 #ifdef HAVE_BPF 213 220 DATA(libtrace)->filter=(libtrace_filter_t*)data; 214 221 return 0; 222 #else 223 return -1; 224 #endif 215 225 case TRACE_OPTION_SNAPLEN: 216 226 DATA(libtrace)->snaplen=*(int*)data; … … 298 308 #endif 299 309 /* Set a filter if one is defined */ 310 #ifdef HAVE_BPF 300 311 if (DATA(libtrace)->filter) { 301 312 struct pcap_pkthdr *pcap_hdr = NULL; … … 342 353 return -1; 343 354 } 355 #endif 344 356 return 0; /* success */ 345 357 } -
lib/trace.c
radb2c4c rd47ca18 1350 1350 trace_create_filter_from_bytecode(void *bf_insns, unsigned int bf_len) 1351 1351 { 1352 #ifndef HAVE_BPF _FILTER1352 #ifndef HAVE_BPF 1353 1353 fprintf(stderr, "This version of libtrace does not have BPF support\n"); 1354 1354 return NULL; … … 1377 1377 */ 1378 1378 DLLEXPORT libtrace_filter_t *trace_create_filter(const char *filterstring) { 1379 #ifdef HAVE_BPF _FILTER1379 #ifdef HAVE_BPF 1380 1380 libtrace_filter_t *filter = (libtrace_filter_t*) 1381 1381 malloc(sizeof(libtrace_filter_t)); … … 1392 1392 DLLEXPORT void trace_destroy_filter(libtrace_filter_t *filter) 1393 1393 { 1394 #ifdef HAVE_BPF _FILTER1394 #ifdef HAVE_BPF 1395 1395 free(filter->filterstring); 1396 1396 if (filter->flag) … … 1417 1417 void *linkptr, 1418 1418 libtrace_linktype_t linktype ) { 1419 #ifdef HAVE_BPF _FILTER1419 #ifdef HAVE_BPF 1420 1420 /* It just so happens that the underlying libs used by pthread arn't 1421 1421 * thread safe, namely lex/flex thingys, so single threaded compile … … 1481 1481 DLLEXPORT int trace_apply_filter(libtrace_filter_t *filter, 1482 1482 const libtrace_packet_t *packet) { 1483 #ifdef HAVE_BPF _FILTER1483 #ifdef HAVE_BPF 1484 1484 void *linkptr = 0; 1485 1485 uint32_t clen = 0;
Note: See TracChangeset
for help on using the changeset viewer.