Changeset 4a207b8 for lib/protocols.c


Ignore:
Timestamp:
03/23/07 16:41:03 (15 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:
dbdc23f
Parents:
83f2cbf
Message:

Endace POS traces are in fact PPP traces. Deal with this correctly, even when
converting between trace formats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols.c

    reb1aab2 r4a207b8  
    206206}
    207207
    208 void *trace_get_payload_from_pos(void *link,
     208void *trace_get_payload_from_ppp(void *link,
    209209                uint16_t *type, uint32_t *remaining)
    210210{
    211211        /* 64 byte capture. */
    212         libtrace_pos_t *pos = (libtrace_pos_t*)link;
    213 
    214         if (remaining) {
    215                 if (*remaining < sizeof(libtrace_pos_t))
    216                         return NULL;
    217                 *remaining-=sizeof(libtrace_pos_t);
    218         }
    219 
    220         /* This is documented by endace to be an ethertype.  The ethertype
    221          * however is always ntohs(0x0021), which endace in their own tools
    222          * ignore and assume IP, so...
    223          */
    224         /*if (type) *type = ntohs(pos->ether_type); */
    225         if (type) *type = ntohs(0x0800);
    226 
    227         return (void*)((char *)pos+sizeof(*pos));
     212        libtrace_ppp_t *ppp = (libtrace_ppp_t*)link;
     213
     214        if (remaining) {
     215                if (*remaining < sizeof(libtrace_ppp_t))
     216                        return NULL;
     217                *remaining-=sizeof(libtrace_ppp_t);
     218        }
     219
     220        if (type) {
     221                switch(ppp->protocol) {
     222                        case 0x0021: *type = ntohs(0x0800);
     223                }
     224        }
     225
     226        return (void*)((char *)ppp+sizeof(*ppp));
    228227}
    229228
     
    313312                case TRACE_TYPE_PFLOG:
    314313                        return trace_get_payload_from_pflog(link,type,remaining);
    315                 case TRACE_TYPE_POS:
    316                         return trace_get_payload_from_pos(link,type,remaining);
     314                case TRACE_TYPE_PPP:
     315                        return trace_get_payload_from_ppp(link,type,remaining);
    317316                case TRACE_TYPE_ATM:
    318317                        l=trace_get_payload_from_atm(link,NULL,remaining);
Note: See TracChangeset for help on using the changeset viewer.