Skip to content

Commit 6d4f892

Browse files
committed
net: lib: wifi_credentials: Use correct Wi-Fi interface
Fix auto_connect to use the correct Wi-Fi interface (STA) instead of the first L2 Ethernet interface. Fixes zephyrproject-rtos#88441. Signed-off-by: Triveni Danda <[email protected]>
1 parent eca5790 commit 6d4f892

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/net/lib/wifi_credentials/wifi_credentials_shell.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[])
340340
}
341341

342342
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
343-
struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET));
343+
struct net_if *iface = net_if_get_wifi_sta();
344344

345345
/* Load the enterprise credentials if needed */
346346
if (creds.header.type == WIFI_SECURITY_TYPE_EAP_TLS ||
@@ -381,7 +381,7 @@ static int cmd_list_networks(const struct shell *sh, size_t argc, char *argv[])
381381

382382
static int cmd_auto_connect(const struct shell *sh, size_t argc, char *argv[])
383383
{
384-
struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET));
384+
struct net_if *iface = net_if_get_wifi_sta();
385385
int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0);
386386

387387
if (rc) {

0 commit comments

Comments
 (0)