Changeset 0a1d2d0


Ignore:
Timestamp:
01/08/15 19:03:35 (7 years ago)
Author:
Richard Sanger <rsangerarj@…>
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:
1919caf
Parents:
706561a
Message:

Fixes finishing copied ring packets which was causing an assertion to fire

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux.c

    r706561a r0a1d2d0  
    11041104                        (int)LIBTRACE_PACKET_BUFSIZE-(int)sizeof(*hdr),
    11051105                        (int)FORMAT(libtrace->format_data)->snaplen);
    1106 
    11071106        /* Prepare the msghdr and iovec for the kernel to write the
    11081107         * captured packet into. The msghdr will point to the part of our
     
    11841183        }
    11851184
    1186                        
    1187                        
    11881185       
    11891186        if (hdr->wirelen==~0U) {
     
    13111308static void linuxring_fin_packet(libtrace_packet_t *packet)
    13121309{
    1313 
    13141310        if (packet->buffer == NULL)
    13151311                return;
    13161312        assert(packet->trace);
    13171313       
    1318         // Started should always match the existence of the rx_ring
    1319         assert(!!FORMAT(packet->trace->format_data)->rx_ring == !!packet->trace->started);
    1320        
    1321         // Our packets are always under our control
    1322         assert(packet->buf_control == TRACE_CTRL_EXTERNAL);
    1323        
    1324         if (FORMAT(packet->trace->format_data)->rx_ring) // If we don't have a ring its already been destroyed or paused
    1325                 ring_release_frame(packet->trace, packet);
    1326         else
    1327                 packet->buffer = NULL;
     1314        /* If we own the packet (i.e. it's not a copy), we need to free it */
     1315        if (packet->buf_control == TRACE_CTRL_EXTERNAL) {
     1316                /* Started should always match the existence of the rx_ring */
     1317                assert(!!FORMAT(packet->trace->format_data)->rx_ring ==
     1318                       !!packet->trace->started);
     1319                /* If we don't have a ring its already been destroyed */
     1320                if (FORMAT(packet->trace->format_data)->rx_ring)
     1321                        ring_release_frame(packet->trace, packet);
     1322                else
     1323                        packet->buffer = NULL;
     1324        }
    13281325}
    13291326
Note: See TracChangeset for help on using the changeset viewer.