Changeset 244426f


Ignore:
Timestamp:
12/04/12 10:59:50 (8 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
fd87898
Parents:
e1f3b6b
Message:
  • Hopefully add the ability to decode BPF over RT
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_rt.c

    re90d5a8 r244426f  
    105105        libtrace_t *dummy_pcap;
    106106        libtrace_t *dummy_linux;
     107        libtrace_t *dummy_bpf;
    107108};
    108109
     
    198199        RT_INFO->dummy_pcap = NULL;
    199200        RT_INFO->dummy_linux = NULL;
     201        RT_INFO->dummy_bpf = NULL;
    200202        RT_INFO->pkt_buffer = NULL;
    201203        RT_INFO->buf_current = NULL;
     
    290292        if (RT_INFO->dummy_linux)
    291293                trace_destroy_dead(RT_INFO->dummy_linux);
     294
     295        if (RT_INFO->dummy_bpf)
     296                trace_destroy_dead(RT_INFO->dummy_bpf);
    292297        free(libtrace->format_data);
    293298        return 0;
     
    402407        }
    403408
     409        if (packet->type > TRACE_RT_DATA_BPF &&
     410                        packet->type < TRACE_RT_DATA_DLT_END) {
     411
     412                if (!RT_INFO->dummy_bpf) {
     413                        RT_INFO->dummy_bpf = trace_create_dead("bpf:-");
     414                        /* This may fail on a non-BSD machine */
     415                        if (trace_is_err(RT_INFO->dummy_bpf)) {
     416                                trace_perror(RT_INFO->dummy_bpf, "Creating dead bpf trace");
     417                                return -1;
     418                        }
     419                }
     420                packet->trace = RT_INFO->dummy_bpf;
     421                return 0;
     422        }
     423
    404424        switch (packet->type) {
    405425                case TRACE_RT_DUCK_2_4:
     
    419439                        if (!RT_INFO->dummy_linux) {
    420440                                RT_INFO->dummy_linux = trace_create_dead("int:");
     441                                /* This may fail on a non-Linux machine */
     442                                if (trace_is_err(RT_INFO->dummy_linux)) {
     443                                        trace_perror(RT_INFO->dummy_linux, "Creating dead bpf trace");
     444                                        return -1;
     445                                }
    421446                        }
    422447                        packet->trace = RT_INFO->dummy_linux;
Note: See TracChangeset for help on using the changeset viewer.