--- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -62,6 +62,17 @@ #endif #include "wpa_auth_i.h" +static int +ewma(int new, int old) +{ + #define ALPHA 10 + if (!old) + return new; + if (new >= 0) + return old; + return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100; +} + #ifdef CONFIG_FILS static struct wpabuf * prepare_auth_resp_fils(struct hostapd_data *hapd, @@ -6115,7 +6126,7 @@ static int robust_action_frame(u8 catego static int handle_action(struct hostapd_data *hapd, const struct ieee80211_mgmt *mgmt, size_t len, - unsigned int freq) + unsigned int freq, int ssi_signal) { struct sta_info *sta; u8 *action __maybe_unused; @@ -6172,6 +6183,7 @@ static int handle_action(struct hostapd_ sta->last_seq_ctrl = seq_ctrl; sta->last_subtype = WLAN_FC_STYPE_ACTION; + sta->signal_mgmt = ewma(ssi_signal, sta->signal_mgmt);; } switch (mgmt->u.action.category) { @@ -6388,6 +6400,8 @@ int ieee802_11_mgmt(struct hostapd_data unsigned int freq; int ssi_signal = fi ? fi->ssi_signal : 0; + hapd->signal_mgmt = ewma(ssi_signal, hapd->signal_mgmt);; + if (len < 24) return 0; @@ -6498,7 +6512,7 @@ int ieee802_11_mgmt(struct hostapd_data break; case WLAN_FC_STYPE_ACTION: wpa_printf(MSG_DEBUG, "mgmt::action"); - ret = handle_action(hapd, mgmt, len, freq); + ret = handle_action(hapd, mgmt, len, freq, ssi_signal); break; default: hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211, --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -338,6 +338,7 @@ struct sta_info { #ifdef CONFIG_PASN struct pasn_data *pasn; #endif /* CONFIG_PASN */ + int signal_mgmt; /* Vendor Specific OUI from associated STA */ u8 vendor_oui[3]; --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -540,6 +540,7 @@ struct hostapd_data { u8 session_cnt; #endif /* CONFIG_IEEE80211BE */ bool disable_cu; + int signal_mgmt; };