Ignore:
Timestamp:
02/22/11 10:01:08 (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:
e4e94c38
Parents:
ae76c14
Message:
  • Fixed poor performance of the event API by greatly reducing the amount of packets created, copied and freed
  • We now cache the transport header and payload length for each packet
  • We now deal with Linux SLL Ethernet captures taken using tcpdump with -i any correctly.
  • Changed parameters for internal function trace_get_payload_from_sll - it now sets both the arphrd type and the next protocol
  • Moved ARPHRD definitions into a separate header file, as they come in handy anywhere we deal with SLL headers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols_pktmeta.c

    r1326d5f r9cc1266  
    6161/* NB: type is returned as an ARPHRD_ type for SLL*/
    6262void *trace_get_payload_from_linux_sll(const void *link,
    63                 uint16_t *type, uint32_t *remaining)
     63                uint16_t *arphrd_type, uint16_t *next,
     64                uint32_t *remaining)
    6465{
    6566        libtrace_sll_header_t *sll;
     
    7576        }
    7677
    77         if (type) *type = ntohs(sll->hatype);
     78        /* The SLL header is actually in place of a link layer header, so
     79         * we want to use the protocol field to tell our caller what the
     80         * next header is going to be */
     81        if (next) *next = (libtrace_linktype_t)(ntohs(sll->protocol));
     82        if (arphrd_type) *arphrd_type = ntohs(sll->hatype);
    7883
    7984        return (void*)((char*)sll+sizeof(*sll));
     
    189194                case TRACE_TYPE_LINUX_SLL:
    190195                        nexthdr = trace_get_payload_from_linux_sll(meta,
    191                                         &arphrd, remaining);
    192                         *linktype = arphrd_type_to_libtrace(arphrd);
     196                                        &arphrd, NULL, remaining);
     197
     198                        /* Ethernet header is usually absent in SLL captures,
     199                         * so we don't want to skip it just yet */
     200                        if (arphrd_type_to_libtrace(arphrd) == TRACE_TYPE_ETH)
     201                                *linktype = TRACE_TYPE_NONE;
     202                        else
     203                                *linktype = arphrd_type_to_libtrace(arphrd);
    193204                        return nexthdr;
    194205                case TRACE_TYPE_80211_RADIO:
Note: See TracChangeset for help on using the changeset viewer.