From fff520f8648ca4b581e3b2d1d084e1d5130c6076 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 16 Apr 2024 19:13:37 +0530 Subject: [PATCH] wifi: shell: Support WPA auto personal security mode Applications need to run a scan to identify the security mode before attempting the connection which adds to the time taken for connection to be established. To avoid the initial scan, support auto security mode which will enable STA to choose between WPA, WPA2 and WPA3, based on the network configuration. Signed-off-by: Ravi Dondaputi --- include/zephyr/net/wifi.h | 2 ++ subsys/net/l2/wifi/wifi_mgmt.c | 3 ++- subsys/net/l2/wifi/wifi_shell.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index a0840a2319a0c7c..ebfc76d2192d10c 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -49,6 +49,8 @@ enum wifi_security_type { WIFI_SECURITY_TYPE_WEP, /** WPA-PSK security. */ WIFI_SECURITY_TYPE_WPA_PSK, + /** WPA/WPA2/WPA3 PSK security. */ + WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL, __WIFI_SECURITY_TYPE_AFTER_LAST, WIFI_SECURITY_TYPE_MAX = __WIFI_SECURITY_TYPE_AFTER_LAST - 1, diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 5ef047e6c72ba6a..6b61146ece68256 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -275,7 +275,8 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, (params->ssid_length == 0U) || ((params->security == WIFI_SECURITY_TYPE_PSK || params->security == WIFI_SECURITY_TYPE_WPA_PSK || - params->security == WIFI_SECURITY_TYPE_PSK_SHA256) && + params->security == WIFI_SECURITY_TYPE_PSK_SHA256 || + params->security == WIFI_SECURITY_TYPE_WPA_AUTO) && ((params->psk_length < 8) || (params->psk_length > 64) || (params->psk_length == 0U) || !params->psk)) || ((params->security == WIFI_SECURITY_TYPE_SAE) && diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a858c9c1b7bde6f..d83c0c17198aeee 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1870,7 +1870,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz]\n" "[-p, --psk]: Passphrase (valid only for secure SSIDs)\n" "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP, 7: WPA-PSK, 8: WPA-Auto\n" "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" ": 0:Disable, 1:Optional, 2:Required.\n" "[-m, --bssid]: MAC address of the AP (BSSID).\n"