Lines Matching refs:sta
31 struct sta_info *sta);
35 struct sta_info *sta,
59 if (sta) {
72 val = ieee802_1x_get_identity(sta->eapol_sm, &len);
75 if (!val && sta->identity) {
76 val = (u8 *) sta->identity;
77 len = os_strlen(sta->identity);
84 MAC2STR(sta->addr));
96 if (add_common_radius_attr(hapd, hapd->conf->radius_acct_req_attr, sta,
100 if (sta && add_sqlite_radius_attr(hapd, sta, msg, 1) < 0)
103 if (sta) {
105 val = ieee802_1x_get_radius_class(sta->eapol_sm, &len,
117 b = ieee802_1x_get_radius_cui(sta->eapol_sm);
126 if (!b && sta->radius_cui &&
129 (u8 *) sta->radius_cui,
130 os_strlen(sta->radius_cui))) {
135 if (sta->ipaddr &&
138 be_to_host32(sta->ipaddr))) {
171 struct sta_info *sta,
174 if (hostapd_drv_read_sta_data(hapd, data, sta->addr))
179 if (sta->last_rx_bytes_lo > data->rx_bytes)
180 sta->last_rx_bytes_hi++;
181 sta->last_rx_bytes_lo = data->rx_bytes;
183 if (sta->last_tx_bytes_lo > data->tx_bytes)
184 sta->last_tx_bytes_hi++;
185 sta->last_tx_bytes_lo = data->tx_bytes;
188 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
191 data->rx_bytes, sta->last_rx_bytes_hi,
192 sta->last_rx_bytes_lo,
193 data->tx_bytes, sta->last_tx_bytes_hi,
194 sta->last_tx_bytes_lo,
204 struct sta_info *sta = timeout_ctx;
207 if (sta->acct_interim_interval) {
208 accounting_sta_interim(hapd, sta);
209 interval = sta->acct_interim_interval;
212 accounting_sta_update_stats(hapd, sta, &data);
217 hapd, sta);
224 * @sta: The station
226 void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta)
231 if (sta->acct_session_started)
234 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
237 (unsigned long long) sta->acct_session_id);
239 os_get_reltime(&sta->acct_session_start);
240 sta->last_rx_bytes_hi = 0;
241 sta->last_rx_bytes_lo = 0;
242 sta->last_tx_bytes_hi = 0;
243 sta->last_tx_bytes_lo = 0;
244 hostapd_drv_sta_clear_stats(hapd, sta->addr);
249 if (sta->acct_interim_interval)
250 interval = sta->acct_interim_interval;
254 hapd, sta);
256 msg = accounting_msg(hapd, sta, RADIUS_ACCT_STATUS_TYPE_START);
258 radius_client_send(hapd->radius, msg, RADIUS_ACCT, sta->addr) < 0)
261 sta->acct_session_started = 1;
266 struct sta_info *sta, int stop)
269 int cause = sta->acct_terminate_cause;
277 msg = accounting_msg(hapd, sta,
286 os_reltime_sub(&now_r, &sta->acct_session_start, &diff);
293 if (accounting_sta_update_stats(hapd, sta, &data) == 0) {
309 bytes = ((u64) sta->last_rx_bytes_hi << 32) |
310 sta->last_rx_bytes_lo;
326 bytes = ((u64) sta->last_tx_bytes_hi << 32) |
327 sta->last_tx_bytes_lo;
354 sta->addr) < 0)
366 * @sta: The station
369 struct sta_info *sta)
371 if (sta->acct_session_started)
372 accounting_sta_report(hapd, sta, 0);
379 * @sta: The station
381 void accounting_sta_stop(struct hostapd_data *hapd, struct sta_info *sta)
383 if (sta->acct_session_started) {
384 accounting_sta_report(hapd, sta, 1);
385 eloop_cancel_timeout(accounting_interim_update, hapd, sta);
386 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
389 (unsigned long long) sta->acct_session_id);
390 sta->acct_session_started = 0;
395 int accounting_sta_get_id(struct hostapd_data *hapd, struct sta_info *sta)
397 return radius_gen_session_id((u8 *) &sta->acct_session_id,
398 sizeof(sta->acct_session_id));
463 struct sta_info *sta;
467 sta = ap_get_sta(hapd, addr);
468 if (!sta)
470 sta->acct_interim_errors++;
471 if (sta->acct_interim_errors > 10 /* RADIUS_CLIENT_MAX_RETRIES */) {
476 sta->acct_interim_errors = 0;
490 if (sta->acct_interim_errors == 1) {
494 for (i = 1; i < sta->acct_interim_errors; i++)
498 hapd, sta);
503 MAC2STR(addr), sta->acct_interim_errors, wait_time);
508 sta->acct_interim_errors);
513 sta->acct_interim_errors);