developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 1 | --- a/src/ap/hostapd.h |
| 2 | +++ b/src/ap/hostapd.h |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 3 | @@ -163,6 +163,21 @@ struct hostapd_sae_commit_queue { |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 4 | }; |
| 5 | |
| 6 | /** |
| 7 | + * struct hostapd_openwrt_stats - OpenWrt custom STA/AP statistics |
| 8 | + */ |
| 9 | +struct hostapd_openwrt_stats { |
| 10 | + struct { |
| 11 | + u64 neighbor_report_tx; |
| 12 | + } rrm; |
| 13 | + |
| 14 | + struct { |
| 15 | + u64 bss_transition_query_rx; |
| 16 | + u64 bss_transition_request_tx; |
| 17 | + u64 bss_transition_response_rx; |
| 18 | + } wnm; |
| 19 | +}; |
| 20 | + |
| 21 | +/** |
| 22 | * struct hostapd_data - hostapd per-BSS data structure |
| 23 | */ |
| 24 | struct hostapd_data { |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 25 | @@ -182,6 +197,9 @@ struct hostapd_data { |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 26 | |
developer | 9a58788 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 27 | struct hostapd_data *mld_first_bss; |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 28 | |
| 29 | + /* OpenWrt specific statistics */ |
| 30 | + struct hostapd_openwrt_stats openwrt_stats; |
| 31 | + |
| 32 | int num_sta; /* number of entries in sta_list */ |
| 33 | struct sta_info *sta_list; /* STA info list head */ |
| 34 | #define STA_HASH_SIZE 256 |
| 35 | --- a/src/ap/wnm_ap.c |
| 36 | +++ b/src/ap/wnm_ap.c |
| 37 | @@ -386,6 +386,7 @@ static int ieee802_11_send_bss_trans_mgm |
| 38 | mgmt->u.action.u.bss_tm_req.validity_interval = 1; |
| 39 | pos = mgmt->u.action.u.bss_tm_req.variable; |
| 40 | |
| 41 | + hapd->openwrt_stats.wnm.bss_transition_request_tx++; |
| 42 | wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request to " |
| 43 | MACSTR " dialog_token=%u req_mode=0x%x disassoc_timer=%u " |
| 44 | "validity_interval=%u", |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 45 | @@ -790,10 +791,12 @@ int ieee802_11_rx_wnm_action_ap(struct h |
| 46 | plen); |
| 47 | return 0; |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 48 | case WNM_BSS_TRANS_MGMT_QUERY: |
| 49 | + hapd->openwrt_stats.wnm.bss_transition_query_rx++; |
| 50 | ieee802_11_rx_bss_trans_mgmt_query(hapd, mgmt->sa, payload, |
| 51 | plen); |
| 52 | return 0; |
| 53 | case WNM_BSS_TRANS_MGMT_RESP: |
| 54 | + hapd->openwrt_stats.wnm.bss_transition_response_rx++; |
| 55 | ieee802_11_rx_bss_trans_mgmt_resp(hapd, mgmt->sa, payload, |
| 56 | plen); |
| 57 | return 0; |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 58 | @@ -840,6 +843,7 @@ int wnm_send_disassoc_imminent(struct ho |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 59 | |
| 60 | pos = mgmt->u.action.u.bss_tm_req.variable; |
| 61 | |
| 62 | + hapd->openwrt_stats.wnm.bss_transition_request_tx++; |
| 63 | wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request frame to indicate imminent disassociation (disassoc_timer=%d) to " |
| 64 | MACSTR, disassoc_timer, MAC2STR(sta->addr)); |
| 65 | if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) { |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 66 | @@ -921,6 +925,7 @@ int wnm_send_ess_disassoc_imminent(struc |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 67 | return -1; |
| 68 | } |
| 69 | |
| 70 | + hapd->openwrt_stats.wnm.bss_transition_request_tx++; |
| 71 | if (disassoc_timer) { |
| 72 | /* send disassociation frame after time-out */ |
| 73 | set_disassoc_timer(hapd, sta, disassoc_timer); |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 74 | @@ -1001,6 +1006,7 @@ int wnm_send_bss_tm_req(struct hostapd_d |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 75 | } |
| 76 | os_free(buf); |
| 77 | |
| 78 | + hapd->openwrt_stats.wnm.bss_transition_request_tx++; |
| 79 | if (disassoc_timer) { |
| 80 | /* send disassociation frame after time-out */ |
| 81 | set_disassoc_timer(hapd, sta, disassoc_timer); |
| 82 | --- a/src/ap/rrm.c |
| 83 | +++ b/src/ap/rrm.c |
| 84 | @@ -269,6 +269,8 @@ static void hostapd_send_nei_report_resp |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | + hapd->openwrt_stats.rrm.neighbor_report_tx++; |
| 89 | + |
| 90 | hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr, |
| 91 | wpabuf_head(buf), wpabuf_len(buf)); |
| 92 | wpabuf_free(buf); |