From patchwork Wed Jan 2 13:57:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2, 1/2] Included session transfer stats (rx/tx packets/bytes) and duration into the station's "deauthentiation"-log message. Date: Wed, 02 Jan 2013 03:57:05 -0000 From: Jan Vales X-Patchwork-Id: 209050 Message-Id: <1357135026-8147-2-git-send-email-jan@jvales.net> To: hostap@lists.shmoo.com Signed-hostap: Jan Vales --- src/ap/ieee802_11.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 51c8d28..7809cc6 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -1351,6 +1351,8 @@ static void handle_deauth(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len) { struct sta_info *sta; + struct hostap_sta_driver_data data; + struct os_time now; if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.deauth)) { wpa_msg(hapd->msg_ctx, MSG_DEBUG, "handle_deauth - too short " @@ -1374,8 +1376,21 @@ static void handle_deauth(struct hostapd_data *hapd, sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_REQ_OK); wpa_auth_sm_event(sta->wpa_sm, WPA_DEAUTH); - hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, - HOSTAPD_LEVEL_DEBUG, "deauthenticated"); + + if (hostapd_drv_read_sta_data(hapd, &data, sta->addr) == 0) { + os_get_time(&now); + hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, + HOSTAPD_LEVEL_INFO, + "deauthenticated. Stats: session=%08X-%08X; duration=%ld;" + "rx_pkt=%lu; tx_pkt=%lu; rx_byte=%lu; tx_byte=%lu;", + sta->acct_session_id_hi, sta->acct_session_id_lo, + (now.sec - sta->acct_session_start), data.rx_packets, + data.tx_packets, data.rx_bytes, data.tx_bytes); + } else { + hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, + HOSTAPD_LEVEL_DEBUG, "deauthenticated"); + } + mlme_deauthenticate_indication( hapd, sta, le_to_host16(mgmt->u.deauth.reason_code)); sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;