Changeset e373992


Ignore:
Timestamp:
08/25/06 13:59:24 (14 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:
85a79b0
Parents:
483abab
Message:

Deal with packets that are corrupt/truncated, since pcap doesn't have a way
of flagging packets as being "bad"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcap.c

    r5d233a5 re373992  
    326326                }
    327327        }
     328
     329        /* Corrupt packet, or other "non data" packet, so skip it */
     330        if (trace_get_link(packet) == NULL) {
     331                /* Return "success", but nothing written */
     332                return 0;
     333        }
     334
    328335        if (packet->trace->format == &pcap ||
    329336                        packet->trace->format == &pcapint) {
     
    341348                /* trace_get_wire_length includes FCS, while pcap doesn't */
    342349                if (trace_get_link_type(packet)==TRACE_TYPE_ETH)
    343                         pcap_pkt_hdr.len = trace_get_wire_length(packet)-4;
     350                        if (trace_get_wire_length(packet) >= 4) {
     351                                pcap_pkt_hdr.len =
     352                                        trace_get_wire_length(packet)-4;
     353                        }
     354                        else {
     355                                pcap_pkt_hdr.len = 0;
     356                        }
    344357                else
    345358                        pcap_pkt_hdr.len = trace_get_wire_length(packet);
Note: See TracChangeset for help on using the changeset viewer.