mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
Merge branch 'bugfix/wifi_backport_v5.1' into 'release/v5.1'
esp_wifi: backport some wifi fixes to v5.1 See merge request espressif/esp-idf!23389
This commit is contained in:
@ -41,7 +41,7 @@ static const esp_phy_init_data_t phy_init_data= { {
|
||||
0x00,
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x54),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x54),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x54),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c),
|
||||
@ -49,19 +49,10 @@ static const esp_phy_init_data_t phy_init_data= { {
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x48),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x48),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x44),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x3C),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x3C),
|
||||
LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x3C),
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
@ -149,7 +140,31 @@ static const esp_phy_init_data_t phy_init_data= { {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x9B
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x70
|
||||
} };
|
||||
|
||||
static const char __attribute__((section(".rodata"))) phy_init_magic_post[] = PHY_INIT_MAGIC;
|
||||
|
Submodule components/esp_phy/lib updated: 6b2f06a44d...03c270c901
@ -1929,7 +1929,7 @@ wep_encap = 0x40002024;
|
||||
wep_decap = 0x40002028;
|
||||
dbg_hmac_rxtx_statis_dump = 0x4000202c;
|
||||
dbg_hmac_statis_dump = 0x40002030;
|
||||
ieee80211_send_action_vendor_spec = 0x40002034;
|
||||
/* ieee80211_send_action_vendor_spec = 0x40002034; */
|
||||
ieee80211_vnd_lora_ie_size = 0x40002048;
|
||||
ieee80211_vnd_ie_size = 0x4000204c;
|
||||
ieee80211_add_ssid = 0x40002050;
|
||||
|
@ -50,11 +50,11 @@ lmacReachShortLimit = 0x40000c48;
|
||||
lmacRecycleMPDU = 0x40000c4c;
|
||||
lmacRxDone = 0x40000c50;
|
||||
//lmacSetTxFrame = 0x40000c54;
|
||||
lmacTxDone = 0x40000c58;
|
||||
//lmacTxDone = 0x40000c58;
|
||||
lmacTxFrame = 0x40000c5c;
|
||||
mac_tx_set_duration = 0x40000c60;
|
||||
//mac_tx_set_plcp0 = 0x40000c64;
|
||||
mac_tx_set_plcp1 = 0x40000c68;
|
||||
//mac_tx_set_plcp1 = 0x40000c68;
|
||||
mac_tx_set_plcp2 = 0x40000c6c;
|
||||
pm_check_state = 0x40000c70;
|
||||
/* pm_disable_dream_timer = 0x40000c74; */
|
||||
@ -92,7 +92,7 @@ ppEnqueueRxq = 0x40000cf0;
|
||||
ppEnqueueTxDone = 0x40000cf4;
|
||||
ppGetTxframe = 0x40000cf8;
|
||||
//ppMapTxQueue = 0x40000cfc;
|
||||
ppProcTxSecFrame = 0x40000d00;
|
||||
//ppProcTxSecFrame = 0x40000d00;
|
||||
ppProcessRxPktHdr = 0x40000d04;
|
||||
//ppProcessTxQ = 0x40000d08;
|
||||
ppRecordBarRRC = 0x40000d0c;
|
||||
@ -171,7 +171,7 @@ ppDisableQueue = 0x40000e2c;
|
||||
pm_allow_tx = 0x40000e30;
|
||||
//wdev_is_data_in_rxlist = 0x40000e34;
|
||||
ppProcTxCallback = 0x40000e38;
|
||||
mac_tx_set_hesig = 0x40000e3c;
|
||||
//mac_tx_set_hesig = 0x40000e3c;
|
||||
ppCalPreFecPaddingFactor = 0x40000e40;
|
||||
mac_tx_set_tb = 0x40000e44;
|
||||
mac_tx_set_mplen = 0x40000e48;
|
||||
@ -294,8 +294,8 @@ tsf_hal_set_tsf_time_deviation = 0x40001018;
|
||||
tsf_hal_set_tsf_time_deviation_sync_disable = 0x4000101c;
|
||||
tsf_hal_set_tsf_time_deviation_sync_enable = 0x40001020;
|
||||
tsf_hal_unmap_tbtt_target_to_rx_frame = 0x40001024;
|
||||
ppSelectTxFormat = 0x40001028;
|
||||
ppCertSetRate = 0x4000102c;
|
||||
//ppSelectTxFormat = 0x40001028;
|
||||
//ppCertSetRate = 0x4000102c;
|
||||
//ppHEAMPDU2Normal = 0x40001030;
|
||||
ppCalTxHEAMPDULength = 0x40001034;
|
||||
ppCalTxHESMPDULength = 0x40001038;
|
||||
@ -435,8 +435,8 @@ s_mplen_vi_bitmap = 0x4087fdac;
|
||||
s_mplen_bk_bitmap = 0x4087fda8;
|
||||
esp_wifi_cert_tx_mcs = 0x4087fcfc;
|
||||
esp_wifi_cert_tx_bcc = 0x4087fcf8;
|
||||
esp_wifi_cert_tx_ltf = 0x4087fcf4;
|
||||
esp_wifi_cert_tx_gi = 0x4087fcf0;
|
||||
//esp_wifi_cert_tx_ltf = 0x4087fcf4;
|
||||
//esp_wifi_cert_tx_gi = 0x4087fcf0;
|
||||
esp_wifi_cert_tx_nss = 0x4087fcec;
|
||||
esp_test_tx_statistics_aci_bitmap = 0x4087fda4;
|
||||
esp_test_tx_statistics = 0x4087fd94;
|
||||
|
@ -89,6 +89,16 @@ typedef struct esp_now_recv_info {
|
||||
wifi_pkt_rx_ctrl_t * rx_ctrl; /**< Rx control info of ESPNOW packet */
|
||||
} esp_now_recv_info_t;
|
||||
|
||||
/**
|
||||
* @brief ESPNOW rate config
|
||||
*
|
||||
*/
|
||||
typedef struct esp_now_rate_config {
|
||||
wifi_phy_mode_t phymode; /**< ESPNOW phymode of specified interface */
|
||||
wifi_phy_rate_t rate; /**< ESPNOW rate of specified interface*/
|
||||
bool ersu; /**< ESPNOW using ersu send frame*/
|
||||
} esp_now_rate_config_t;
|
||||
|
||||
/**
|
||||
* @brief Callback function of receiving ESPNOW data
|
||||
* @param esp_now_info received ESPNOW packet information
|
||||
@ -242,7 +252,10 @@ esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer);
|
||||
/**
|
||||
* @brief Config ESPNOW rate of specified interface
|
||||
*
|
||||
* @deprecated please use esp_now_set_peer_rate_config() instead.
|
||||
*
|
||||
* @attention 1. This API should be called after esp_wifi_start().
|
||||
* @attention 2. This API only work when not use Wi-Fi 6 and esp_now_set_peer_rate_config() not called.
|
||||
*
|
||||
* @param ifx Interface to be configured.
|
||||
* @param rate Phy rate to be configured.
|
||||
@ -253,6 +266,22 @@ esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer);
|
||||
*/
|
||||
esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate);
|
||||
|
||||
/**
|
||||
* @brief Set ESPNOW rate config for each peer
|
||||
*
|
||||
* @attention 1. This API should be called after esp_wifi_start() and esp_now_init().
|
||||
*
|
||||
* @param peer_addr peer MAC address
|
||||
* @param config rate config to be configured.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : succeed
|
||||
* - ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized
|
||||
* - ESP_ERR_ESPNOW_ARG : invalid argument
|
||||
* - ESP_ERR_ESPNOW_INTERNAL : internal error
|
||||
*/
|
||||
esp_err_t esp_now_set_peer_rate_config(const uint8_t *peer_addr, esp_now_rate_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Get a peer whose MAC address matches peer_addr from peer list
|
||||
*
|
||||
|
@ -779,36 +779,66 @@ typedef enum {
|
||||
WIFI_PHY_RATE_36M = 0x0D, /**< 36 Mbps */
|
||||
WIFI_PHY_RATE_18M = 0x0E, /**< 18 Mbps */
|
||||
WIFI_PHY_RATE_9M = 0x0F, /**< 9 Mbps */
|
||||
WIFI_PHY_RATE_MCS0_LGI = 0x10, /**< MCS0 with long GI, 6.5 Mbps for 20MHz, 13.5 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS1_LGI = 0x11, /**< MCS1 with long GI, 13 Mbps for 20MHz, 27 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS2_LGI = 0x12, /**< MCS2 with long GI, 19.5 Mbps for 20MHz, 40.5 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS3_LGI = 0x13, /**< MCS3 with long GI, 26 Mbps for 20MHz, 54 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS4_LGI = 0x14, /**< MCS4 with long GI, 39 Mbps for 20MHz, 81 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS5_LGI = 0x15, /**< MCS5 with long GI, 52 Mbps for 20MHz, 108 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS6_LGI = 0x16, /**< MCS6 with long GI, 58.5 Mbps for 20MHz, 121.5 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS7_LGI = 0x17, /**< MCS7 with long GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz */
|
||||
/**< rate table and guard interval information for each MCS rate*/
|
||||
/*
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
MCS RATE | HT20 | HT40 | HE20 |
|
||||
WIFI_PHY_RATE_MCS0_LGI | 6.5 Mbps (800ns) | 13.5 Mbps (800ns) | 8.1 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS1_LGI | 13 Mbps (800ns) | 27 Mbps (800ns) | 16.3 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS2_LGI | 19.5 Mbps (800ns) | 40.5 Mbps (800ns) | 24.4 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS3_LGI | 26 Mbps (800ns) | 54 Mbps (800ns) | 32.5 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS4_LGI | 39 Mbps (800ns) | 81 Mbps (800ns) | 48.8 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS5_LGI | 52 Mbps (800ns) | 108 Mbps (800ns) | 65 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS6_LGI | 58.5 Mbps (800ns) | 121.5 Mbps (800ns) | 73.1 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS7_LGI | 65 Mbps (800ns) | 135 Mbps (800ns) | 81.3 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS8_LGI | ----- | ----- | 97.5 Mbps (1600ns) |
|
||||
WIFI_PHY_RATE_MCS9_LGI | ----- | ----- | 108.3 Mbps (1600ns) |
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
WIFI_PHY_RATE_MCS0_LGI = 0x10, /**< MCS0 with long GI */
|
||||
WIFI_PHY_RATE_MCS1_LGI = 0x11, /**< MCS1 with long GI */
|
||||
WIFI_PHY_RATE_MCS2_LGI = 0x12, /**< MCS2 with long GI */
|
||||
WIFI_PHY_RATE_MCS3_LGI = 0x13, /**< MCS3 with long GI */
|
||||
WIFI_PHY_RATE_MCS4_LGI = 0x14, /**< MCS4 with long GI */
|
||||
WIFI_PHY_RATE_MCS5_LGI = 0x15, /**< MCS5 with long GI */
|
||||
WIFI_PHY_RATE_MCS6_LGI = 0x16, /**< MCS6 with long GI */
|
||||
WIFI_PHY_RATE_MCS7_LGI = 0x17, /**< MCS7 with long GI */
|
||||
#if CONFIG_SOC_WIFI_HE_SUPPORT
|
||||
WIFI_PHY_RATE_MCS8_LGI, /**< MCS8 */
|
||||
WIFI_PHY_RATE_MCS9_LGI, /**< MCS9 */
|
||||
WIFI_PHY_RATE_MCS8_LGI, /**< MCS8 with long GI */
|
||||
WIFI_PHY_RATE_MCS9_LGI, /**< MCS9 with long GI */
|
||||
#endif
|
||||
WIFI_PHY_RATE_MCS0_SGI, /**< MCS0 with short GI, 7.2 Mbps for 20MHz, 15 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS1_SGI, /**< MCS1 with short GI, 14.4 Mbps for 20MHz, 30 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS2_SGI, /**< MCS2 with short GI, 21.7 Mbps for 20MHz, 45 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS3_SGI, /**< MCS3 with short GI, 28.9 Mbps for 20MHz, 60 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS4_SGI, /**< MCS4 with short GI, 43.3 Mbps for 20MHz, 90 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS5_SGI, /**< MCS5 with short GI, 57.8 Mbps for 20MHz, 120 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS6_SGI, /**< MCS6 with short GI, 65 Mbps for 20MHz, 135 Mbps for 40MHz */
|
||||
WIFI_PHY_RATE_MCS7_SGI, /**< MCS7 with short GI, 72.2 Mbps for 20MHz, 150 Mbps for 40MHz */
|
||||
/*
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
MCS RATE | HT20 | HT40 | HE20 |
|
||||
WIFI_PHY_RATE_MCS0_SGI | 7.2 Mbps (400ns) | 15 Mbps (400ns) | 8.6 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS1_SGI | 14.4 Mbps (400ns) | 30 Mbps (400ns) | 17.2 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS2_SGI | 21.7 Mbps (400ns) | 45 Mbps (400ns) | 25.8 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS3_SGI | 28.9 Mbps (400ns) | 60 Mbps (400ns) | 34.4 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS4_SGI | 43.3 Mbps (400ns) | 90 Mbps (400ns) | 51.6 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS5_SGI | 57.8 Mbps (400ns) | 120 Mbps (400ns) | 68.8 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS6_SGI | 65 Mbps (400ns) | 135 Mbps (400ns) | 77.4 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS7_SGI | 72.2 Mbps (400ns) | 150 Mbps (400ns) | 86 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS8_SGI | ----- | ----- | 103.2 Mbps (800ns) |
|
||||
WIFI_PHY_RATE_MCS9_SGI | ----- | ----- | 114.7 Mbps (800ns) |
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
WIFI_PHY_RATE_MCS0_SGI, /**< MCS0 with short GI */
|
||||
WIFI_PHY_RATE_MCS1_SGI, /**< MCS1 with short GI */
|
||||
WIFI_PHY_RATE_MCS2_SGI, /**< MCS2 with short GI */
|
||||
WIFI_PHY_RATE_MCS3_SGI, /**< MCS3 with short GI */
|
||||
WIFI_PHY_RATE_MCS4_SGI, /**< MCS4 with short GI */
|
||||
WIFI_PHY_RATE_MCS5_SGI, /**< MCS5 with short GI */
|
||||
WIFI_PHY_RATE_MCS6_SGI, /**< MCS6 with short GI */
|
||||
WIFI_PHY_RATE_MCS7_SGI, /**< MCS7 with short GI */
|
||||
#if CONFIG_SOC_WIFI_HE_SUPPORT
|
||||
WIFI_PHY_RATE_MCS8_SGI, /**< MCS8 */
|
||||
WIFI_PHY_RATE_MCS9_SGI, /**< MCS9 */
|
||||
WIFI_PHY_RATE_MCS8_SGI, /**< MCS8 with short GI */
|
||||
WIFI_PHY_RATE_MCS9_SGI, /**< MCS9 with short GI */
|
||||
#endif
|
||||
WIFI_PHY_RATE_LORA_250K = 0x29, /**< 250 Kbps */
|
||||
WIFI_PHY_RATE_LORA_500K = 0x2A, /**< 500 Kbps */
|
||||
WIFI_PHY_RATE_MAX,
|
||||
} wifi_phy_rate_t;
|
||||
|
||||
|
||||
/** WiFi event declarations */
|
||||
typedef enum {
|
||||
WIFI_EVENT_WIFI_READY = 0, /**< WiFi ready */
|
||||
|
Submodule components/esp_wifi/lib updated: 6484d097a3...522229f2ce
@ -18,6 +18,7 @@
|
||||
#include "esp_wifi_driver.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "esp_wpa3_i.h"
|
||||
#include "esp_wps.h"
|
||||
|
||||
#define WIFI_PASSWORD_LEN_MAX 65
|
||||
|
||||
@ -211,7 +212,12 @@ void hostapd_cleanup(struct hostapd_data *hapd)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SAE */
|
||||
|
||||
#ifdef CONFIG_WPS_REGISTRAR
|
||||
if (esp_wifi_get_wps_type_internal () != WPS_TYPE_DISABLE ||
|
||||
esp_wifi_get_wps_status_internal() != WPS_STATUS_DISABLE) {
|
||||
esp_wifi_ap_wps_disable();
|
||||
}
|
||||
#endif /* CONFIG_WPS_REGISTRAR */
|
||||
os_free(hapd);
|
||||
global_hapd = NULL;
|
||||
|
||||
|
@ -37,8 +37,9 @@ static int wifi_ap_wps_init(const esp_wps_config_t *config)
|
||||
struct wps_sm *sm = NULL;
|
||||
uint8_t mac[ETH_ALEN];
|
||||
struct wps_config cfg = {0};
|
||||
struct hostapd_data *hapd = hostapd_get_hapd_data();
|
||||
|
||||
if (gWpsSm) {
|
||||
if (!hapd || gWpsSm) {
|
||||
goto _out;
|
||||
}
|
||||
|
||||
@ -76,7 +77,7 @@ static int wifi_ap_wps_init(const esp_wps_config_t *config)
|
||||
goto _err;
|
||||
}
|
||||
|
||||
hostapd_init_wps(hostapd_get_hapd_data(), sm->wps, sm->wps_ctx);
|
||||
hostapd_init_wps(hapd, sm->wps, sm->wps_ctx);
|
||||
|
||||
/* Report PIN */
|
||||
if (wps_get_type() == WPS_TYPE_PIN) {
|
||||
@ -171,19 +172,37 @@ int wifi_ap_wps_enable_internal(const esp_wps_config_t *config)
|
||||
|
||||
int esp_wifi_ap_wps_enable(const esp_wps_config_t *config)
|
||||
{
|
||||
int ret;
|
||||
int ret = ESP_OK;
|
||||
struct wps_sm *sm = gWpsSm;
|
||||
wifi_mode_t mode = WIFI_MODE_NULL;
|
||||
|
||||
if (esp_wifi_get_user_init_flag_internal() == 0) {
|
||||
wpa_printf(MSG_ERROR, "wps enable: wifi not started cannot enable wpsreg");
|
||||
return ESP_ERR_WIFI_STATE;
|
||||
}
|
||||
|
||||
ret = esp_wifi_get_mode(&mode);
|
||||
if (mode != WIFI_MODE_AP) {
|
||||
if (mode != WIFI_MODE_AP && mode != WIFI_MODE_APSTA) {
|
||||
wpa_printf(MSG_ERROR, "wps enable: mode=%d does not include AP", mode);
|
||||
return ESP_ERR_WIFI_MODE;
|
||||
}
|
||||
|
||||
if (esp_wifi_ap_get_prof_authmode_internal() == WIFI_AUTH_OPEN) {
|
||||
wpa_printf(MSG_ERROR, "wps enable: wpsreg not supported when authmode is open");
|
||||
return ESP_ERR_WIFI_MODE;
|
||||
}
|
||||
|
||||
API_MUTEX_TAKE();
|
||||
if (s_wps_enabled) {
|
||||
if (sm && os_memcmp(sm->identity, WSC_ID_ENROLLEE, sm->identity_len) == 0) {
|
||||
wpa_printf(MSG_ERROR, "wps enable: wps enrollee already enabled cannot enable wpsreg");
|
||||
ret = ESP_ERR_WIFI_MODE;
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "wps enable: already enabled");
|
||||
ret = ESP_OK;
|
||||
}
|
||||
API_MUTEX_GIVE();
|
||||
wpa_printf(MSG_DEBUG, "wps enable: already enabled");
|
||||
return ESP_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = wifi_ap_wps_enable_internal(config);
|
||||
@ -195,10 +214,9 @@ int esp_wifi_ap_wps_enable(const esp_wps_config_t *config)
|
||||
int esp_wifi_ap_wps_disable(void)
|
||||
{
|
||||
int ret = 0;
|
||||
wifi_mode_t mode = WIFI_MODE_NULL;
|
||||
struct wps_sm *sm = gWpsSm;
|
||||
|
||||
ret = esp_wifi_get_mode(&mode);
|
||||
if (mode != WIFI_MODE_AP) {
|
||||
if (sm && os_memcmp(sm->identity, WSC_ID_ENROLLEE, sm->identity_len) == 0) {
|
||||
return ESP_ERR_WIFI_MODE;
|
||||
}
|
||||
|
||||
@ -230,8 +248,8 @@ int esp_wifi_ap_wps_start(const unsigned char *pin)
|
||||
wifi_mode_t mode = WIFI_MODE_NULL;
|
||||
|
||||
esp_wifi_get_mode(&mode);
|
||||
if (mode != WIFI_MODE_AP) {
|
||||
wpa_printf(MSG_ERROR, "wps start: mode=%d is not AP", mode);
|
||||
if (mode != WIFI_MODE_AP && mode != WIFI_MODE_APSTA) {
|
||||
wpa_printf(MSG_ERROR, "wps start: mode=%d does not include AP", mode);
|
||||
return ESP_ERR_WIFI_MODE;
|
||||
}
|
||||
|
||||
|
@ -294,5 +294,6 @@ uint8_t esp_wifi_get_config_sae_pwe_h2e_internal(uint8_t ifx);
|
||||
bool esp_wifi_ap_notify_node_sae_auth_done(uint8_t *mac);
|
||||
bool esp_wifi_ap_is_sta_sae_reauth_node(uint8_t *mac);
|
||||
uint8_t* esp_wifi_sta_get_sae_identifier_internal(void);
|
||||
bool esp_wifi_eb_tx_status_success_internal(void *eb);
|
||||
|
||||
#endif /* _ESP_WIFI_DRIVER_H_ */
|
||||
|
@ -817,6 +817,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable(void)
|
||||
{
|
||||
wifi_wpa2_param_t param;
|
||||
esp_err_t ret;
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
|
||||
wpa2_api_lock();
|
||||
|
||||
@ -833,6 +834,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable(void)
|
||||
|
||||
if (ESP_OK == ret) {
|
||||
wpa2_set_state(WPA2_STATE_ENABLED);
|
||||
sm->wpa_sm_wpa2_ent_disable = esp_wifi_sta_wpa2_ent_disable;
|
||||
} else {
|
||||
wpa_printf(MSG_ERROR, "failed to enable wpa2 ret=%d", ret);
|
||||
}
|
||||
@ -844,6 +846,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_enable(void)
|
||||
|
||||
esp_err_t esp_wifi_sta_wpa2_ent_disable_fn(void *param)
|
||||
{
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
wpa_printf(MSG_INFO, "WPA2 ENTERPRISE VERSION: [%s] disable", WPA2_VERSION);
|
||||
esp_wifi_unregister_wpa2_cb_internal();
|
||||
|
||||
@ -855,6 +858,7 @@ esp_err_t esp_wifi_sta_wpa2_ent_disable_fn(void *param)
|
||||
eap_peer_unregister_methods();
|
||||
#endif
|
||||
|
||||
sm->wpa_sm_wpa2_ent_disable = NULL;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,15 @@ void wpa_ap_get_peer_spp_msg(void *sm_data, bool *spp_cap, bool *spp_req)
|
||||
|
||||
bool wpa_deattach(void)
|
||||
{
|
||||
struct wpa_sm *sm = &gWpaSm;
|
||||
esp_wpa3_free_sae_data();
|
||||
esp_wifi_sta_wpa2_ent_disable();
|
||||
if (sm->wpa_sm_wpa2_ent_disable) {
|
||||
sm->wpa_sm_wpa2_ent_disable();
|
||||
}
|
||||
if (sm->wpa_sm_wps_disable) {
|
||||
sm->wpa_sm_wps_disable();
|
||||
}
|
||||
|
||||
wpa_sm_deinit();
|
||||
return true;
|
||||
}
|
||||
|
@ -1771,7 +1771,6 @@ int wps_post_block(uint32_t sig, void *arg)
|
||||
|
||||
int wps_check_wifi_mode(void)
|
||||
{
|
||||
bool sniffer = false;
|
||||
wifi_mode_t mode;
|
||||
int ret;
|
||||
|
||||
@ -1781,18 +1780,12 @@ int wps_check_wifi_mode(void)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ret = esp_wifi_get_promiscuous(&sniffer);
|
||||
if (ESP_OK != ret) {
|
||||
wpa_printf(MSG_ERROR, "wps check wifi mode: failed to get sniffer mode ret=%d", ret);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (
|
||||
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
|
||||
mode == WIFI_MODE_AP ||
|
||||
#endif
|
||||
mode == WIFI_MODE_NULL || sniffer == true) {
|
||||
wpa_printf(MSG_ERROR, "wps check wifi mode: wrong wifi mode=%d sniffer=%d", mode, sniffer);
|
||||
mode == WIFI_MODE_NULL) {
|
||||
wpa_printf(MSG_ERROR, "wps check wifi mode: wrong wifi mode=%d ", mode);
|
||||
return ESP_ERR_WIFI_MODE;
|
||||
}
|
||||
|
||||
@ -1801,7 +1794,13 @@ int wps_check_wifi_mode(void)
|
||||
|
||||
int esp_wifi_wps_enable(const esp_wps_config_t *config)
|
||||
{
|
||||
int ret;
|
||||
int ret = ESP_OK;
|
||||
struct wps_sm *sm = gWpsSm;
|
||||
|
||||
if (esp_wifi_get_user_init_flag_internal() == 0) {
|
||||
wpa_printf(MSG_ERROR, "wps enable: wifi not started cannot disable wpsreg");
|
||||
return ESP_ERR_WIFI_STATE;
|
||||
}
|
||||
|
||||
if (ESP_OK != wps_check_wifi_mode()) {
|
||||
return ESP_ERR_WIFI_MODE;
|
||||
@ -1809,9 +1808,14 @@ int esp_wifi_wps_enable(const esp_wps_config_t *config)
|
||||
|
||||
API_MUTEX_TAKE();
|
||||
if (s_wps_enabled) {
|
||||
if (sm && os_memcmp(sm->identity, WSC_ID_REGISTRAR, sm->identity_len) == 0) {
|
||||
wpa_printf(MSG_ERROR, "wps enable: wpsreg already enabled cannot enable wps enrollee");
|
||||
ret = ESP_ERR_WIFI_MODE;
|
||||
} else {
|
||||
wpa_printf(MSG_DEBUG, "wps enable: already enabled");
|
||||
}
|
||||
API_MUTEX_GIVE();
|
||||
wpa_printf(MSG_DEBUG, "wps enable: already enabled");
|
||||
return ESP_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef USE_WPS_TASK
|
||||
@ -1842,6 +1846,7 @@ int esp_wifi_wps_enable(const esp_wps_config_t *config)
|
||||
int wifi_wps_enable_internal(const esp_wps_config_t *config)
|
||||
{
|
||||
int ret = 0;
|
||||
struct wpa_sm *wpa_sm = &gWpaSm;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "ESP WPS crypto initialize!");
|
||||
if (config->wps_type == WPS_TYPE_DISABLE) {
|
||||
@ -1867,7 +1872,7 @@ int wifi_wps_enable_internal(const esp_wps_config_t *config)
|
||||
wps_set_status(WPS_STATUS_DISABLE);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
wpa_sm->wpa_sm_wps_disable = esp_wifi_wps_disable;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@ -1882,8 +1887,10 @@ int esp_wifi_wps_disable(void)
|
||||
{
|
||||
int ret = 0;
|
||||
int wps_status;
|
||||
struct wps_sm *wps_sm = gWpsSm;
|
||||
struct wpa_sm *wpa_sm = &gWpaSm;
|
||||
|
||||
if (ESP_OK != wps_check_wifi_mode()) {
|
||||
if (wps_sm && os_memcmp(wps_sm->identity, WSC_ID_REGISTRAR, wps_sm->identity_len) == 0) {
|
||||
return ESP_ERR_WIFI_MODE;
|
||||
}
|
||||
|
||||
@ -1922,6 +1929,7 @@ int esp_wifi_wps_disable(void)
|
||||
wps_task_deinit();
|
||||
s_wps_enabled = false;
|
||||
API_MUTEX_GIVE();
|
||||
wpa_sm->wpa_sm_wps_disable = NULL;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -2621,6 +2621,12 @@ void eapol_txcb(void *eb)
|
||||
case WPA_FIRST_HALF_4WAY_HANDSHAKE:
|
||||
break;
|
||||
case WPA_LAST_HALF_4WAY_HANDSHAKE:
|
||||
|
||||
if (esp_wifi_eb_tx_status_success_internal(eb) != true) {
|
||||
wpa_printf(MSG_ERROR, "Eapol message 4/4 tx failure, not installing keys");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sm->txcb_flags & WPA_4_4_HANDSHAKE_BIT) {
|
||||
sm->txcb_flags &= ~WPA_4_4_HANDSHAKE_BIT;
|
||||
isdeauth = wpa_supplicant_send_4_of_4_txcallback(sm);
|
||||
|
@ -116,6 +116,8 @@ struct wpa_sm {
|
||||
u16 owe_group;
|
||||
struct wpabuf *owe_ie;
|
||||
#endif /* CONFIG_OWE_STA */
|
||||
int (*wpa_sm_wps_disable)(void);
|
||||
esp_err_t (*wpa_sm_wpa2_ent_disable)(void);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ ESP-NOW uses a vendor-specific action frame to transmit ESP-NOW data. The defaul
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
| MAC Header | Category Code | Organization Identifier | Random Values | Vendor Specific Content | FCS |
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
24 bytes 1 byte 3 bytes 4 bytes 7~255 bytes 4 bytes
|
||||
24 bytes 1 byte 3 bytes 4 bytes 7~257 bytes 4 bytes
|
||||
|
||||
- Category Code: The Category Code field is set to the value(127) indicating the vendor-specific category.
|
||||
- Organization Identifier: The Organization Identifier contains a unique identifier (0x18fe34), which is the first three bytes of MAC address applied by Espressif.
|
||||
|
@ -21,7 +21,7 @@ ESP-NOW 使用各个供应商的动作帧传输数据,默认比特率为 1 Mbp
|
||||
-----------------------------------------------------------------------------------------
|
||||
| MAC 报头 | 分类代码 | 组织标识符 | 随机值 | 供应商特定内容 | FCS |
|
||||
-----------------------------------------------------------------------------------------
|
||||
24 字节 1 字节 3 字节 4 字节 7~255 字节 4 字节
|
||||
24 字节 1 字节 3 字节 4 字节 7~257 字节 4 字节
|
||||
|
||||
- 分类代码:分类代码字段可用于指示各个供应商的类别(比如 127)。
|
||||
- 组织标识符:组织标识符包含一个唯一标识符 (比如 0x18fe34),为乐鑫指定的 MAC 地址的前三个字节。
|
||||
|
Reference in New Issue
Block a user