Skip to content

Commit e8f75f9

Browse files
committed
Merge branch 'feat/roaming_app_blacklist' into 'master'
fix(esp_wifi): Add blacklist logic in roaming app Closes WIFIBUG-1219, WIFIBUG-1208, WIFIBUG-1109, WIFIBUG-1203, and WIFIBUG-1428 See merge request espressif/esp-idf!40802
2 parents 37322d4 + fdda622 commit e8f75f9

File tree

11 files changed

+339
-36
lines changed

11 files changed

+339
-36
lines changed

components/esp_wifi/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ idf_component_register(SRCS "${srcs}"
6363
PRIV_REQUIRES esp_pm esp_timer nvs_flash
6464
wpa_supplicant hal lwip esp_coex
6565
PRIV_INCLUDE_DIRS ../wpa_supplicant/src/ ../wpa_supplicant/esp_supplicant/src/
66-
wifi_apps/roaming_app/include
66+
wifi_apps/roaming_app/include wifi_apps/roaming_app/src
6767
LDFRAGMENTS "${ldfragments}")
6868

6969
if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)

components/esp_wifi/wifi_apps/roaming_app/include/esp_roaming.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ void roam_sta_disconnected(void *disconn);
3737
esp_err_t roam_get_config_params(struct roam_config *config);
3838
esp_err_t roam_set_config_params(struct roam_config *config);
3939

40+
#if CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
41+
void esp_wifi_roaming_set_current_bssid(const uint8_t *bssid);
42+
#endif
43+
4044
#ifdef __cplusplus
4145
}
4246
#endif

components/esp_wifi/wifi_apps/roaming_app/src/Kconfig.roaming

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,7 @@ menu "Scan Configuration"
139139
Duration for which the results from the most recent scans can be used
140140
by the roaming app for determining the roaming candidates.
141141

142-
config ESP_WIFI_ROAMING_MAX_CANDIDATES
143-
int "Max Candidates in the network"
144-
default 3
145-
range 3 20
146-
help
147-
Max candidates that can be considered while scanning as a part of the
148-
network at one time.
142+
149143

150144
endmenu #"Scan Configuration"
151145

@@ -182,3 +176,50 @@ config ESP_WIFI_ROAMING_RRM_MONITOR_THRESHOLD
182176
range -99 0
183177
help
184178
The RSSI threshold beyond which we start sending periodic neighbor report requests.
179+
180+
menu "Blacklist Configuration"
181+
config ESP_WIFI_ROAMING_BSSID_BLACKLIST
182+
bool "Enable BSSID blacklisting"
183+
default n
184+
help
185+
Enable this to blacklist BSSIDs.
186+
187+
config ESP_WIFI_ROAMING_AUTO_BLACKLISTING
188+
bool "Enable automatic BSSID blacklisting"
189+
depends on ESP_WIFI_ROAMING_BSSID_BLACKLIST
190+
help
191+
Enable this to automatically blacklist BSSIDs after multiple failed connection attempts.
192+
193+
config ESP_WIFI_ROAMING_MAX_CONN_FAILURES
194+
int "Maximum connection failures"
195+
depends on ESP_WIFI_ROAMING_AUTO_BLACKLISTING
196+
range 1 10
197+
default 3
198+
help
199+
Maximum number of connection failures before a BSSID is blacklisted.
200+
201+
config ESP_WIFI_ROAMING_BLACKLIST_TIMEOUT
202+
int "Blacklist timeout (in seconds)"
203+
depends on ESP_WIFI_ROAMING_BSSID_BLACKLIST
204+
range 10 3600
205+
default 300
206+
help
207+
Time in seconds for which a BSSID remains in the blacklist.
208+
This applies to both automatically and manually blacklisted BSSIDs.
209+
210+
config ESP_WIFI_ROAMING_MAX_CANDIDATES
211+
int "Maximum number of roaming candidates"
212+
range 1 10
213+
default 5
214+
help
215+
Maximum number of roaming candidates to consider. This also defines the size of the blacklist.
216+
217+
config ESP_WIFI_ROAMING_PREVENT_DOWNGRADE
218+
bool "Prevent security downgrade when roaming"
219+
default n
220+
help
221+
If the currently connected AP sends a "transition disable" bit,
222+
this option will make the roaming logic ignore less secure APs.
223+
This helps prevent security downgrades when roaming in a mixed
224+
security environment (e.g., WPA2/WPA3).
225+
endmenu # "Blacklist Configuration"

components/esp_wifi/wifi_apps/roaming_app/src/esp_roaming_i.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ struct roaming_app {
134134
#endif
135135
#if PERIODIC_SCAN_MONITORING
136136
bool periodic_scan_active;
137+
#endif
138+
#if CONFIG_ESP_WIFI_ROAMING_BSSID_BLACKLIST
139+
struct blacklist_entry {
140+
uint8_t bssid[ETH_ALEN];
141+
#if CONFIG_ESP_WIFI_ROAMING_AUTO_BLACKLISTING
142+
uint8_t failures;
143+
#endif
144+
struct timeval timestamp;
145+
} bssid_blacklist[CONFIG_ESP_WIFI_ROAMING_MAX_CANDIDATES];
146+
uint8_t bssid_blacklist_count;
137147
#endif
138148
bool allow_reconnect;
139149
};

0 commit comments

Comments
 (0)