Files
wlan-ap/feeds/hostapd/hostapd/patches/999-ssi_signal.patch
2024-09-22 13:45:23 +02:00

82 lines
2.4 KiB
Diff

Index: hostapd-2023-09-08-e5ccbfc6/src/ap/ieee802_11.c
===================================================================
--- hostapd-2023-09-08-e5ccbfc6.orig/src/ap/ieee802_11.c
+++ hostapd-2023-09-08-e5ccbfc6/src/ap/ieee802_11.c
@@ -59,6 +59,17 @@
#include "pasn/pasn_common.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,
@@ -5856,7 +5867,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;
@@ -5913,6 +5924,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) {
@@ -6089,6 +6101,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;
@@ -6196,7 +6210,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,
Index: hostapd-2023-09-08-e5ccbfc6/src/ap/sta_info.h
===================================================================
--- hostapd-2023-09-08-e5ccbfc6.orig/src/ap/sta_info.h
+++ hostapd-2023-09-08-e5ccbfc6/src/ap/sta_info.h
@@ -330,6 +330,7 @@ struct sta_info {
#ifdef CONFIG_PASN
struct pasn_data *pasn;
#endif /* CONFIG_PASN */
+ int signal_mgmt;
#ifdef CONFIG_IEEE80211BE
struct mld_info mld_info;
Index: hostapd-2023-09-08-e5ccbfc6/src/ap/hostapd.h
===================================================================
--- hostapd-2023-09-08-e5ccbfc6.orig/src/ap/hostapd.h
+++ hostapd-2023-09-08-e5ccbfc6/src/ap/hostapd.h
@@ -494,6 +494,7 @@ struct hostapd_data {
#ifdef CONFIG_CTRL_IFACE_UDP
unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN];
#endif /* CONFIG_CTRL_IFACE_UDP */
+ int signal_mgmt;
};