Changeset ed636fb4


Ignore:
Timestamp:
03/17/06 13:44:13 (15 years ago)
Author:
Perry Lorier <perry@…>
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:
eea0f87
Parents:
5ad7ad0
Message:

Codify the fact that trace_get_wire_length includes the FCS

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcap.c

    r85a0d42 red636fb4  
    300300        if (packet->trace->format == &pcap ||
    301301                        packet->trace->format == &pcapint) {
    302                 pcap_dump((u_char*)OUTPUT.trace.dump,(struct pcap_pkthdr *)packet->header,packet->payload);
     302                pcap_dump((u_char*)OUTPUT.trace.dump,
     303                                (struct pcap_pkthdr *)packet->header,
     304                                packet->payload);
    303305        } else {
    304306                /* Leave the manual copy as it is, as it gets around
     
    309311                pcap_pkt_hdr.ts.tv_usec = ts.tv_usec;
    310312                pcap_pkt_hdr.caplen = trace_get_capture_length(packet);
    311                 pcap_pkt_hdr.len = trace_get_wire_length(packet);
     313                /* trace_get_wire_length includes FCS, while pcap doesn't */
     314                if (trace_get_link_type(packet)==TRACE_TYPE_ETH)
     315                        pcap_pkt_hdr.len = trace_get_wire_length(packet)-4;
     316                else
     317                        pcap_pkt_hdr.len = trace_get_wire_length(packet);
    312318
    313319                assert(pcap_pkt_hdr.caplen<65536);
     
    409415        pcapptr = (struct pcap_pkthdr *)packet->header;
    410416        assert(pcapptr->caplen<=65536);
     417
    411418        return pcapptr->caplen;
    412419}
     
    415422        struct pcap_pkthdr *pcapptr = 0;
    416423        pcapptr = (struct pcap_pkthdr *)packet->header;
    417         return pcapptr->len;
     424        if (packet->type==pcap_dlt_to_rt(DLT_EN10MB))
     425                return pcapptr->len+4; /* Include the missing FCS */
     426        else
     427                return pcapptr->len;
    418428}
    419429
  • lib/libtrace.h

    r752709f red636fb4  
    811811 * @note Due to the trace being a header capture, or anonymisation this may
    812812 * not be the same as the Capture Len.
     813 * @note trace_getwire_length \em{includes} FCS.
    813814 */
    814815SIMPLE_FUNCTION
Note: See TracChangeset for help on using the changeset viewer.