-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
wifi: Add full AP mode support (using hostapd) #75224
Conversation
Hello @nxf58150, and thank you very much for your first pull request to the Zephyr project! |
9141d95
to
de7eb95
Compare
modules/hostap/src/supp_events.c
Outdated
struct hostapd_iface *iface = ctx; | ||
char *ifname = iface->bss[0]->conf->iface; |
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.
Could we call this something else than iface
, it gets easily mixed up with zephyr network interface variable which is also called iface
all over the place 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.
How about use name "ap_ctx"
instead of "iface"
here?
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.
Renamed to ap_ctx
here.
modules/hostap/src/supp_main.c
Outdated
bss->nas_identifier = os_strdup("ap.example.com"); | ||
bss->eap_sim_db = os_strdup("unix:/tmp/hlr_auc_gw.sock"); | ||
os_memcpy(conf->country, "US ", 3); |
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.
The domain socket is something that is not needed in zephyr.
Also the hardcoded values look wrong.
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 line 845.
modules/hostap/src/supp_main.c
Outdated
iface = net_if_get_wifi_uap(); | ||
/* Allocate and parse configuration for full interface files */ | ||
dev = net_if_get_device(iface); | ||
strncpy(ifname, dev->name, IFNAMSIZ); |
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.
We should not use device name as an interface name.
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.
Isn't this depend on zephyrproject-rtos/hostap#15, the west.yml should be updated too in that case. |
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 don't see the dynamic interfaces support for HOSTAPD_AP i.e., monitoring interface state events and accordingly stop/start using the interface, is this planned?
modules/hostap/Kconfig
Outdated
@@ -171,6 +175,9 @@ config WIFI_NM_WPA_SUPPLICANT_WPA3 | |||
config WIFI_NM_WPA_SUPPLICANT_AP | |||
bool "AP mode support" | |||
|
|||
config WIFI_NM_HOSTAPD_AP | |||
bool "AP mode hostapd support" |
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.
hostapd based full AP mode
and we can fix WIFI_NM_WPA_SUPPLICANT_AP
to SoftAP mode support based on WPA supplicant
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.
if (!hostapd_cli_cmd_v("set ssid %s", params->ssid)) { | ||
goto out; | ||
} |
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.
you can use a macro do the NULL check + goto out, like we did for WPA supplicant.
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.
return ret; | ||
} | ||
|
||
int hapd_config_network(struct hostapd_iface *iface, |
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.
IIUC, the commands itself are common b/w SoftAP and FullAP, so, may be if you write a wrapper to choose wpa_cli_cmd_v vs hostapd_cli_cmd_v, we can reuse the code?
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.
Do you mean reuse the code of configuring network? I think the commands between softAP and fullAP are different.
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.
Yes.
I think the commands between softAP and fullAP are different.
Ok, let me check the differences in commands then, thanks.
Should we also extend
|
|
Currently, we are not using dynamic interface support on hostapd. We need time to do research on this. How about we keep it like this for now? Will do code enhancement in the future. |
But other drivers might still use it (Nordic driver uses it, but still not upstream). May be add a Kconfig dependency on |
Setting up AP with hostapd or wpa_supplicant is transparent for user so I think extending |
Agreed, in that case let's rename SAP ->AP and hide Soft/Full. |
The following west manifest projects have been modified in this Pull Request:
Note: This message is automatically posted and updated by the Manifest GitHub Action. |
Updated west.yml. |
Added new flag CONFIG_WIFI_NM_HOSTAPD_AP for hostapd support. Once this flag is enabled, softAP will be setup by hostapd. Both wpa_supplicant and hostapd uses same task and eloop. Included necessary hostapd files when compiling wifi samples if CONFIG_WIFI_NM_HOSTAPD_AP is enabled. Added hostapd support for all softAP command of L2 wifi shell commands. Signed-off-by: Hui Bai <[email protected]>
Enable CONFIG_IEEE80211AC flag for 11AC support when setting up AP with hostapd. Signed-off-by: Hui Bai <[email protected]>
Increase max count of CONFIG_WIFI_SHELL_MAX_AP_STA from 5 to 8. The SoftAP of NXP wifi chip can support up to 8 stations. Signed-off-by: Hui Bai <[email protected]>
Link mode shows unknown when legacy (A or bg only) device connects to APUT. Set the link mode to WIFI_2 when the host freq over 4000 and set link mode to WIFI_3 when the host freq over 2000. Signed-off-by: Hui Bai <[email protected]>
Increase wifi connect input parameters max count to 13. Previous count 7 is not enough if other security type is supported. When enabling softAP, the parameter cnx_params in cmd_wifi_ap_enable() is with static key word. Then the parameter will always save configurations of last time. Remove static keyword to eliminate effects of configs from last tim and do memset before setting up softAP. Signed-off-by: Hui Bai <[email protected]>
35c56bd
to
d69369e
Compare
@nxf58150 the hostap PR is now merged, please update manifest file and re-submit this one |
Update hostap repo to latest in west.yml Signed-off-by: Hui Bai <[email protected]>
b7256b5
d69369e
to
b7256b5
Compare
Updated manifest file. |
Hi @nxf58150! To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge. Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁 |
Added support of setting up AP with hostapd.
Once flag CONFIG_WIFI_NM_HOSTAPD_AP is enabled, softAP related commands in l2 wifi_shell.c will be handled by hostapd.
Increase max value of CONFIG_WIFI_SHELL_MAX_AP_STA from 5 to 8. The softAP of NXP wifi chip can support up to 8 stations.