blob: 0efa6db9085f2bfa80b3b26be60912d4ec83ad22 [file] [log] [blame]
developer29c4d2d2022-12-26 19:41:22 +08001--- a/src/ap/hostapd.h
2+++ b/src/ap/hostapd.h
developer8bff6472023-07-17 11:11:44 +08003@@ -163,6 +163,21 @@ struct hostapd_sae_commit_queue {
developer29c4d2d2022-12-26 19:41:22 +08004 };
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 {
developer8bff6472023-07-17 11:11:44 +080025@@ -182,6 +197,9 @@ struct hostapd_data {
developer29c4d2d2022-12-26 19:41:22 +080026
developer8bff6472023-07-17 11:11:44 +080027 struct hostapd_data *mld_first_bss;
developer29c4d2d2022-12-26 19:41:22 +080028
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",
developer505c9432023-05-12 18:58:17 +080045@@ -790,10 +791,12 @@ int ieee802_11_rx_wnm_action_ap(struct h
46 plen);
47 return 0;
developer29c4d2d2022-12-26 19:41:22 +080048 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;
developer505c9432023-05-12 18:58:17 +080058@@ -840,6 +843,7 @@ int wnm_send_disassoc_imminent(struct ho
developer29c4d2d2022-12-26 19:41:22 +080059
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) {
developer505c9432023-05-12 18:58:17 +080066@@ -921,6 +925,7 @@ int wnm_send_ess_disassoc_imminent(struc
developer29c4d2d2022-12-26 19:41:22 +080067 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);
developer505c9432023-05-12 18:58:17 +080074@@ -1001,6 +1006,7 @@ int wnm_send_bss_tm_req(struct hostapd_d
developer29c4d2d2022-12-26 19:41:22 +080075 }
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);