blob: 98b8820cd77addc119c746440cafcbfc412e1f55 [file] [log] [blame]
developer29c4d2d2022-12-26 19:41:22 +08001--- a/src/ap/hostapd.h
2+++ b/src/ap/hostapd.h
3@@ -162,6 +162,21 @@ struct hostapd_sae_commit_queue {
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 {
25@@ -175,6 +190,9 @@ struct hostapd_data {
26
27 u8 own_addr[ETH_ALEN];
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",
45@@ -659,10 +660,12 @@ int ieee802_11_rx_wnm_action_ap(struct h
46
47 switch (action) {
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;
58@@ -709,6 +712,7 @@ int wnm_send_disassoc_imminent(struct ho
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) {
66@@ -790,6 +794,7 @@ int wnm_send_ess_disassoc_imminent(struc
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);
74@@ -870,6 +875,7 @@ int wnm_send_bss_tm_req(struct hostapd_d
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);