Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ba02e05 authored by Les Lee's avatar Les Lee
Browse files

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