Skip to content

Commit b55f90e

Browse files
committed
modules: hostap: Update WPA supplicant to use per-VIF control channel
Update WPA supplicant functions to pass the control channel (socket) as a parameter instead of relying on a global socket. This change aligns with the PR 80 modifications in hostap repo and ensures that each Virtual Interface (VIF) uses its dedicated control channel for communication. Signed-off-by: Hanan Arshad <[email protected]>
1 parent 3eab89f commit b55f90e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

modules/hostap/src/supp_api.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static K_WORK_DELAYABLE_DEFINE(wpa_supp_status_work,
8383
#define wpa_cli_cmd_v(cmd, ...) ({ \
8484
bool status; \
8585
\
86-
if (zephyr_wpa_cli_cmd_v(cmd, ##__VA_ARGS__) < 0) { \
86+
if (zephyr_wpa_cli_cmd_v(wpa_s->ctrl_conn, cmd, ##__VA_ARGS__) < 0) { \
8787
wpa_printf(MSG_ERROR, \
8888
"Failed to execute wpa_cli command: %s", \
8989
cmd); \
@@ -620,7 +620,7 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
620620
goto out;
621621
}
622622

623-
ret = z_wpa_ctrl_add_network(&resp);
623+
ret = z_wpa_ctrl_add_network(wpa_s->ctrl_conn, &resp);
624624
if (ret) {
625625
wpa_printf(MSG_ERROR, "Failed to add network");
626626
goto out;
@@ -1309,7 +1309,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
13091309
status->channel = channel;
13101310

13111311
if (ssid_len == 0) {
1312-
int _res = z_wpa_ctrl_status(&cli_status);
1312+
int _res = z_wpa_ctrl_status(wpa_s->ctrl_conn, &cli_status);
13131313

13141314
if (_res < 0) {
13151315
ssid_len = 0;
@@ -1338,7 +1338,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
13381338

13391339
status->rssi = -WPA_INVALID_NOISE;
13401340
if (status->iface_mode == WIFI_MODE_INFRA) {
1341-
ret = z_wpa_ctrl_signal_poll(&signal_poll);
1341+
ret = z_wpa_ctrl_signal_poll(wpa_s->ctrl_conn, &signal_poll);
13421342
if (!ret) {
13431343
status->rssi = signal_poll.rssi;
13441344
status->current_phy_tx_rate = signal_poll.current_txrate;
@@ -1488,6 +1488,7 @@ int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params)
14881488
int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_params *params)
14891489
{
14901490
int ssid_len = strlen(params->ssid);
1491+
struct wpa_supplicant *wpa_s = get_wpa_s_handle(dev);
14911492

14921493
if (params != NULL && ssid_len > 0) {
14931494
if (ssid_len > WIFI_SSID_MAX_LEN) {
@@ -1754,6 +1755,7 @@ int supplicant_bss_ext_capab(const struct device *dev, int capab)
17541755
int supplicant_legacy_roam(const struct device *dev)
17551756
{
17561757
int ret = -1;
1758+
struct wpa_supplicant *wpa_s = get_wpa_s_handle(dev);
17571759

17581760
k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER);
17591761
if (!wpa_cli_cmd_v("scan")) {
@@ -1862,7 +1864,7 @@ static int supplicant_wps_pin(const struct device *dev, struct wifi_wps_config_p
18621864
}
18631865

18641866
if (params->oper == WIFI_WPS_PIN_GET) {
1865-
if (zephyr_wpa_cli_cmd_resp(get_pin_cmd, params->pin)) {
1867+
if (zephyr_wpa_cli_cmd_resp(wpa_s->ctrl_conn, get_pin_cmd, params->pin)) {
18661868
goto out;
18671869
}
18681870
} else if (params->oper == WIFI_WPS_PIN_SET) {

0 commit comments

Comments
 (0)