From 51c5c650cc52c1425ed2062bbf8b0322a2931f81 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Wed, 27 Mar 2024 16:16:18 +0530 Subject: [PATCH 1/3] manifest: sdk-zephyr: Pull in changes for Wi-Fi connect options Pull in changes done to support getopt for Wi-Fi connect command as well as additional support to configure BSSID in connect command. Signed-off-by: Ravi Dondaputi --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 56d6107542eb..52ef6c40d548 100644 --- a/west.yml +++ b/west.yml @@ -63,7 +63,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: d4ee5b3ce2ae353412430857cba05dfe846049cd + revision: 700870d10917960e4799926b864189d755d95f83 import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above From eaaaa8cabd8bf3dcc9f4e3eacaa29511fbdd5389 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Wed, 27 Mar 2024 16:18:37 +0530 Subject: [PATCH 2/3] modules: hostap: Support BSSID configuration for connect command Support BSSID configuration while setting up the network information as part of the connect command processing. Signed-off-by: Ravi Dondaputi --- modules/hostap/src/supp_api.c | 20 ++++++++++++++++++++ modules/hostap/src/supp_api.h | 1 + 2 files changed, 21 insertions(+) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 316f4de70a74..50600274f269 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -294,6 +294,7 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, int ret; struct add_network_resp resp = {0}; char *chan_list = NULL; + struct net_eth_addr mac = {0}; _wpa_cli_cmd_v("remove_network all"); ret = z_wpa_ctrl_add_network(&resp); @@ -403,6 +404,25 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, } } + memcpy((void *)&mac, params->bssid, WIFI_MAC_ADDR_LEN); + if (net_eth_is_addr_broadcast(&mac) || + net_eth_is_addr_multicast(&mac)) { + wpa_printf(MSG_ERROR, "Invalid BSSID. Configuration " + "of multicast or broadcast MAC is not allowed."); + ret = -EINVAL; + goto rem_net; + } + + if (!net_eth_is_addr_unspecified(&mac)) { + char bssid_str[MAC_STR_LEN] = {0}; + + snprintf(bssid_str, MAC_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x", + params->bssid[0], params->bssid[1], params->bssid[2], + params->bssid[3], params->bssid[4], params->bssid[5]); + _wpa_cli_cmd_v("set_network %d bssid %s", + resp.network_id, bssid_str); + } + /* enable and select network */ _wpa_cli_cmd_v("enable_network %d", resp.network_id); _wpa_cli_cmd_v("select_network %d", resp.network_id); diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index c31491d359bc..adf75dccb068 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -12,6 +12,7 @@ #define MAX_SSID_LEN 32 #define MAC_ADDR_LEN 6 +#define MAC_STR_LEN 18 /* for ':' or '-' separated MAC address string */ #define CHAN_NUM_LEN 6 /* for space-separated channel numbers string */ /** From 263c41a0f47846b12db20e105307e571e0c49730 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 16 Apr 2024 14:38:43 +0530 Subject: [PATCH 3/3] samples: wifi: shell: Increase shell stack size Calls for Wi-Fi related operations from shell are quite deep (around 7 levels) which eats up the available stack and causes stack overflow issues. Increase the SHELL_STACK_SIZE to account for this. Signed-off-by: Ravi Dondaputi --- samples/wifi/shell/prj.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/wifi/shell/prj.conf b/samples/wifi/shell/prj.conf index 909826d2c17f..0130401b3eba 100644 --- a/samples/wifi/shell/prj.conf +++ b/samples/wifi/shell/prj.conf @@ -51,7 +51,7 @@ CONFIG_NET_SHELL=y # Memories CONFIG_MAIN_STACK_SIZE=4096 -CONFIG_SHELL_STACK_SIZE=4096 +CONFIG_SHELL_STACK_SIZE=4200 CONFIG_NET_TX_STACK_SIZE=4096 CONFIG_NET_RX_STACK_SIZE=4096