Ticket #781: iwspy-update-field.diff

File iwspy-update-field.diff, 1.7 kB (added by Christian Buennig <masala@web.de>, 6 years ago)

Signed-off-by: Christian Buennig <masala@web.de>

  • net80211/ieee80211_wireless.c

    old new  
    10881088                for (i = 0; i < number; i++) 
    10891089                        memcpy(&vap->iv_spy.mac[i * IEEE80211_ADDR_LEN], 
    10901090                                address[i].sa_data, IEEE80211_ADDR_LEN); 
     1091                /* init rssi timestamps */ 
     1092                memset(vap->iv_spy.ts_rssi, 0, IW_MAX_SPY * sizeof(u_int32_t)); 
    10911093        } 
    10921094        vap->iv_spy.num = number; 
    10931095 
     
    11191121                address[i].sa_family = AF_PACKET; 
    11201122        } 
    11211123 
    1122         /* locate a node, copy its rssi value, convert to dBm */ 
     1124        /* locate a node, read its rssi, check if updated, convert to dBm */ 
    11231125        for (i = 0; i < number; i++) { 
    11241126                ni = ieee80211_find_node(nt, &vap->iv_spy.mac[i * IEEE80211_ADDR_LEN]); 
    11251127                /* TODO: free node ? */ 
    11261128                /* check we are associated w/ this vap */ 
    1127                 if (ni && (ni->ni_vap == vap)) 
     1129                if (ni && (ni->ni_vap == vap)) { 
    11281130                        set_quality(&spy_stat[i], ni->ni_rssi); 
    1129                 else  
     1131                        if (ni->ni_rstamp != vap->iv_spy.ts_rssi[i]) { 
     1132                                vap->iv_spy.ts_rssi[i] = ni->ni_rstamp; 
     1133                        } else { 
     1134                                spy_stat[i].updated = 0; 
     1135                        } 
     1136                } else { 
    11301137                        spy_stat[i].updated = IW_QUAL_ALL_INVALID; 
     1138                } 
    11311139        } 
    11321140 
    11331141        /* copy results to userspace */ 
  • net80211/ieee80211_var.h

    old new  
    262262#define IW_MAX_SPY 8 
    263263struct ieee80211_spy { 
    264264        u_int8_t mac[IW_MAX_SPY * IEEE80211_ADDR_LEN]; 
     265        u_int32_t ts_rssi[IW_MAX_SPY];   /* ts of rssi value from last read */ 
    265266        u_int8_t thr_low;       /* 1 byte rssi value, 0 = threshold is off */ 
    266267        u_int8_t thr_high;      /* 1 byte rssi value */    
    267268        u_int8_t num;