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

This commit is contained in:
Les Lee
2020-11-17 14:12:41 +00:00
committed by Android (Google) Code Review
2 changed files with 40 additions and 0 deletions

View File

@@ -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

View File

@@ -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();