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

Commit c92aa85a authored by lesl's avatar lesl
Browse files

wiif: Add AP bridge operations support (AP+AP Part 2)

AP+AP Part 2 includes:
1. Support bridge in libwifi_system_iface
2. WifiHal
a. createApIface_1_5 (Support create bridge mode AP)
b. removeApIface_1_5 (Support remove one of the instance in bridge)
3. Framework:
Create bridge AP when multi-bands configured.

Bug: 162686273
Test: Manual Test (SAP enable normally)
Change-Id: I518417add566ce4780a7e2e83af14460e6e8a217
parent f4c82a84
Loading
Loading
Loading
Loading
+30 −0
Original line number Original line Diff line number Diff line
@@ -127,6 +127,36 @@ bool WifiIfaceUtil::setUpState(const std::string& iface_name, bool request_up) {
unsigned WifiIfaceUtil::ifNameToIndex(const std::string& iface_name) {
unsigned WifiIfaceUtil::ifNameToIndex(const std::string& iface_name) {
    return if_nametoindex(iface_name.c_str());
    return if_nametoindex(iface_name.c_str());
}
}

bool WifiIfaceUtil::createBridge(const std::string& br_name) {
    if (!iface_tool_.lock()->createBridge(br_name)) {
        return false;
    }

    if (!iface_tool_.lock()->SetUpState(br_name.c_str(), true)) {
        LOG(ERROR) << "bridge SetUpState(true) failed.";
    }
    return true;
}

bool WifiIfaceUtil::deleteBridge(const std::string& br_name) {
    if (!iface_tool_.lock()->SetUpState(br_name.c_str(), false)) {
        LOG(INFO) << "SetUpState(false) failed for bridge=" << br_name.c_str();
    }

    return iface_tool_.lock()->deleteBridge(br_name);
}

bool WifiIfaceUtil::addIfaceToBridge(const std::string& br_name,
                                     const std::string& if_name) {
    return iface_tool_.lock()->addIfaceToBridge(br_name, if_name);
}

bool WifiIfaceUtil::removeIfaceFromBridge(const std::string& br_name,
                                          const std::string& if_name) {
    return iface_tool_.lock()->removeIfaceFromBridge(br_name, if_name);
}

}  // namespace iface_util
}  // namespace iface_util
}  // namespace implementation
}  // namespace implementation
}  // namespace V1_5
}  // namespace V1_5
+10 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,16 @@ class WifiIfaceUtil {
    virtual bool setUpState(const std::string& iface_name, bool request_up);
    virtual bool setUpState(const std::string& iface_name, bool request_up);
    virtual unsigned ifNameToIndex(const std::string& iface_name);
    virtual unsigned ifNameToIndex(const std::string& iface_name);


    virtual bool createBridge(const std::string& br_name);

    virtual bool deleteBridge(const std::string& br_name);

    virtual bool addIfaceToBridge(const std::string& br_name,
                                  const std::string& if_name);

    virtual bool removeIfaceFromBridge(const std::string& br_name,
                                       const std::string& if_name);

   private:
   private:
    std::array<uint8_t, 6> createRandomMacAddress();
    std::array<uint8_t, 6> createRandomMacAddress();