Changeset 528eb6e for lib/linktypes.c


Ignore:
Timestamp:
12/04/12 15:24:34 (9 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:
b4c3f61
Parents:
fd87898
Message:
  • A very cut-down version of int: and ring: is now built on non-Linux systems, enabling them to be able to decode packets captured using those formats and exported via RT
  • Replaced arphrd.h with a new header file (libtrace_arphrd.h) that provides our own #defines for the various ARPHRD types. The inconsistency between what is available on different OS's was becoming problematic.
  • Increased RT buffer size so we can always fit a complete libtrace buffer into it - int: over RT tends to result in very large "packets".
  • Fixed copy-paste error in the failure case when creating a dummy linux trace in format_rt.c
  • Updated various bits of code to use the new LIBTRACE_ARPHRD types where sensible
  • Removed unneeded #include in protocols_pktmeta.c
  • Replaced u32 and u16 types in format_linux with more portable uint32_t and uint16_t types
  • Removed unneeded calls to linuxnative_init_input in the prepare_packet functions in format_linux.c
  • Don't call the fin_input function on a trace if the format does not provide one
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/linktypes.c

    re1f3b6b r528eb6e  
    4141#include <string.h>
    4242
    43 #include "arphrd.h"
     43#include "libtrace_arphrd.h"
    4444
    4545
     
    207207libtrace_linktype_t arphrd_type_to_libtrace(unsigned int arphrd) {
    208208        switch(arphrd) {
    209                 case ARPHRD_ETHER: return TRACE_TYPE_ETH;       
    210                 case ARPHRD_EETHER: return TRACE_TYPE_ETH;     
    211                 case ARPHRD_IEEE80211: return TRACE_TYPE_80211;
    212                 case ARPHRD_80211_RADIOTAP: return TRACE_TYPE_80211_RADIO;
    213                 case ARPHRD_PPP: return TRACE_TYPE_NONE;
    214                 case ARPHRD_LOOPBACK: return TRACE_TYPE_ETH;
    215                 case ARPHRD_NONE: return TRACE_TYPE_NONE;
     209                case LIBTRACE_ARPHRD_ETHER: return TRACE_TYPE_ETH;     
     210                case LIBTRACE_ARPHRD_EETHER: return TRACE_TYPE_ETH;     
     211                case LIBTRACE_ARPHRD_IEEE80211: return TRACE_TYPE_80211;
     212                case LIBTRACE_ARPHRD_IEEE80211_RADIOTAP: return TRACE_TYPE_80211_RADIO;
     213                case LIBTRACE_ARPHRD_PPP: return TRACE_TYPE_NONE;
     214                case LIBTRACE_ARPHRD_LOOPBACK: return TRACE_TYPE_ETH;
     215                case LIBTRACE_ARPHRD_NONE: return TRACE_TYPE_NONE;
    216216        }
    217217        printf("Unknown ARPHRD %08x\n",arphrd);
     
    221221unsigned int libtrace_to_arphrd_type(libtrace_linktype_t linktype) {
    222222        switch(linktype) {
    223                 case TRACE_TYPE_ETH: return ARPHRD_ETHER;
    224                 case TRACE_TYPE_80211: return ARPHRD_IEEE80211;
    225                 case TRACE_TYPE_80211_RADIO: return ARPHRD_80211_RADIOTAP;
     223                case TRACE_TYPE_ETH: return LIBTRACE_ARPHRD_ETHER;
     224                case TRACE_TYPE_80211: return LIBTRACE_ARPHRD_IEEE80211;
     225                case TRACE_TYPE_80211_RADIO: return LIBTRACE_ARPHRD_IEEE80211_RADIOTAP;
    226226                default: break;
    227227        }
     
    266266                        case TRACE_TYPE_NONE:
    267267                                trace_get_layer3(packet, &hdr->protocol, NULL);
    268                                 hdr->hatype = htons(ARPHRD_PPP);
     268                                hdr->hatype = htons(LIBTRACE_ARPHRD_PPP);
    269269                                hdr->protocol=htons(hdr->protocol);
    270270                                break;
    271271                        case TRACE_TYPE_ETH:
    272                                 hdr->hatype = htons(ARPHRD_ETHER);
     272                                hdr->hatype = htons(LIBTRACE_ARPHRD_ETHER);
    273273                                hdr->protocol=htons(0x0060); /* ETH_P_LOOP */
    274274                                break;
     
    368368               
    369369                        /* Preserved from older libtrace behaviour */
    370                         if (ha_type == ARPHRD_PPP)
     370                        if (ha_type == LIBTRACE_ARPHRD_PPP)
    371371                                packet->type = pcap_linktype_to_rt(TRACE_DLT_RAW);
    372372                        /* Don't decide trace type based on ha_type,
Note: See TracChangeset for help on using the changeset viewer.