mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/dpp_config_memset_v5.1' into 'release/v5.1'
Wi-Fi: Fixed some DPP issues (v5.1) See merge request espressif/esp-idf!27192
This commit is contained in:
commit
ea081e04b9
@ -14,6 +14,7 @@
|
||||
#include "esp_event.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "esp_wps_i.h"
|
||||
|
||||
#ifdef CONFIG_DPP
|
||||
static void *s_dpp_task_hdl = NULL;
|
||||
@ -179,6 +180,7 @@ static int esp_dpp_handle_config_obj(struct dpp_authentication *auth,
|
||||
{
|
||||
wifi_config_t *wifi_cfg = &s_dpp_ctx.wifi_cfg;
|
||||
|
||||
os_memset(wifi_cfg, 0, sizeof(wifi_config_t));
|
||||
if (conf->ssid_len) {
|
||||
os_memcpy(wifi_cfg->sta.ssid, conf->ssid, conf->ssid_len);
|
||||
}
|
||||
@ -609,6 +611,11 @@ void esp_supp_dpp_stop_listen(void)
|
||||
esp_wifi_remain_on_channel(WIFI_IF_STA, WIFI_ROC_CANCEL, 0, 0, NULL);
|
||||
}
|
||||
|
||||
bool is_dpp_enabled(void)
|
||||
{
|
||||
return (s_dpp_ctx.dpp_global ? true : false);
|
||||
}
|
||||
|
||||
esp_err_t esp_supp_dpp_init(esp_supp_dpp_event_cb_t cb)
|
||||
{
|
||||
wifi_mode_t mode = 0;
|
||||
@ -616,6 +623,11 @@ esp_err_t esp_supp_dpp_init(esp_supp_dpp_event_cb_t cb)
|
||||
wpa_printf(MSG_ERROR, "DPP: failed to init as not in station mode.");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (is_wps_enabled()) {
|
||||
wpa_printf(MSG_ERROR, "DPP: failed to init since WPS is enabled");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
if (s_dpp_ctx.dpp_global) {
|
||||
wpa_printf(MSG_ERROR, "DPP: failed to init as init already done.");
|
||||
return ESP_FAIL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -55,4 +55,12 @@ struct esp_dpp_context_t {
|
||||
|
||||
int esp_supp_rx_action(uint8_t *hdr, uint8_t *payload, size_t len, uint8_t channel);
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_DPP_SUPPORT
|
||||
bool is_dpp_enabled(void);
|
||||
#else
|
||||
static inline bool is_dpp_enabled(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif /* ESP_DPP_I_H */
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "esp_err.h"
|
||||
#include "esp_private/wifi.h"
|
||||
#include "esp_wps_i.h"
|
||||
#include "esp_dpp_i.h"
|
||||
#include "esp_wps.h"
|
||||
#include "eap_common/eap_wsc_common.h"
|
||||
#include "esp_wpas_glue.h"
|
||||
@ -1863,6 +1864,11 @@ int esp_wifi_wps_enable(const esp_wps_config_t *config)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool is_wps_enabled(void)
|
||||
{
|
||||
return s_wps_enabled;
|
||||
}
|
||||
|
||||
int wifi_wps_enable_internal(const esp_wps_config_t *config)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -1873,7 +1879,10 @@ int wifi_wps_enable_internal(const esp_wps_config_t *config)
|
||||
wpa_printf(MSG_ERROR, "wps enable: invalid wps type");
|
||||
return ESP_ERR_WIFI_WPS_TYPE;
|
||||
}
|
||||
|
||||
if (is_dpp_enabled()) {
|
||||
wpa_printf(MSG_ERROR, "wps enabled failed since DPP is initialized");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
wpa_printf(MSG_DEBUG, "Set factory information.");
|
||||
ret = wps_set_factory_info(config);
|
||||
if (ret != 0) {
|
||||
|
@ -125,5 +125,7 @@ static inline int wps_set_status(uint32_t status)
|
||||
{
|
||||
return esp_wifi_set_wps_status_internal(status);
|
||||
}
|
||||
|
||||
bool is_wps_enabled(void);
|
||||
int wps_init_cfg_pin(struct wps_config *cfg);
|
||||
void wifi_station_wps_eapol_start_handle(void *data, void *user_ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user