Changeset 77f79c7 for lib/protocols_l2.c


Ignore:
Timestamp:
03/27/13 14:48:26 (8 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:
593a7c7
Parents:
fc8b322
Message:
  • Added support for the OpenBSD loopback DLT - thanks to Kaio Rafael for submitting a patch to add this (although note the change to the defined names from the original patch)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols_l2.c

    r979a84f4 r77f79c7  
    381381                case TRACE_TYPE_METADATA:
    382382                case TRACE_TYPE_NONDATA:
     383                case TRACE_TYPE_OPENBSD_LOOP:
    383384                        ((libtrace_packet_t*)packet)->l2_header = meta;
    384385                        ((libtrace_packet_t*)packet)->l2_remaining = *remaining;
     
    413414                                case TRACE_TYPE_METADATA:
    414415                                case TRACE_TYPE_NONDATA:
     416                                case TRACE_TYPE_OPENBSD_LOOP:
    415417                                        ((libtrace_packet_t*)packet)->l2_header = meta;
    416418                                        ((libtrace_packet_t*)packet)->l2_remaining = *remaining;
     
    517519                case TRACE_TYPE_AAL5:
    518520                        return NULL;
     521
     522                case TRACE_TYPE_OPENBSD_LOOP:
     523                        link = link + 4; /* Loopback header is 4 bytes */
     524                        if ((*(char*)link&0xF0) == 0x40)
     525                                *ethertype=TRACE_ETHERTYPE_IP;   /* IPv4 */
     526                        else if ((*(char*)link&0xF0) == 0x60)
     527                                *ethertype=TRACE_ETHERTYPE_IPV6; /* IPv6 */
     528                        return link; /* I love the simplicity */
     529               
     530
    519531        }
    520532        return NULL;
     
    574586                case TRACE_TYPE_PPP:
    575587                case TRACE_TYPE_NONDATA:
     588                case TRACE_TYPE_OPENBSD_LOOP:
    576589                        return NULL;
    577590
     
    621634                case TRACE_TYPE_PPP:   
    622635                case TRACE_TYPE_NONDATA:
     636                case TRACE_TYPE_OPENBSD_LOOP:
    623637                        /* No MAC address */
    624638                        return NULL;
Note: See TracChangeset for help on using the changeset viewer.