Changeset d47ca18 for lib/trace.c


Ignore:
Timestamp:
06/21/17 15:41:47 (4 years ago)
Author:
Richard Sanger <rsanger@…>
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
Message:

Fix issue #49 compile issues when missing BPF header file

If pcap was installed but somehow the BPF header was missing.
Libtrace was using two different macros HAVE_BPF and HAVE_BPF_FILTER
to determine if BPF was installed.

HAVE_BPF_FILTER was set if pcap was found, wereas HAVE_BPF was
set if the BPF header was found.

This removes and replaces HAVE_BPF_FILTER with HAVE_BPF.
It also adds ifdef blocks around formats that try to install
BPF filters directly as needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    radb2c4c rd47ca18  
    13501350trace_create_filter_from_bytecode(void *bf_insns, unsigned int bf_len)
    13511351{
    1352 #ifndef HAVE_BPF_FILTER
     1352#ifndef HAVE_BPF
    13531353        fprintf(stderr, "This version of libtrace does not have BPF support\n");
    13541354        return NULL;
     
    13771377 */
    13781378DLLEXPORT libtrace_filter_t *trace_create_filter(const char *filterstring) {
    1379 #ifdef HAVE_BPF_FILTER
     1379#ifdef HAVE_BPF
    13801380        libtrace_filter_t *filter = (libtrace_filter_t*)
    13811381                                malloc(sizeof(libtrace_filter_t));
     
    13921392DLLEXPORT void trace_destroy_filter(libtrace_filter_t *filter)
    13931393{
    1394 #ifdef HAVE_BPF_FILTER
     1394#ifdef HAVE_BPF
    13951395        free(filter->filterstring);
    13961396        if (filter->flag)
     
    14171417                void *linkptr,
    14181418                libtrace_linktype_t linktype    ) {
    1419 #ifdef HAVE_BPF_FILTER
     1419#ifdef HAVE_BPF
    14201420        /* It just so happens that the underlying libs used by pthread arn't
    14211421         * thread safe, namely lex/flex thingys, so single threaded compile
     
    14811481DLLEXPORT int trace_apply_filter(libtrace_filter_t *filter,
    14821482                        const libtrace_packet_t *packet) {
    1483 #ifdef HAVE_BPF_FILTER
     1483#ifdef HAVE_BPF
    14841484        void *linkptr = 0;
    14851485        uint32_t clen = 0;
Note: See TracChangeset for help on using the changeset viewer.