Skip to content

Commit

Permalink
net: wifi: Check for mandatory args
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit b29dff0)

Original-Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
GitOrigin-RevId: b29dff0
Change-Id: I4cbc49f118f946879775733f3c14d53778fdab91
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5482304
Tested-by: Dawid Niedźwiecki <dawidn@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Dawid Niedźwiecki <dawidn@google.com>
Commit-Queue: Dawid Niedźwiecki <dawidn@google.com>
  • Loading branch information
krish2718 authored and Chromeos LUCI committed Apr 24, 2024
1 parent c04f30c commit 7f8a292
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subsys/net/l2/wifi/wifi_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7f8a292

Please sign in to comment.