mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
risc-v/esp32c3: Fix the issue of getting wrong Wi-Fi password
This commit is contained in:
@@ -5120,13 +5120,6 @@ int esp_wifi_sta_password(struct iwreq *iwr, bool set)
|
|||||||
DEBUGASSERT(ext != NULL);
|
DEBUGASSERT(ext != NULL);
|
||||||
|
|
||||||
pdata = ext->key;
|
pdata = ext->key;
|
||||||
len = ext->key_len;
|
|
||||||
|
|
||||||
if (set && len > PWD_MAX_LEN)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&wifi_cfg, 0x0, sizeof(wifi_config_t));
|
memset(&wifi_cfg, 0x0, sizeof(wifi_config_t));
|
||||||
ret = esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg);
|
ret = esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -5137,6 +5130,12 @@ int esp_wifi_sta_password(struct iwreq *iwr, bool set)
|
|||||||
|
|
||||||
if (set)
|
if (set)
|
||||||
{
|
{
|
||||||
|
len = ext->key_len;
|
||||||
|
if (len > PWD_MAX_LEN)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(wifi_cfg.sta.password, pdata, len);
|
memcpy(wifi_cfg.sta.password, pdata, len);
|
||||||
|
|
||||||
wifi_cfg.sta.pmf_cfg.capable = true;
|
wifi_cfg.sta.pmf_cfg.capable = true;
|
||||||
@@ -5150,6 +5149,7 @@ int esp_wifi_sta_password(struct iwreq *iwr, bool set)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
len = iwr->u.encoding.length - sizeof(*ext);
|
||||||
size = strnlen((char *)wifi_cfg.sta.password, PWD_MAX_LEN);
|
size = strnlen((char *)wifi_cfg.sta.password, PWD_MAX_LEN);
|
||||||
if (len < size)
|
if (len < size)
|
||||||
{
|
{
|
||||||
@@ -5157,8 +5157,8 @@ int esp_wifi_sta_password(struct iwreq *iwr, bool set)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = size;
|
ext->key_len = size;
|
||||||
memcpy(pdata, wifi_cfg.sta.password, len);
|
memcpy(pdata, wifi_cfg.sta.password, ext->key_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_sta_connected)
|
if (g_sta_connected)
|
||||||
@@ -5862,7 +5862,7 @@ int esp_wifi_sta_country(struct iwreq *iwr, bool set)
|
|||||||
country_code = (char *)iwr->u.data.pointer;
|
country_code = (char *)iwr->u.data.pointer;
|
||||||
if (strlen(country_code) != 2)
|
if (strlen(country_code) != 2)
|
||||||
{
|
{
|
||||||
wlerr("ERROR: Invalid input arguments\r\n");
|
wlerr("ERROR: Invalid input arguments\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -271,6 +271,10 @@ static int wlan_sta_set_linkstatus(FAR struct net_driver_s *dev,
|
|||||||
bool linkstatus);
|
bool linkstatus);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_ICMPv6
|
||||||
|
static void wlan_ipv6multicast(FAR struct wlan_priv_s *priv);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -1215,7 +1219,7 @@ static int wlan_ifup(FAR struct net_driver_s *dev)
|
|||||||
(uint8_t)(dev->d_ipaddr >> 16), (uint8_t)(dev->d_ipaddr >> 24));
|
(uint8_t)(dev->d_ipaddr >> 16), (uint8_t)(dev->d_ipaddr >> 24));
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
winfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
ninfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
||||||
dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
|
dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
|
||||||
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
||||||
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
||||||
|
|||||||
Reference in New Issue
Block a user