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

Commit edaa1ae1 authored by Les Lee's avatar Les Lee Committed by Android (Google) Code Review
Browse files

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

parents 50e7b1a3 c92aa85a
Loading
Loading
Loading
Loading
+30 −0
Original line number 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) {
    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 implementation
}  // namespace V1_5
+10 −0
Original line number Diff line number Diff line
@@ -59,6 +59,16 @@ class WifiIfaceUtil {
    virtual bool setUpState(const std::string& iface_name, bool request_up);
    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:
    std::array<uint8_t, 6> createRandomMacAddress();