Ticket #1019: node-stats-notify.diff

File node-stats-notify.diff, 1.8 kB (added by matt@mattb.net.nz, 5 years ago)

Add an event to send client info to hostapd

  • net80211/ieee80211_node.c

    old new  
    19671967         */ 
    19681968        if (vap->iv_auth->ia_node_leave != NULL) 
    19691969                vap->iv_auth->ia_node_leave(ni); 
     1970        ieee80211_notify_sta_stats(ni); 
    19701971 
    19711972        IEEE80211_LOCK_IRQ(ic); 
    19721973        if (vap->iv_aid_bitmap != NULL) 
  • net80211/ieee80211_linux.c

    old new  
    236236        } 
    237237} 
    238238 
     239        void 
     240ieee80211_notify_sta_stats(struct ieee80211_node *ni) 
     241{ 
     242        struct ieee80211vap *vap = ni->ni_vap; 
     243        static const char *tag = "STA-TRAFFIC-STAT"; 
     244        struct net_device *dev = vap->iv_dev; 
     245        union iwreq_data wreq; 
     246        char buf[1024]; 
     247 
     248        snprintf(buf, sizeof(buf), "%s\nmac=%s\nrx_packets=%u\nrx_bytes=%llu\n" 
     249                        "tx_packets=%u\ntx_bytes=%llu\n", tag,  
     250                        ether_sprintf(ni->ni_macaddr), ni->ni_stats.ns_rx_data,  
     251                        ni->ni_stats.ns_rx_bytes, ni->ni_stats.ns_tx_data,  
     252                        ni->ni_stats.ns_tx_bytes); 
     253        memset(&wreq, 0, sizeof(wreq)); 
     254        wreq.data.length = strlen(buf); 
     255        wireless_send_event(dev, IWEVCUSTOM, &wreq, buf); 
     256} 
     257 
    239258void 
    240259ieee80211_notify_scan_done(struct ieee80211vap *vap) 
    241260{ 
  • net80211/ieee80211_proto.h

    old new  
    295295void ieee80211_notify_node_join(struct ieee80211_node *, int); 
    296296void ieee80211_notify_node_leave(struct ieee80211_node *); 
    297297void ieee80211_notify_scan_done(struct ieee80211vap *); 
     298void ieee80211_notify_sta_stats(struct ieee80211_node *ni); 
     299 
    298300#endif /* _NET80211_IEEE80211_PROTO_H_ */