wifi: Add 11BE feature support for hostapd
1. Add 11BE feature support for hostapd
2. Make build flag alignment for link removal function to fix link error
3. fill mld MAC address for ApInfoCallback
Bug: 362355566
Test: TH & Manual test with 11BE flag enabled.
Change-Id: Ia217011fe699e1c855d9272e06ee1440d959d0b7
diff --git a/hostapd/Android.bp b/hostapd/Android.bp
index 4f76a30..5b08d3e 100644
--- a/hostapd/Android.bp
+++ b/hostapd/Android.bp
@@ -451,6 +451,9 @@
}) + select(soong_config_variable("wpa_supplicant_8", "hostapd_11ax"), {
true: ["-DCONFIG_IEEE80211AX"],
default: [],
+ }) + select(soong_config_variable("wpa_supplicant_8", "hostapd_11be"), {
+ true: ["-DCONFIG_IEEE80211BE"],
+ default: [],
}) + select(soong_config_variable("wpa_supplicant_8", "board_hostapd_config_80211w_mfp_optional"), {
true: ["-DENABLE_HOSTAPD_CONFIG_80211W_MFP_OPTIONAL"],
default: [],
@@ -602,6 +605,10 @@
] + select(soong_config_variable("wpa_supplicant_8", "hostapd_11ax"), {
true: ["src/ap/ieee802_11_he.c"],
default: [],
+ }) +
+ select(soong_config_variable("wpa_supplicant_8", "hostapd_11be"), {
+ true: ["src/ap/ieee802_11_eht.c"],
+ default: [],
}),
defaults: [
"hostapd_driver_srcs_default",
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index 12d0d9e..0aab000 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -138,6 +138,12 @@
int32_t aidl_client_version = 0;
int32_t aidl_service_version = 0;
+inline std::array<uint8_t, ETH_ALEN> macAddrToArray(const uint8_t* mac_addr) {
+ std::array<uint8_t, ETH_ALEN> arr;
+ std::copy(mac_addr, mac_addr + ETH_ALEN, std::begin(arr));
+ return arr;
+}
+
/**
* Check that the AIDL service is running at least the expected version.
* Use to avoid the case where the AIDL interface version
@@ -1279,7 +1285,7 @@
return hapd;
}
}
-#endif
+#endif /* CONFIG_IEEE80211BE */
return NULL;
}
@@ -1374,7 +1380,7 @@
&& strlen(iface_hapd->conf->bridge) == 0) {
instanceName = std::to_string(iface_hapd->mld_link_id);
}
-#endif
+#endif /* CONFIG_IEEE80211BE */
for (const auto& callback : callbacks_) {
auto status = callback->onFailure(
strlen(iface_hapd->conf->bridge) > 0 ?
@@ -1403,7 +1409,7 @@
&& strlen(iface_hapd->conf->bridge) == 0) {
instanceName = std::to_string(iface_hapd->mld_link_id);
}
-#endif
+#endif /* CONFIG_IEEE80211BE */
info.apIfaceInstance = instanceName;
info.clientAddress.assign(mac_addr, mac_addr + ETH_ALEN);
info.isConnected = authorized;
@@ -1439,7 +1445,7 @@
if (iface_hapd->conf->mld_ap && strlen(iface_hapd->conf->bridge) == 0) {
instanceName = std::to_string(iface_hapd->mld_link_id);
}
-#endif
+#endif /* CONFIG_IEEE80211BE */
ApInfo info;
info.ifaceName = strlen(iface_hapd->conf->bridge) > 0 ?
iface_hapd->conf->bridge : iface_hapd->conf->iface,
@@ -1449,6 +1455,11 @@
info.generation = getGeneration(iface_hapd->iface->current_mode);
info.apIfaceInstanceMacAddress.assign(iface_hapd->own_addr,
iface_hapd->own_addr + ETH_ALEN);
+#ifdef CONFIG_IEEE80211BE
+ if (iface_hapd->conf->mld_ap) {
+ info.mldMacAddress = macAddrToArray(iface_hapd->mld->mld_addr);
+ }
+#endif /* CONFIG_IEEE80211BE */
for (const auto &callback : callbacks_) {
auto status = callback->onApInstanceInfoChanged(info);
if (!status.isOk()) {
@@ -1464,7 +1475,7 @@
if (iface_hapd->conf->mld_ap && strlen(iface_hapd->conf->bridge) == 0) {
instanceName = std::to_string(iface_hapd->mld_link_id);
}
-#endif
+#endif /* CONFIG_IEEE80211BE */
// Invoke the failure callback on all registered clients.
for (const auto& callback : callbacks_) {
auto status =
@@ -1589,6 +1600,7 @@
::ndk::ScopedAStatus Hostapd::removeLinkFromMultipleLinkBridgedApIfaceInternal(
const std::string& iface_name, const std::string& linkIdentity)
{
+#ifdef CONFIG_IEEE80211BE
if (!hostapd_get_iface(interfaces_, iface_name.c_str())) {
wpa_printf(MSG_ERROR, "Interface %s doesn't exist", iface_name.c_str());
return createStatus(HostapdStatusCode::FAILURE_IFACE_UNKNOWN);
@@ -1596,11 +1608,18 @@
struct hostapd_data* iface_hapd =
hostapd_get_iface_by_link_id(interfaces_, (size_t) linkIdentity.c_str());
if (iface_hapd) {
+// Currently, hostapd_link_remove is still under CONFIG_TESTING_OPTIONS.
+// TODO: b/340821197 - Make sure to take out the hostapd_link_remove() and other related code
+// out of CONFIG_TESTING_OPTIONS.
+#ifdef CONFIG_TESTING_OPTIONS
if (0 == hostapd_link_remove(iface_hapd, 1)) {
return ndk::ScopedAStatus::ok();
}
+#endif /* CONFIG_TESTING_OPTIONS */
}
return createStatus(HostapdStatusCode::FAILURE_ARGS_INVALID);
+#endif /* CONFIG_IEEE80211BE */
+ return createStatus(HostapdStatusCode::FAILURE_UNKNOWN);
}
} // namespace hostapd