Changeset 29c8666 for lib


Ignore:
Timestamp:
11/05/08 16:46:04 (13 years ago)
Author:
Perry Lorier <perry@…>
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:
edb844c
Parents:
13fd6e1
Message:

Deal with PoS traces better

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/format_legacy.c

    r8babb98 r29c8666  
    311311static libtrace_linktype_t legacypos_get_link_type(
    312312                const libtrace_packet_t *packet) {
    313         /* This code used to look for (0x0F|0x8F 0x00) frames
    314          * and return TRACE_TYPE_HDLC_POS, otherwise return PPP.
    315          * However the PPP frames were being decoded using HDLC_POS semantics
    316          * so when we fixed PPP, this all broke.  I've changed this to always
    317          * assume HDLC_POS.  If we ever find a trace that does raw PPP over
    318          * HDLC_POS then this should be changed to detect that it's PPP and
    319          * do the right thing.  I suspect this is due to an original confusion
    320          * as to how exactly POS works.
    321          *  -- Perry Lorier (2008-10-14)
     313        /* POS can be PPP over HDLC (DLT_PPP_SERIAL), or it can be
     314         * just straight PPP.  Sigh.
     315         *
     316         * Ref: RFC 1549
     317         *      - Perry Lorier (2008-11-04)
    322318         */
    323         return TRACE_TYPE_HDLC_POS;
     319        if (((char *)packet->payload)[0] == '\xFF'
     320                && ((char*)packet->payload)[1] == '\x03')
     321                return TRACE_TYPE_POS;
     322        else
     323                return TRACE_TYPE_PPP;
    324324}
    325325
  • lib/linktypes.c

    r121b7e2 r29c8666  
    4444                case TRACE_DLT_ATM_RFC1483: return TRACE_TYPE_LLCSNAP;
    4545                case TRACE_DLT_PPP: return TRACE_TYPE_PPP;
     46                case TRACE_DLT_PPP_SERIAL: return TRACE_TYPE_POS;
    4647                /* Unhandled */
    4748                case TRACE_DLT_NULL:    /* Raw IP frame with a BSD specific
     
    7071                case TRACE_TYPE_PPP:    return TRACE_DLT_PPP;
    7172                case TRACE_TYPE_HDLC_POS: return TRACE_DLT_C_HDLC;
     73                /* Theres more than one type of PPP.  Who knew? */
     74                case TRACE_TYPE_POS:    return TRACE_DLT_PPP_SERIAL;
     75
    7276                /* Below here are unsupported conversions */
    7377                /* Dispite hints to the contrary, there is no DLT
     
    8488                case TRACE_TYPE_80211_PRISM:   
    8589                /* Probably == PPP */
    86                 case TRACE_TYPE_POS:
    8790                /* TODO: We haven't researched these yet */
    8891                case TRACE_TYPE_AAL5:
  • lib/protocols_l2.c

    raa22b5b r29c8666  
    223223
    224224        if (type) {
    225                 *type=ntohs(chdlc->ethertype);
     225                switch(ntohs(chdlc->ethertype)) {
     226                        case 0x0021: /* IP */
     227                                *type = 0x0800;
     228                                break;
     229                        default:
     230                                printf("Unknown chdlc type: %04x\n",ntohs(chdlc->ethertype));
     231                                *type = 0; /* Unknown */
     232                }
    226233        }
    227234
     
    307314{
    308315        void *l;
     316        assert(linktype != -1);
    309317        switch(linktype) {
    310318                /* Packet Metadata headers, not layer2 headers */
     
    350358                        return trace_get_payload_from_chdlc(link,ethertype,
    351359                                        remaining);
     360                case TRACE_TYPE_POS:
     361                        return trace_get_payload_from_chdlc(link,ethertype,
     362                                        remaining);
    352363                /* TODO: Unsupported */
    353                 case TRACE_TYPE_POS:
    354364                case TRACE_TYPE_AAL5:
    355365                        return NULL;
Note: See TracChangeset for help on using the changeset viewer.