-
Notifications
You must be signed in to change notification settings - Fork 21
zephyr: Update SoftAP event functions of Zephyr with hostapd enabled #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fdd8641
to
b7f65d9
Compare
b7f65d9
to
536ef15
Compare
supplicant_send_wifi_mgmt_ap_status(iface, | ||
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, | ||
WIFI_STATUS_AP_SUCCESS); | ||
#endif /* __ZEPHYR__ && CONFIG_WIFI_NM_HOSTAPD_AP */ | ||
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */ | ||
#endif /* __ZEPHYR__ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something nasty here. iface
is a struct hostapd_iface *
. However, supplicant_send_wifi_mgmt_ap_status()
cast it in struct wpa_supplicant *
.
In addition, this compile time condition prevent to choose AP or supplicant mode during runtime (even if it not yet supported, we probably want to do it in the future).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for softAP with hostapd only so I removed function call of supplicant_send_wifi_mgmt_ap_status() here.
I think this PR is targeting on hostapd support split. For choosing mode at runtime, more changes could be made in the future once the feature is required and have detailed plan.
Thanks!
#else | ||
supplicant_send_wifi_mgmt_ap_sta_event(hapd->iface->owner, | ||
event, | ||
sta); | ||
#endif | ||
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */ | ||
#endif /* __ZEPHYR__ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto. I believe we need to evaluate this condition during runtime:
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP) && is_softap_running) {
hostapd_send_wifi_mgmt_ap_sta_event(...);
} else if (IS_ENABLED(CONFIG_WIFI_NM_WPA_SUPPLICANT) && !is_softap_running) {
supplicant_send_wifi_mgmt_ap_sta_event(...);
} else {
/* Panic! */
}
BTW, I feel this code should be relocated in zephyr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous reply, for choosing mode at runtime, more changes could be made in the future once the feature is required and have detailed plan.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe my comment is still relevant even if is_softap_running
does not exist:
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
hostapd_send_wifi_mgmt_ap_sta_event(...);
} else {
supplicant_send_wifi_mgmt_ap_sta_event(...);
}
(In order to compile this, you have to include hapd_events.h
and supp_events.h
unconditionally).
BTW, rather than duplicating this pattern everywhere in hostapd, isn't it possible to locate it in one/two functions in the Zephyr side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
ping @nxf58150 could you address the comments from @jerome-pouiller |
Just back to office from Chinese New Year Holiday. Will update PR soon. Thanks! |
536ef15
to
1fd1cad
Compare
src/ap/hostapd.c
Outdated
#include <supp_events.h> | ||
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is supp_events.h
still required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
#else | ||
supplicant_send_wifi_mgmt_ap_sta_event(hapd->iface->owner, | ||
event, | ||
sta); | ||
#endif | ||
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */ | ||
#endif /* __ZEPHYR__ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe my comment is still relevant even if is_softap_running
does not exist:
if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
hostapd_send_wifi_mgmt_ap_sta_event(...);
} else {
supplicant_send_wifi_mgmt_ap_sta_event(...);
}
(In order to compile this, you have to include hapd_events.h
and supp_events.h
unconditionally).
BTW, rather than duplicating this pattern everywhere in hostapd, isn't it possible to locate it in one/two functions in the Zephyr side?
1fd1cad
to
6f7c709
Compare
Update SoftAP event functions of Zephyr with hostapd enabled to support hostapd split in glue layer. Signed-off-by: Hui Bai <[email protected]>
6f7c709
to
3af0e1f
Compare
Update SoftAP event functions of Zephyr with hostapd enabled.