Changeset d242ea8 for lib/trace.c


Ignore:
Timestamp:
02/07/07 16:46:43 (14 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:
43ab7b3
Parents:
205809b
Message:

Some of tracesummary's bpf filters were incorrect - however the new correct filters don't work so well with the output format so that will need fixing at some point
Improved error reporting for bpf filters
tracestats will now ignore a filter that fails and print a single warning. It also no longer increments the counter for filters that fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r205809b rd242ea8  
    975975       
    976976        if (filter->filterstring && ! filter->flag) {
    977                 pcap_t *pcap;
     977                pcap_t *pcap = NULL;
    978978                libtrace_linktype_t linktype=trace_get_link_type(packet);
    979979                if (linktype==(libtrace_linktype_t)-1) {
     
    985985                if (libtrace_to_pcap_dlt(linktype) == ~1U) {
    986986                        trace_set_err(packet->trace,TRACE_ERR_BAD_PACKET,
    987                                         "Unknown pcap equivilent linktype");
     987                                        "Unknown pcap equivalent linktype");
    988988                        return -1;
    989989                }
     
    992992                                1500U);
    993993                /* build filter */
     994                assert(pcap);
    994995                if (pcap_compile( pcap, &filter->filter, filter->filterstring,
    995996                                        1, 0)) {
     997                        trace_set_err(packet->trace,TRACE_ERR_BAD_PACKET,
     998                                        "Unable to compile the filter \"%s\": %s",
     999                                        filter->filterstring,
     1000                                        pcap_geterr(pcap));
    9961001                        pcap_close(pcap);
    997                         trace_set_err(packet->trace,TRACE_ERR_BAD_PACKET,
    998                                         "Packet has no payload");
    9991002                        return -1;
    10001003                }
Note: See TracChangeset for help on using the changeset viewer.