[PATCH 1/2] Included session transfer stats (rx/tx packets/bytes) and duration into the station's "deauthentiation"-log message.

Mahesh Palivela maheshp
Tue Jan 1 22:34:35 PST 2013


On 01/02/2013 11:34 AM, Jan Vales wrote:
> Signed-hostap: Jan Vales <jan at jvales.net>
> ---
>   src/ap/ieee802_11.c | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
> index 51c8d28..d9ec8b2 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,18 @@ 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,
> +
> +	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; (mind a possible counter wrap)",
> +		       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);

Can't go beyond 80 char. Please follow code guidelines.

> +	} 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;
>



More information about the Hostap mailing list