wifi: Two AP instances use the same interface name

When device supports two AP interfaces (i.e. {AP, 2}. not a bridged case),
the AP interface name might be observed from the getPredefinedApIfaceNames.
Check if the interface name is used or not when creating a new interface.

Bug: 244387442
Test: Manual test by commands
adb shell cmd wifi start-softap tetheredAp open -b 2
adb shell cmd wifi start-lohs lohs open -b 5

Change-Id: I59b3796895ee09452a9650c4dc138ad9e143282e
This commit is contained in:
Les Lee
2022-09-07 13:44:06 +08:00
parent b158823325
commit 3ba02e052b

View File

@@ -1926,9 +1926,10 @@ uint32_t WifiChip::startIdxOfApIface() {
// concurrent STA and not dual AP, else start with idx 0.
std::string WifiChip::allocateApIfaceName() {
// Check if we have a dedicated iface for AP.
std::vector<std::string> ifnames = getPredefinedApIfaceNames(false);
if (!ifnames.empty()) {
return ifnames[0];
std::vector<std::string> ifnames = getPredefinedApIfaceNames(true);
for (auto const& ifname : ifnames) {
if (findUsingName(ap_ifaces_, ifname)) continue;
return ifname;
}
return allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface());
}