Changeset 2f3a25e for lib


Ignore:
Timestamp:
11/01/06 10:33:29 (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:
7ca2c7d
Parents:
19c6cbe
Message:

Use DLT_RAW instead of DLT_NULL when writing out raw IP.
Also don't strip the 4 byte FCS off non-ethernet traces.

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcapfile.c

    rc9f6ee5 r2f3a25e  
    305305        hdr.caplen = trace_get_capture_length(packet);
    306306        /* PCAP doesn't include the FCS, we do */
    307         hdr.wirelen = trace_get_wire_length(packet)-4;
     307        if (trace_get_link_type(packet)==TRACE_TYPE_ETH)
     308                if (trace_get_wire_length(packet) >= 4) {
     309                        hdr.wirelen =
     310                                        trace_get_wire_length(packet)-4;
     311                }
     312                else {
     313                        hdr.wirelen = 0;
     314                }
     315        else
     316                hdr.wirelen = trace_get_wire_length(packet);
     317
    308318
    309319        numbytes=libtrace_io_write(DATAOUT(out)->file,
  • lib/libtrace.h.in

    r10a46bd r2f3a25e  
    196196};
    197197
    198 /** Enumeration of DLT types supported by libtrace */
     198/** Enumeration of DLT types supported by libtrace
     199 * These aren't actually DLTs, but LINKTYPE_'s, so becareful when modifying
     200 * this.
     201 */
    199202typedef enum {
    200203        TRACE_DLT_NULL = 0,
    201204        TRACE_DLT_EN10MB = 1,
    202205        TRACE_DLT_ATM_RFC1483 = 11,
     206        TRACE_DLT_RAW = 101,
    203207        TRACE_DLT_IEEE802_11 = 105,
    204208        TRACE_DLT_LINUX_SLL = 113,
  • lib/linktypes.c

    r5551415 r2f3a25e  
    3535{
    3636        switch(dlt) {
    37                 case TRACE_DLT_NULL: return TRACE_TYPE_NONE;
     37                case TRACE_DLT_RAW: return TRACE_TYPE_NONE;
    3838                case TRACE_DLT_EN10MB: return TRACE_TYPE_ETH;
    3939                case TRACE_DLT_IEEE802_11: return TRACE_TYPE_80211;
     
    5555         */
    5656        switch(type) {
    57                 case TRACE_TYPE_NONE: return TRACE_DLT_NULL;
     57                case TRACE_TYPE_NONE: return TRACE_DLT_RAW;
    5858                case TRACE_TYPE_ETH: return TRACE_DLT_EN10MB;
    5959                case TRACE_TYPE_80211: return TRACE_DLT_IEEE802_11;
     
    259259                                        ->hatype)) {
    260260                                case ARPHRD_PPP:
    261                                         packet->type=pcap_dlt_to_rt(TRACE_DLT_NULL);
     261                                        packet->type=pcap_dlt_to_rt(TRACE_DLT_RAW);
    262262                                        break;
    263263                                case ARPHRD_ETHER:
Note: See TracChangeset for help on using the changeset viewer.