Changeset 1803a27


Ignore:
Timestamp:
05/15/07 14:52:53 (14 years ago)
Author:
Scott Raynel <smr26@…>
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:
f898a97
Parents:
89bfc98
Message:

Fixes in get_payload_from_80211():

  • Detect the presence of 802.2 LLC/SNAP in 802.11 and skip accordingly
  • Detect whether an 802.11 MAC frame has 3 or 4 MAC addresses and skip accordingly
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols.c

    r89bfc98 r1803a27  
    114114static void *trace_get_payload_from_80211(void *link, uint16_t *type, uint32_t *remaining)
    115115{
    116         /* TODO: Decode type != DATA
    117          * TODO: We're assuming four address frame here... probably not good
    118          */
    119        
    120116        libtrace_80211_t *wifi;
    121117        libtrace_802_11_payload_t *eth;
    122         uint8_t extra = 0; /* how many QoS bytes to skip */
     118        int8_t extra = 0; /* how many QoS bytes to skip */
    123119       
    124120        if (remaining && *remaining < sizeof(libtrace_80211_t))
     
    132128        }
    133129
     130        /* If FromDS and ToDS are both set then we have a four-address
     131         * frame. Otherwise we have a three-address frame */
     132        if (!(wifi->to_ds && wifi->from_ds))
     133                extra -= 6;
     134       
    134135        /* Indicates QoS field present, see IEEE802.11e-2005 pg 21 */
    135136        if (wifi->subtype & 0x8)
     
    140141
    141142        eth=(libtrace_802_11_payload_t *)((char*)wifi+sizeof(*wifi)+extra);
    142 
     143       
     144        if (eth->type == 0xaaaa)
     145                /* Payload contains an 802.2 LLC/SNAP frame */
     146                return trace_get_payload_from_llcsnap((void *)eth, type, remaining);
     147                       
     148        /* Otherwise we assume an Ethernet II frame */
    143149        if (type) *type=ntohs(eth->type);
    144150        if (remaining) *remaining = *remaining - sizeof(libtrace_80211_t) - extra - sizeof(*eth);
    145        
    146151       
    147152        return (void*)((char*)eth+sizeof(*eth));
Note: See TracChangeset for help on using the changeset viewer.