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:
parent
ddf09c9f58
commit
b29dff09fa
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue