wifi: Handle removeAccessPoint for bridged AP case
Bug: 162686273
Test: Manual Test, check HostapdHal log to make sure removeAccessPoint
succeed
Change-Id: Ib9a01da67e6f7aca1138f68496adf51b6f04cd81
diff --git a/hostapd/hidl/1.3/hostapd.cpp b/hostapd/hidl/1.3/hostapd.cpp
index 0d01da3..3b2e4c9 100644
--- a/hostapd/hidl/1.3/hostapd.cpp
+++ b/hostapd/hidl/1.3/hostapd.cpp
@@ -938,13 +938,31 @@
V1_0::HostapdStatus Hostapd::removeAccessPointInternal(const std::string& iface_name)
{
- std::vector<char> remove_iface_param_vec(
- iface_name.begin(), iface_name.end() + 1);
- if (hostapd_remove_iface(interfaces_, remove_iface_param_vec.data()) <
- 0) {
- wpa_printf(
- MSG_ERROR, "Removing interface %s failed",
- iface_name.c_str());
+ // interfaces to be removed
+ std::vector<std::string> interfaces;
+ bool is_error = false;
+
+ const auto it = br_interfaces_.find(iface_name);
+ if (it != br_interfaces_.end()) {
+ // In case bridge, remove managed interfaces
+ interfaces = it->second;
+ br_interfaces_.erase(iface_name);
+ } else {
+ // else remove current interface
+ interfaces.push_back(iface_name);
+ }
+
+ for (auto& iface : interfaces) {
+ std::vector<char> remove_iface_param_vec(
+ iface.begin(), iface.end() + 1);
+ if (hostapd_remove_iface(interfaces_, remove_iface_param_vec.data()) <
+ 0) {
+ wpa_printf(MSG_INFO, "Remove interface %s failed",
+ iface.c_str());
+ is_error = true;
+ }
+ }
+ if (is_error) {
return {V1_0::HostapdStatusCode::FAILURE_UNKNOWN, ""};
}
return {V1_0::HostapdStatusCode::SUCCESS, ""};