Skip to content

Commit 5fb9d91

Browse files
krish2718rlubos
authored andcommitted
[nrf fromtree] modules: hostap: Use per-interface control connection
For hostapd also use per-interface control connection like we do for supplicant. Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit b29dddf)
1 parent 17cb7cc commit 5fb9d91

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

modules/hostap/src/hapd_api.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static struct wifi_enterprise_creds_params hapd_enterprise_creds;
3838
#define hostapd_cli_cmd_v(cmd, ...) ({ \
3939
bool status; \
4040
\
41-
if (zephyr_hostapd_cli_cmd_v(cmd, ##__VA_ARGS__) < 0) { \
41+
if (zephyr_hostapd_cli_cmd_v(iface->ctrl_conn, cmd, ##__VA_ARGS__) < 0) { \
4242
wpa_printf(MSG_ERROR, \
4343
"Failed to execute wpa_cli command: %s", \
4444
cmd); \
@@ -365,12 +365,22 @@ int hostapd_add_enterprise_creds(const struct device *dev,
365365
}
366366
#endif
367367

368-
bool hostapd_ap_reg_domain(struct wifi_reg_domain *reg_domain)
368+
bool hostapd_ap_reg_domain(const struct device *dev,
369+
struct wifi_reg_domain *reg_domain)
369370
{
370-
return hostapd_cli_cmd_v("set country_code %s", reg_domain->country_code);
371+
struct hostapd_iface *iface;
372+
373+
iface = get_hostapd_handle(dev);
374+
if (iface == NULL) {
375+
wpa_printf(MSG_ERROR, "Interface %s not found", dev->name);
376+
return false;
377+
}
378+
379+
return hostapd_cli_cmd_v(iface->ctrl_conn, "set country_code %s", reg_domain->country_code);
371380
}
372381

373-
static int hapd_config_chan_center_seg0(struct wifi_connect_req_params *params)
382+
static int hapd_config_chan_center_seg0(struct hostapd_iface *iface,
383+
struct wifi_connect_req_params *params)
374384
{
375385
int ret = 0;
376386
uint8_t center_freq_seg0_idx = 0;
@@ -472,7 +482,7 @@ int hapd_config_network(struct hostapd_iface *iface,
472482
goto out;
473483
}
474484

475-
ret = hapd_config_chan_center_seg0(params);
485+
ret = hapd_config_chan_center_seg0(iface, params);
476486
if (ret) {
477487
goto out;
478488
}

modules/hostap/src/hapd_api.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ int hostapd_ap_config_params(const struct device *dev, struct wifi_ap_config_par
2525
* @brief Set Wi-Fi AP region domain
2626
*
2727
* @param reg_domain region domain parameters
28+
* @param dev Wi-Fi device
2829
* @return true for OK; false for ERROR
2930
*/
30-
bool hostapd_ap_reg_domain(struct wifi_reg_domain *reg_domain);
31+
bool hostapd_ap_reg_domain(const struct device *dev,
32+
struct wifi_reg_domain *reg_domain);
3133

3234
#ifdef CONFIG_WIFI_NM_HOSTAPD_WPS
3335
/** Start AP WPS PBC/PIN

modules/hostap/src/supp_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ int supplicant_reg_domain(const struct device *dev,
17491749
}
17501750

17511751
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
1752-
if (!hostapd_ap_reg_domain(reg_domain)) {
1752+
if (!hostapd_ap_reg_domain(dev, reg_domain)) {
17531753
goto out;
17541754
}
17551755
}

0 commit comments

Comments
 (0)