Changeset 0277ab8 for lib/

08/05/15 13:50:02 (5 years ago)
Shane Alcock <salcock@…>
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

Completed improvement of trace_strip_packet()

  • Removed the trace_copy_packet() if the packet is not totally owned by libtrace. I think we can get away without it and we really don't want the performance hit when dealing with live captures.
  • Replaced call to trace_get_layer3 with the old header parsing code from the previous version of trace_strip_packet(). The overhead of calling trace_get_layer3 was outweighing the performance gain from the change in memmove strategy.
  • Removed ability to selectively strip VLAN or MPLS headers only -- this was not that useful and supporting it would make the code much more complex.
  • Updated trace_get_layer3 to use the cached layer 2 header if available rather than making a call to trace_get_layer2 and getting it from there. This saves us a bit of function call overhead.
  • Make sure we reset the layer 2 cached info if we shift the Ethernet header.
  • Strip PPPoE in addition to MPLS and VLAN.
1 edited


  • lib/

    r7428ab2 r0277ab8  
    16031603void *trace_get_link(const libtrace_packet_t *packet);
    1605 /**
    1606  * Supported masks for stripping headers from packets.
    1607  */
    1608 enum {
    1609         TRACE_STRIP_VLAN = 0x01, /**< Strip 802.1Q (VLAN tag) headers */
    1610         TRACE_STRIP_MPLS = 0x02  /**< Strip MPLS headers */
    1611 };
    1613 /** Strips certain headers from a given packet.
     1605/** Strips layer 2.5 headers from a given packet.
    16141606 * @param packet        The packet to strip headers from.
    1615  * @param stripopts     A mask to indicate which headers should be stripped.
    1616  * If multiple header types are to be stripped, these should be ORed together
    1617  * to create the full mask. A mask of zero will strip all strippable headers.
    16181607 *
    16191608 * @return The packet with the requested headers removed (if they were
    16361625 * the original packet being returned unmodified.
    16371626 *
    1638  * @note Depending on the input source, this function may need to copy the
    1639  * original packet to be able to safely modify the contents. This may have
    1640  * a major impact on performance so avoid stripping packets unless absolutely
    1641  * necessary.
    1642  */
    1643 DLLEXPORT libtrace_packet_t *trace_strip_packet(libtrace_packet_t *packet,
    1644                 int stripopts);
     1627 */
     1628DLLEXPORT libtrace_packet_t *trace_strip_packet(libtrace_packet_t *packet);
    16461630/** Get a pointer to the IPv4 header (if any) for a given packet
Note: See TracChangeset for help on using the changeset viewer.