Changeset fdf1f7b


Ignore:
Timestamp:
06/23/17 14:25:59 (4 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
4578626
Parents:
633339d (diff), 1105ce0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/develop' into pcapng-reader

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • configure.in

    rd759ee1 rd47ca18  
    250250        LIBTRACE_LIBS="$LIBTRACE_LIBS -lpcap"
    251251        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
    252         AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
    253252
    254253        LIBS="-lpcap"
  • lib/format_linux_common.c

    rdb84bb2 rd47ca18  
    6161static int linuxnative_configure_bpf(libtrace_t *libtrace,
    6262                libtrace_filter_t *filter) {
    63 #ifdef HAVE_LIBPCAP
     63#if defined(HAVE_LIBPCAP) && defined(HAVE_BPF)
    6464        struct ifreq ifr;
    6565        unsigned int arphrd;
     
    125125        return 0;
    126126#else
    127         return -1
     127        return -1;
    128128#endif
    129129}
     
    404404         * pre-compiled.
    405405         */
     406#ifdef HAVE_BPF
    406407        if (filter != NULL) {
    407408                /* Check if the filter was successfully compiled. If not,
     
    424425                }
    425426        }
     427#endif
    426428
    427429        /* Consume any buffered packets that were received before the socket
  • lib/format_pcap.c

    r633339d rfdf1f7b  
    128128
    129129        /* If a filter has been configured, compile and apply it */
     130#ifdef HAVE_BPF
    130131        if (DATA(libtrace)->filter) {
    131132                if (DATA(libtrace)->filter->flag == 0) {
     
    143144                }
    144145        }
     146#endif
    145147        return 0;
    146148}
     
    152154        switch(option) {
    153155                case TRACE_OPTION_FILTER:
     156#ifdef HAVE_BPF
    154157                        DATA(libtrace)->filter=data;
    155158                        return 0;
     159#else
     160                        return -1;
     161#endif
    156162                case TRACE_OPTION_SNAPLEN:
    157163                        /* Snapping isn't supported directly, so fall thru
     
    211217        switch(option) {
    212218                case TRACE_OPTION_FILTER:
     219#ifdef HAVE_BPF
    213220                        DATA(libtrace)->filter=(libtrace_filter_t*)data;
    214221                        return 0;
     222#else
     223                        return -1;
     224#endif
    215225                case TRACE_OPTION_SNAPLEN:
    216226                        DATA(libtrace)->snaplen=*(int*)data;
     
    298308#endif
    299309        /* Set a filter if one is defined */
     310#ifdef HAVE_BPF
    300311        if (DATA(libtrace)->filter) {
    301312                struct pcap_pkthdr *pcap_hdr = NULL;
     
    342353                        return -1;
    343354        }
     355#endif
    344356        return 0; /* success */
    345357}
  • 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;
  • lib/trace_parallel.c

    rf4fdcd1 rb606855  
    805805                                        break;
    806806                                case MESSAGE_DO_STOP:
     807                                        /* Either FINISHED or FINISHING */
    807808                                        assert(trace->started == false);
    808                                         assert(trace->state == STATE_FINISHED);
    809809                                        /* Mark the current packet as EOF */
    810810                                        packet->error = 0;
    811                                         break;
     811                                        goto hasher_eof;
    812812                                default:
    813813                                        fprintf(stderr, "Hasher thread didn't expect message code=%d\n", message.code);
     
    850850                }
    851851        }
    852 
     852hasher_eof:
    853853        /* Broadcast our last failed read to all threads */
    854854        for (i = 0; i < trace->perpkt_thread_count; i++) {
     
    862862                ASSERT_RET(pthread_mutex_lock(&trace->libtrace_lock), == 0);
    863863                if (trace->perpkt_threads[i].state != THREAD_FINISHED) {
    864                         // Unlock early otherwise we could deadlock
    865864                        libtrace_ringbuffer_write(&trace->perpkt_threads[i].rbuffer, bcast);
     865                } else {
     866                        libtrace_ocache_free(&trace->packet_freelist, (void **) &bcast, 1, 1);
    866867                }
    867868                ASSERT_RET(pthread_mutex_unlock(&trace->libtrace_lock), == 0);
Note: See TracChangeset for help on using the changeset viewer.