Skip to content

Commit f72b2d4

Browse files
nxf58150jukkar
authored andcommitted
zephyr: Update SoftAP event functions of Zephyr with hostapd enabled
Update SoftAP event functions of Zephyr with hostapd enabled to support hostapd split in glue layer. Signed-off-by: Hui Bai <[email protected]>
1 parent e83c949 commit f72b2d4

File tree

4 files changed

+42
-22
lines changed

4 files changed

+42
-22
lines changed

hostapd/hostapd_cli_zephyr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "common/version.h"
2020
#include "common/ieee802_11_defs.h"
2121
#include "supp_main.h"
22-
#include "supp_events.h"
22+
#include "hapd_events.h"
2323
#include "ctrl_iface_zephyr.h"
2424
#include "hostapd_cli_zephyr.h"
2525

src/ap/hostapd.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#include "wpa_auth_kay.h"
5959
#include "hw_features.h"
6060
#ifdef __ZEPHYR__
61-
#include <supp_events.h>
61+
#include <hapd_events.h>
6262
#endif /* __ZEPHYR__ */
6363

6464

@@ -2696,11 +2696,11 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
26962696
for (j = 0; j < iface->num_bss; j++)
26972697
hostapd_neighbor_set_own_report(iface->bss[j]);
26982698

2699-
#if defined(__ZEPHYR__) && defined(CONFIG_WIFI_NM_HOSTAPD_AP)
2700-
supplicant_send_wifi_mgmt_ap_status(iface,
2701-
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
2702-
WIFI_STATUS_AP_SUCCESS);
2703-
#endif /* __ZEPHYR__ && CONFIG_WIFI_NM_HOSTAPD_AP */
2699+
#ifdef __ZEPHYR__
2700+
hostapd_send_wifi_mgmt_ap_status(iface,
2701+
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
2702+
WIFI_STATUS_AP_SUCCESS);
2703+
#endif /* __ZEPHYR__ */
27042704
if (iface->interfaces && iface->interfaces->count > 1)
27052705
ieee802_11_set_beacons(iface);
27062706

src/ap/hw_features.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "hw_features.h"
2626

2727
#ifdef __ZEPHYR__
28+
#include <hapd_events.h>
2829
#include <supp_events.h>
2930
#endif /* __ZEPHYR__ */
3031

@@ -1141,9 +1142,15 @@ hostapd_check_chans(struct hostapd_iface *iface)
11411142
err = hostapd_is_usable_chans(iface);
11421143
if (err <= 0) {
11431144
#ifdef __ZEPHYR__
1144-
supplicant_send_wifi_mgmt_ap_status(iface->owner,
1145-
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1146-
WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED);
1145+
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
1146+
hostapd_send_wifi_mgmt_ap_status(iface,
1147+
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1148+
WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED);
1149+
} else {
1150+
supplicant_send_wifi_mgmt_ap_status(iface->owner,
1151+
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1152+
WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED);
1153+
}
11471154
#endif /* __ZEPHYR__ */
11481155
if (!err)
11491156
return HOSTAPD_CHAN_INVALID;
@@ -1166,9 +1173,15 @@ hostapd_check_chans(struct hostapd_iface *iface)
11661173
case HOSTAPD_CHAN_INVALID:
11671174
default:
11681175
#ifdef __ZEPHYR__
1169-
supplicant_send_wifi_mgmt_ap_status(iface->owner,
1170-
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1171-
WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED);
1176+
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
1177+
hostapd_send_wifi_mgmt_ap_status(iface,
1178+
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1179+
WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED);
1180+
} else {
1181+
supplicant_send_wifi_mgmt_ap_status(iface->owner,
1182+
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1183+
WIFI_STATUS_AP_CHANNEL_NOT_ALLOWED);
1184+
}
11721185
#endif /* __ZEPHYR__ */
11731186
return HOSTAPD_CHAN_INVALID;
11741187
}
@@ -1318,9 +1331,15 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
13181331
"Hardware does not support configured mode (%d) (hw_mode in hostapd.conf)",
13191332
(int) iface->conf->hw_mode);
13201333
#ifdef __ZEPHYR__
1321-
supplicant_send_wifi_mgmt_ap_status(iface->owner,
1322-
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1323-
WIFI_STATUS_AP_CHANNEL_NOT_SUPPORTED);
1334+
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
1335+
hostapd_send_wifi_mgmt_ap_status(iface,
1336+
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1337+
WIFI_STATUS_AP_CHANNEL_NOT_SUPPORTED);
1338+
} else {
1339+
supplicant_send_wifi_mgmt_ap_status(iface->owner,
1340+
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
1341+
WIFI_STATUS_AP_CHANNEL_NOT_SUPPORTED);
1342+
}
13241343
#endif /* __ZEPHYR__ */
13251344
return -2;
13261345
}

src/ap/sta_info.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "wps_hostapd.h"
4242

4343
#ifdef __ZEPHYR__
44+
#include <hapd_events.h>
4445
#include <supp_events.h>
4546
#endif /* __ZEPHYR__ */
4647

@@ -1589,15 +1590,15 @@ void ap_sta_set_authorized_event(struct hostapd_data *hapd,
15891590
}
15901591

15911592
#ifdef __ZEPHYR__
1592-
#ifdef CONFIG_WIFI_NM_HOSTAPD_AP
1593-
supplicant_send_wifi_mgmt_ap_sta_event(hapd->iface,
1594-
event,
1595-
sta);
1596-
#else
1593+
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
1594+
hostapd_send_wifi_mgmt_ap_sta_event(hapd->iface,
1595+
event,
1596+
sta);
1597+
} else {
15971598
supplicant_send_wifi_mgmt_ap_sta_event(hapd->iface->owner,
15981599
event,
15991600
sta);
1600-
#endif
1601+
}
16011602
#endif /* __ZEPHYR__ */
16021603
if (hapd->sta_authorized_cb)
16031604
hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,

0 commit comments

Comments
 (0)