diff options
| author | waynema <waynema@google.com> | 2021-11-24 17:08:25 +0800 |
|---|---|---|
| committer | waynema <waynema@google.com> | 2021-12-08 15:11:32 +0800 |
| commit | 5851b0354406e28993ee18ff37364b70ec474a84 (patch) | |
| tree | d76ffafe913fbadad1a0ae1c8d16e16f9ba82594 /server/InterfaceController.cpp | |
| parent | 65f0455e80a0c0c948d36b42f4b196a6ec23842f (diff) | |
[NETD-TC#9] Clean up dependency between InterfaceController and
TrafficController.
Test: m; flash; boot
Test: atest InterfaceControllerTest TrafficControllerTest
Test: atest XfrmControllerTest netd_integration_test
Change-Id: I0dd7e2a94743ac03235db35f4e40338c19fd5403
Diffstat (limited to 'server/InterfaceController.cpp')
| -rw-r--r-- | server/InterfaceController.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/server/InterfaceController.cpp b/server/InterfaceController.cpp index 7504fb91..2ce50dfd 100644 --- a/server/InterfaceController.cpp +++ b/server/InterfaceController.cpp @@ -416,37 +416,6 @@ void InterfaceController::setIPv6OptimisticMode(const char *value) { setOnAllInterfaces(ipv6_proc_path, "use_optimistic", value); } -StatusOr<std::vector<std::string>> InterfaceController::getIfaceNames() { - std::vector<std::string> ifaceNames; - DIR* d; - struct dirent* de; - - if (!(d = opendir("/sys/class/net"))) { - return statusFromErrno(errno, "Cannot open iface directory"); - } - while ((de = readdir(d))) { - if ((de->d_type != DT_DIR) && (de->d_type != DT_LNK)) continue; - if (de->d_name[0] == '.') continue; - ifaceNames.push_back(std::string(de->d_name)); - } - closedir(d); - return ifaceNames; -} - -StatusOr<std::map<std::string, uint32_t>> InterfaceController::getIfaceList() { - std::map<std::string, uint32_t> ifacePairs; - - ASSIGN_OR_RETURN(auto ifaceNames, getIfaceNames()); - - for (const auto& name : ifaceNames) { - uint32_t ifaceIndex = if_nametoindex(name.c_str()); - if (ifaceIndex) { - ifacePairs.insert(std::pair<std::string, uint32_t>(name, ifaceIndex)); - } - } - return ifacePairs; -} - namespace { std::string hwAddrToStr(unsigned char* hwaddr) { |
