Changeset 86087c53 for lib


Ignore:
Timestamp:
09/20/18 15:51:33 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
develop, master, ringperformance
Children:
73a5b72
Parents:
91bd90e
Message:

trace_get_packet_buffer() now returns NULL when content is invalid.

Remaining will also be set to zero.

Also fixed bug where the invalid content check would only be
performed *if* the user provided an output variable for storing
the linktype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r2201d8c r86087c53  
    11141114        int cap_len;
    11151115        int wire_len;
     1116        libtrace_linktype_t ltype;
    11161117
    11171118        assert(packet != NULL);
    1118         if (linktype) *linktype = trace_get_link_type(packet);
     1119        ltype = trace_get_link_type(packet);
     1120
     1121        if (linktype) {
     1122                *linktype = ltype;
     1123        }
     1124
     1125        if (ltype == TRACE_TYPE_CONTENT_INVALID) {
     1126                if (remaining) {
     1127                        *remaining = 0;
     1128                }
     1129                return NULL;
     1130        }
     1131
    11191132        if (remaining) {
    1120                 if (linktype && *linktype == TRACE_TYPE_CONTENT_INVALID) {
    1121                         return (void *)packet->payload;
    1122                 }
    1123 
    11241133                /* I think we should choose the minimum of the capture and
    11251134                 * wire lengths to be the "remaining" value. If the packet has
Note: See TracChangeset for help on using the changeset viewer.