net: wifi: Check for mandatory args

Even though we are passing mandatory args from the shell registration,
due to use of getopt the check can be bypassed without the hyphenated
options.

So, enforce and fail if mandatory parameters aren't passed through
getopt.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
Chaitanya Tata 2024-04-20 21:04:29 +05:30 committed by Anas Nashif
parent ddf09c9f58
commit b29dff09fa

View file

@ -574,6 +574,16 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv
if (params->psk && !secure_connection) {
PR_WARNING("Passphrase provided without security configuration\n");
}
if (!params->ssid) {
PR_ERROR("SSID not provided\n");
return -EINVAL;
}
if (iface_mode == WIFI_MODE_AP && params->channel == WIFI_CHANNEL_ANY) {
PR_ERROR("Channel not provided\n");
return -EINVAL;
}
return 0;
}