Ticket #906: madwifi_monitor_direction.patch

File madwifi_monitor_direction.patch, 1.2 kB (added by scottraynel@gmail.com, 2 years ago)

Correctly set pkt_type on captured frames in monitor mode

  • net80211/ieee80211_monitor.c

    old new  
    213213        struct ieee80211vap *vap, *next; 
    214214        int noise = 0; 
    215215        u_int32_t rssi = 0; 
     216        u_int8_t pkttype = 0; 
    216217         
    217218        rssi = tx ? ds->ds_txstat.ts_rssi : ds->ds_rxstat.rs_rssi; 
    218219         
     
    225226                struct sk_buff *skb1; 
    226227                struct net_device *dev = vap->iv_dev; 
    227228                struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data; 
     229                 
     230                if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { 
     231                        if (memcmp(wh->i_addr1, dev->broadcast, ETH_ALEN) == 0) 
     232                                pkttype = PACKET_BROADCAST; 
     233                        else 
     234                                pkttype = PACKET_MULTICAST; 
     235                } 
     236                else if (tx) 
     237                        pkttype = PACKET_OUTGOING; 
     238                else 
     239                        pkttype = PACKET_HOST; 
     240 
    228241                u_int8_t dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK; 
    229242 
    230243                next = TAILQ_NEXT(vap, iv_next); 
     
    426439                        skb1->dev = dev; /* NB: deliver to wlanX */ 
    427440                        skb1->mac.raw = skb1->data; 
    428441                        skb1->ip_summed = CHECKSUM_NONE; 
    429                         skb1->pkt_type = PACKET_OTHERHOST
     442                        skb1->pkt_type = pkttype
    430443                        skb1->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */ 
    431444                         
    432445                        netif_rx(skb1);