Changeset accdd5b


Ignore:
Timestamp:
02/13/14 17:43:57 (7 years ago)
Author:
Richard Sanger <rjs51@…>
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:
2bef800
Parents:
2138553
Message:

Fixes a bug in pcapfile format introduced with the nanosecond support which was casusing the test-write erf test to fail.
The dummy pcapfile trace created by a empty packet caused a segfault when getting timestamps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcapfile.c

    rbf1029a raccdd5b  
    614614        hdr = (libtrace_pcapfile_pkt_hdr_t*)packet->header;
    615615        ts.tv_sec = swapl(packet->trace,hdr->ts_sec);
    616         if (trace_in_nanoseconds(packet->header))
     616        /* Check trace is not a dummy calling trace_in_nanoseconds */
     617        if (DATA(packet->trace) && trace_in_nanoseconds(&DATA(packet->trace)->header))
    617618                ts.tv_usec = swapl(packet->trace, hdr->ts_usec) / 1000;
    618619        else
     
    625626{
    626627        libtrace_pcapfile_pkt_hdr_t *hdr;
    627         pcapfile_header_t *header = &(DATA(packet->trace)->header);
    628628        struct timespec ts;
    629629       
     
    632632        hdr = (libtrace_pcapfile_pkt_hdr_t*)packet->header;
    633633        ts.tv_sec = swapl(packet->trace,hdr->ts_sec);
    634         if (trace_in_nanoseconds(header))
     634        /* Check trace is not a dummy calling trace_in_nanoseconds */
     635        if (DATA(packet->trace) && trace_in_nanoseconds(&DATA(packet->trace)->header))
    635636                ts.tv_nsec = swapl(packet->trace, hdr->ts_usec);
    636637        else
     
    757758        NULL,                           /* get_erf_timestamp */
    758759        pcapfile_get_timeval,           /* get_timeval */
    759         pcapfile_get_timespec,          /* get_timespec */
     760        pcapfile_get_timespec,          /* get_timespec */
    760761        NULL,                           /* get_seconds */
    761762        NULL,                           /* seek_erf */
Note: See TracChangeset for help on using the changeset viewer.