fix(esp_wifi): Fix ci pipeline for random mac feature

This commit is contained in:
Shreyas Sheth
2026-05-25 11:22:45 +08:00
committed by BOT
parent 17e4e38cda
commit 2d3c11b277
10 changed files with 85 additions and 64 deletions
+10 -8
View File
@@ -925,19 +925,21 @@ menu "Wi-Fi"
Select this option to enable/disable support for station connections
to hidden APs using passive scan when the country policy is set to auto.
config ESP_WIFI_STA_RANDOM_MAC_ENABLED
bool "Station Mac-Randomization enabled"
default y
config ESP_WIFI_PRIVACY_ENHANCEMENTS_ENABLED
bool "WiFi Privacy Enhancements enabled"
default n
help
Select this option to enable Mac Randomization for Station
Select this option to enable WiFi Privacy Enhancements (enables random mac,
seq number, dialogue token number, vendor seq number cnt).
Supported on station interface only; softAP may be added in future.
config ESP_WIFI_STA_RANDOM_MAC_AUTO_RESET_INTERVAL
int "Station Mac-Randomization Auto-Reset Interval time"
depends on ESP_WIFI_STA_RANDOM_MAC_ENABLED
config ESP_WIFI_RMAC_AUTO_RESET_INTERVAL
int "Random MAC Auto-Reset Interval time"
depends on ESP_WIFI_PRIVACY_ENHANCEMENTS_ENABLED
range 1 24
default 12
help
Interval in hours to rotate the STA random MAC while not connected to an AP.
Interval in hours to rotate the random MAC while not connected to an AP.
Values below 1 or above 24 are not allowed.
endif # wifi enabled
+16 -4
View File
@@ -120,8 +120,8 @@ typedef struct {
int espnow_max_encrypt_num; /**< Maximum encrypt number of peers supported by espnow */
int tx_hetb_queue_num; /**< WiFi TX HE TB QUEUE number for STA HE TB PPDU transmission */
bool dump_hesigb_enable; /**< enable dump sigb field */
bool sta_random_mac; /**< STA MAC randomization. Supported on station interface only; softAP may be added in future */
uint8_t sta_rmac_auto_reset_int;/**< STA random MAC auto-reset interval in hours (1-24) while not connected */
bool privacy_enhancements; /**< WiFi privacy enhancements (enables random mac, seq number, dialogue token number, vendor seq number cnt). Supported on station interface only; softAP may be added in future */
uint8_t rmac_auto_reset_int; /**< Random MAC auto-reset interval in hours (1-24) while not connected */
int magic; /**< WiFi init magic number, it should be the last field */
} wifi_init_config_t;
@@ -323,6 +323,18 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
WIFI_ENABLE_PASSIVE_HIDDEN_AP | \
WIFI_ENABLE_OWE_SOFTAP)
#if CONFIG_ESP_WIFI_PRIVACY_ENHANCEMENTS_ENABLED
#define WIFI_PRIVACY_ENHANCEMENTS_ENABLED true
#else
#define WIFI_PRIVACY_ENHANCEMENTS_ENABLED false
#endif
#ifdef CONFIG_ESP_WIFI_RMAC_AUTO_RESET_INTERVAL
#define WIFI_RMAC_AUTO_RESET_INTERVAL CONFIG_ESP_WIFI_RMAC_AUTO_RESET_INTERVAL
#else
#define WIFI_RMAC_AUTO_RESET_INTERVAL 0
#endif
#define WIFI_INIT_CONFIG_DEFAULT() { \
.osi_funcs = &g_wifi_osi_funcs, \
.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \
@@ -349,8 +361,8 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
.espnow_max_encrypt_num = CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM, \
.tx_hetb_queue_num = WIFI_TX_HETB_QUEUE_NUM, \
.dump_hesigb_enable = WIFI_DUMP_HESIGB_ENABLED, \
.sta_random_mac = CONFIG_ESP_WIFI_STA_RANDOM_MAC_ENABLED, \
.sta_rmac_auto_reset_int = CONFIG_ESP_WIFI_STA_RANDOM_MAC_AUTO_RESET_INTERVAL, \
.privacy_enhancements = WIFI_PRIVACY_ENHANCEMENTS_ENABLED, \
.rmac_auto_reset_int = WIFI_RMAC_AUTO_RESET_INTERVAL, \
.magic = WIFI_INIT_CONFIG_MAGIC\
}
+10 -8
View File
@@ -904,19 +904,21 @@ config WIFI_RMT_PASSIVE_HIDDEN_AP_SUPPORT
Select this option to enable/disable support for station connections
to hidden APs using passive scan when the country policy is set to auto.
config WIFI_RMT_STA_RANDOM_MAC_ENABLED
bool "Station Mac-Randomization enabled"
default y
config WIFI_RMT_PRIVACY_ENHANCEMENTS_ENABLED
bool "WiFi Privacy Enhancements enabled"
default n
help
Select this option to enable Mac Randomization for Station
Select this option to enable WiFi Privacy Enhancements (enables random mac,
seq number, dialogue token number, vendor seq number cnt).
Supported on station interface only; softAP may be added in future.
config WIFI_RMT_STA_RANDOM_MAC_AUTO_RESET_INTERVAL
int "Station Mac-Randomization Auto-Reset Interval time"
depends on WIFI_RMT_STA_RANDOM_MAC_ENABLED
config WIFI_RMT_RMAC_AUTO_RESET_INTERVAL
int "Random MAC Auto-Reset Interval time"
depends on WIFI_RMT_PRIVACY_ENHANCEMENTS_ENABLED
range 1 24
default 12
help
Interval in hours to rotate the STA random MAC while not connected to an AP.
Interval in hours to rotate the random MAC while not connected to an AP.
Values below 1 or above 24 are not allowed.
if !ESP_WIFI_ENABLED
@@ -513,13 +513,13 @@ if WIFI_RMT_PASSIVE_HIDDEN_AP_SUPPORT
default WIFI_RMT_PASSIVE_HIDDEN_AP_SUPPORT
endif
if WIFI_RMT_STA_RANDOM_MAC_ENABLED
config ESP_WIFI_STA_RANDOM_MAC_ENABLED # ignore: multiple-definition
if WIFI_RMT_PRIVACY_ENHANCEMENTS_ENABLED
config ESP_WIFI_PRIVACY_ENHANCEMENTS_ENABLED # ignore: multiple-definition
bool
default WIFI_RMT_STA_RANDOM_MAC_ENABLED
default WIFI_RMT_PRIVACY_ENHANCEMENTS_ENABLED
endif
config ESP_WIFI_STA_RANDOM_MAC_AUTO_RESET_INTERVAL # ignore: multiple-definition
config ESP_WIFI_RMAC_AUTO_RESET_INTERVAL # ignore: multiple-definition
int
depends on WIFI_RMT_STA_RANDOM_MAC_ENABLED
default WIFI_RMT_STA_RANDOM_MAC_AUTO_RESET_INTERVAL
depends on WIFI_RMT_PRIVACY_ENHANCEMENTS_ENABLED
default WIFI_RMT_RMAC_AUTO_RESET_INTERVAL
@@ -120,8 +120,8 @@ typedef struct {
int espnow_max_encrypt_num; /**< Maximum encrypt number of peers supported by espnow */
int tx_hetb_queue_num; /**< WiFi TX HE TB QUEUE number for STA HE TB PPDU transmission */
bool dump_hesigb_enable; /**< enable dump sigb field */
bool sta_random_mac; /**< STA MAC randomization. Supported on station interface only; softAP may be added in future */
uint8_t sta_rmac_auto_reset_int;/**< STA random MAC auto-reset interval in hours (1-24) while not connected */
bool privacy_enhancements; /**< WiFi privacy enhancements (enables random mac, seq number, dialogue token number, vendor seq number cnt). Supported on station interface only; softAP may be added in future */
uint8_t rmac_auto_reset_int; /**< Random MAC auto-reset interval in hours (1-24) while not connected */
int magic; /**< WiFi init magic number, it should be the last field */
} wifi_init_config_t;
@@ -323,6 +323,18 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
WIFI_ENABLE_PASSIVE_HIDDEN_AP | \
WIFI_ENABLE_OWE_SOFTAP)
#if CONFIG_WIFI_RMT_PRIVACY_ENHANCEMENTS_ENABLED
#define WIFI_PRIVACY_ENHANCEMENTS_ENABLED true
#else
#define WIFI_PRIVACY_ENHANCEMENTS_ENABLED false
#endif
#ifdef CONFIG_WIFI_RMT_RMAC_AUTO_RESET_INTERVAL
#define WIFI_RMAC_AUTO_RESET_INTERVAL CONFIG_WIFI_RMT_RMAC_AUTO_RESET_INTERVAL
#else
#define WIFI_RMAC_AUTO_RESET_INTERVAL 0
#endif
#define WIFI_INIT_CONFIG_DEFAULT() { \
.osi_funcs = &g_wifi_osi_funcs, \
.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \
@@ -349,8 +361,8 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
.espnow_max_encrypt_num = CONFIG_WIFI_RMT_ESPNOW_MAX_ENCRYPT_NUM, \
.tx_hetb_queue_num = WIFI_TX_HETB_QUEUE_NUM, \
.dump_hesigb_enable = WIFI_DUMP_HESIGB_ENABLED, \
.sta_random_mac = CONFIG_WIFI_RMT_STA_RANDOM_MAC_ENABLED, \
.sta_rmac_auto_reset_int = CONFIG_WIFI_RMT_STA_RANDOM_MAC_AUTO_RESET_INTERVAL, \
.privacy_enhancements = WIFI_PRIVACY_ENHANCEMENTS_ENABLED, \
.rmac_auto_reset_int = WIFI_RMAC_AUTO_RESET_INTERVAL, \
.magic = WIFI_INIT_CONFIG_MAGIC\
}
+3 -2
View File
@@ -8,6 +8,7 @@
#include "esp_wifi.h"
#include "esp_netif.h"
#include "esp_log.h"
#include "esp_mac.h"
#include "esp_private/wifi.h"
#include "esp_wifi_netif.h"
#include <string.h>
@@ -119,8 +120,8 @@ static void wifi_default_action_sta_connected(void *arg, esp_event_base_t base,
}
}
#if CONFIG_ESP_WIFI_STA_RANDOM_MAC_ENABLED
/* Sync netif MAC when STA random MAC was set internally by the Wi-Fi driver */
#if CONFIG_ESP_WIFI_PRIVACY_ENHANCEMENTS_ENABLED
/* Sync netif MAC when STA privacy-enhanced MAC was set internally by the Wi-Fi driver */
uint8_t mac[WIFI_MAC_ADDR_LEN];
esp_wifi_get_mac(WIFI_IF_STA, mac);
esp_netif_set_mac(esp_netif, mac);