Skip to content

Commit 50cc298

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 1a3bf01 commit 50cc298

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
@@ -86,7 +86,7 @@ static K_WORK_DELAYABLE_DEFINE(wpa_supp_status_work,
8686
#define wpa_cli_cmd_v(cmd, ...) ({ \
8787
bool status; \
8888
\
89-
if (zephyr_wpa_cli_cmd_v(cmd, ##__VA_ARGS__) < 0) { \
89+
if (zephyr_wpa_cli_cmd_v(wpa_s->ctrl_conn, cmd, ##__VA_ARGS__) < 0) { \
9090
wpa_printf(MSG_ERROR, \
9191
"Failed to execute wpa_cli command: %s", \
9292
cmd); \
@@ -937,7 +937,7 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
937937
goto out;
938938
}
939939

940-
ret = z_wpa_ctrl_add_network(&resp);
940+
ret = z_wpa_ctrl_add_network(wpa_s->ctrl_conn, &resp);
941941
if (ret) {
942942
wpa_printf(MSG_ERROR, "Failed to add network");
943943
goto out;
@@ -1626,7 +1626,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
16261626
status->channel = channel;
16271627

16281628
if (ssid_len == 0) {
1629-
int _res = z_wpa_ctrl_status(&cli_status);
1629+
int _res = z_wpa_ctrl_status(wpa_s->ctrl_conn, &cli_status);
16301630

16311631
if (_res < 0) {
16321632
ssid_len = 0;
@@ -1655,7 +1655,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
16551655

16561656
status->rssi = -WPA_INVALID_NOISE;
16571657
if (status->iface_mode == WIFI_MODE_INFRA) {
1658-
ret = z_wpa_ctrl_signal_poll(&signal_poll);
1658+
ret = z_wpa_ctrl_signal_poll(wpa_s->ctrl_conn, &signal_poll);
16591659
if (!ret) {
16601660
status->rssi = signal_poll.rssi;
16611661
status->current_phy_tx_rate = signal_poll.current_txrate;
@@ -1805,6 +1805,7 @@ int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params)
18051805
int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_params *params)
18061806
{
18071807
int ssid_len = strlen(params->ssid);
1808+
struct wpa_supplicant *wpa_s = get_wpa_s_handle(dev);
18081809

18091810
if (params != NULL && ssid_len > 0) {
18101811
if (ssid_len > WIFI_SSID_MAX_LEN) {
@@ -2071,6 +2072,7 @@ int supplicant_bss_ext_capab(const struct device *dev, int capab)
20712072
int supplicant_legacy_roam(const struct device *dev)
20722073
{
20732074
int ret = -1;
2075+
struct wpa_supplicant *wpa_s = get_wpa_s_handle(dev);
20742076

20752077
k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER);
20762078
if (!wpa_cli_cmd_v("scan")) {
@@ -2179,7 +2181,7 @@ static int supplicant_wps_pin(const struct device *dev, struct wifi_wps_config_p
21792181
}
21802182

21812183
if (params->oper == WIFI_WPS_PIN_GET) {
2182-
if (zephyr_wpa_cli_cmd_resp(get_pin_cmd, params->pin)) {
2184+
if (zephyr_wpa_cli_cmd_resp(wpa_s->ctrl_conn, get_pin_cmd, params->pin)) {
21832185
goto out;
21842186
}
21852187
} else if (params->oper == WIFI_WPS_PIN_SET) {

0 commit comments

Comments
 (0)