From patchwork Wed Jan 2 13:57:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Vales X-Patchwork-Id: 209050 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id C00E42C0087 for ; Thu, 3 Jan 2013 00:57:32 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 5CAD59C1EE; Wed, 2 Jan 2013 08:57:29 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IqFPWSDMK3cK; Wed, 2 Jan 2013 08:57:28 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 5EC5F9C1B2; Wed, 2 Jan 2013 08:57:17 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9161F9C10F for ; Wed, 2 Jan 2013 08:57:15 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NWnGDjLOAXP6 for ; Wed, 2 Jan 2013 08:57:09 -0500 (EST) Received: from mail.somenet.org (mail.somenet.org [213.143.98.34]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id E2FF19C164 for ; Wed, 2 Jan 2013 08:57:08 -0500 (EST) From: Jan Vales To: hostap@lists.shmoo.com Subject: [PATCH v2 1/2] Included session transfer stats (rx/tx packets/bytes) and duration into the station's "deauthentiation"-log message. Date: Wed, 2 Jan 2013 14:57:05 +0100 Message-Id: <1357135026-8147-2-git-send-email-jan@jvales.net> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1357135026-8147-1-git-send-email-jan@jvales.net> References: <1357135026-8147-1-git-send-email-jan@jvales.net> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@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;