/*
* hostapd / RADIUS Accounting
- * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
const char *radius_mode_txt(struct hostapd_data *hapd);
int radius_sta_rate(struct hostapd_data *hapd, struct sta_info *sta);
+static void accounting_sta_get_id(struct hostapd_data *hapd,
+ struct sta_info *sta);
+
static struct radius_msg * accounting_msg(struct hostapd_data *hapd,
struct sta_info *sta,
if (sta->acct_session_started)
return;
+ accounting_sta_get_id(hapd, sta);
+ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
+ HOSTAPD_LEVEL_INFO,
+ "starting accounting session %08X-%08X",
+ sta->acct_session_id_hi, sta->acct_session_id_lo);
+
time(&sta->acct_session_start);
sta->last_rx_bytes = sta->last_tx_bytes = 0;
sta->acct_input_gigawords = sta->acct_output_gigawords = 0;
if (sta->acct_session_started) {
accounting_sta_report(hapd, sta, 1);
eloop_cancel_timeout(accounting_interim_update, hapd, sta);
+ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
+ HOSTAPD_LEVEL_INFO,
+ "stopped accounting session %08X-%08X",
+ sta->acct_session_id_hi,
+ sta->acct_session_id_lo);
sta->acct_session_started = 0;
}
}
-void accounting_sta_get_id(struct hostapd_data *hapd, struct sta_info *sta)
+static void accounting_sta_get_id(struct hostapd_data *hapd,
+ struct sta_info *sta)
{
sta->acct_session_id_lo = hapd->acct_session_id_lo++;
if (hapd->acct_session_id_lo == 0) {
void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta);
void accounting_sta_interim(struct hostapd_data *hapd, struct sta_info *sta);
void accounting_sta_stop(struct hostapd_data *hapd, struct sta_info *sta);
-void accounting_sta_get_id(struct hostapd_data *hapd, struct sta_info *sta);
int accounting_init(struct hostapd_data *hapd);
void accounting_deinit(struct hostapd_data *hapd);
int accounting_reconfig(struct hostapd_data *hapd,
return -1;
hostapd_new_assoc_sta(hapd, sta, 0);
- accounting_sta_get_id(hapd, sta);
return 0;
}
memset(drv->acct_mac, 0, ETH_ALEN);
memset(&drv->acct_data, 0, sizeof(drv->acct_data));
}
- accounting_sta_get_id(hapd, sta);
if (hapd->conf->wpa) {
if (madwifi_process_wpa_ie(drv, sta))
if (sta == NULL)
return -1;
}
- accounting_sta_get_id(hapd, sta);
if (hapd->conf->wpa) {
if (ie == NULL || ielen == 0) {
sta = ap_sta_add(hapd, addr);
if (sta) {
hostapd_new_assoc_sta(hapd, sta, 0);
- accounting_sta_get_id(hapd, sta);
} else {
wpa_printf(MSG_DEBUG, "Failed to add STA entry for " MACSTR,
MAC2STR(addr));
/* Stop previous accounting session, if one is started, and allocate
* new session id for the new session. */
accounting_sta_stop(hapd, sta);
- accounting_sta_get_id(hapd, sta);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_INFO,
- "associated (aid %d, accounting session %08X-%08X)",
- sta->aid, sta->acct_session_id_hi,
- sta->acct_session_id_lo);
+ "associated (aid %d)",
+ sta->aid);
if (sta->flags & WLAN_STA_ASSOC)
new_assoc = 0;
sta->acct_terminate_cause =
RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
accounting_sta_stop(hapd, sta);
- accounting_sta_get_id(hapd, sta);
sta->eapol_sm->eapolLogoff = TRUE;
sta->eapol_sm->dot1xAuthEapolLogoffFramesRx++;
break;