Changeset d3320d1


Ignore:
Timestamp:
07/16/10 11:42:23 (10 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:
53f179f
Parents:
b185327
Message:
  • Handle dodgy wire lengths better - this solution tends towards hand-waving, as it tends to just perpetuate the error rather than trying to fix it.
Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pcapfile.c

    r325f86f rd3320d1  
    187187
    188188                DATA(libtrace)->started = true;
    189 
    190                 if (err<1)
     189                assert(sizeof(DATA(libtrace)->header) > 0);
     190               
     191                if (err<1) {
     192
    191193                        return -1;
     194                }
    192195               
    193196                if (swapl(libtrace,DATA(libtrace)->header.magic_number) !=
     
    457460                hdr.wirelen = trace_get_wire_length(packet);
    458461
    459         assert(hdr.wirelen < LIBTRACE_PACKET_BUFSIZE);
     462        /* Reason for removing this assert:
     463         *
     464         * There exist some packets, e.g. in IPLS II, where the wire length
     465         * is clearly corrupt. When converting to pcap, we *could* try to
     466         * adjust the wire length to something sane but for now, I'll just let
     467         * the broken length persist through the conversion.
     468         *
     469         * XXX Is setting the wire length to zero the best solution in such
     470         * cases?
     471         */
     472
     473        /* assert(hdr.wirelen < LIBTRACE_PACKET_BUFSIZE); */
    460474
    461475        /* Ensure we have a valid capture length, especially if we're going
  • lib/trace.c

    rb185327 rd3320d1  
    840840                wire_len = trace_get_wire_length(packet);
    841841
    842                 assert(cap_len >= 0 && wire_len >= 0);
    843                 if (wire_len < cap_len)
     842                assert(cap_len >= 0);
     843
     844                /* There is the odd corrupt packet, e.g. in IPLS II, that have
     845                 * massively negative wire lens. We could assert fail here on
     846                 * them, but we could at least try the capture length instead.
     847                 *
     848                 * You may still run into problems if you try to write that
     849                 * packet, but at least reading should work OK.
     850                 */
     851                if (wire_len < 0)
     852                        *remaining = cap_len;
     853                else if (wire_len < cap_len)
    844854                        *remaining = wire_len;
    845855                else
Note: See TracChangeset for help on using the changeset viewer.