Changeset 7aa2a21


Ignore:
Timestamp:
08/26/15 10:11:15 (5 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
39c3ce7, 7c17e4a, e187b16
Parents:
84cdb05
Message:

Fix bad framing calculation when converting to ERF

The bug was caused by our newly added support for ERF extension
headers. Previously, erf_get_framing_length() didn't actually
inspect the contents of the packet passed to it but now it does (to
try and detect any extension headers).

This means that when converting from another format, we can't call
erf_get_framing_length on the original packet anymore to work out
how much framing space we need as it will interpret the original
packet contents as an ERF header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    rb13caea r7aa2a21  
    659659                dag_record_t erfhdr;
    660660                int rlen;
     661                int framing;
    661662                /* convert format - build up a new erf header */
    662663                /* Timestamp */
     
    679680                assert(trace_get_capture_length(packet)>0
    680681                                && trace_get_capture_length(packet)<=65536);
    681                 assert(erf_get_framing_length(packet)>0
    682                                 && trace_get_framing_length(packet)<=65536);
    683 
    684                 rlen = trace_get_capture_length(packet) +
    685                                 erf_get_framing_length(packet);
     682                assert(trace_get_framing_length(packet)<=65536);
     683               
     684                if (erfhdr.type == TYPE_ETH)
     685                        framing = dag_record_size + 2;
     686                else
     687                        framing = dag_record_size;
     688               
     689                rlen = trace_get_capture_length(packet) + framing;
    686690                assert(rlen > 0 && rlen <= 65536);
    687691                erfhdr.rlen = htons(rlen);
Note: See TracChangeset for help on using the changeset viewer.