Remove unused method set_ignore_non_default_routes
Also removing the corresponding unit test. Bug: None Change-Id: I585b88b794a78f5cdf5dd339a6d94788578cf2c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168403 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Xavier Lepaul <xalep@google.com> Cr-Commit-Position: refs/heads/master@{#30493}
This commit is contained in:
committed by
Commit Bot
parent
1ca6bdbbdb
commit
f1cf89b937
@ -472,10 +472,7 @@ Network* NetworkManagerBase::GetNetworkFromAddress(
|
|||||||
}
|
}
|
||||||
|
|
||||||
BasicNetworkManager::BasicNetworkManager()
|
BasicNetworkManager::BasicNetworkManager()
|
||||||
: thread_(nullptr),
|
: thread_(nullptr), sent_first_update_(false), start_count_(0) {}
|
||||||
sent_first_update_(false),
|
|
||||||
start_count_(0),
|
|
||||||
ignore_non_default_routes_(false) {}
|
|
||||||
|
|
||||||
BasicNetworkManager::~BasicNetworkManager() {}
|
BasicNetworkManager::~BasicNetworkManager() {}
|
||||||
|
|
||||||
@ -810,12 +807,6 @@ bool BasicNetworkManager::IsIgnoredNetwork(const Network& network) const {
|
|||||||
strncmp(network.name().c_str(), "vboxnet", 7) == 0) {
|
strncmp(network.name().c_str(), "vboxnet", 7) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#if defined(WEBRTC_LINUX)
|
|
||||||
// Make sure this is a default route, if we're ignoring non-defaults.
|
|
||||||
if (ignore_non_default_routes_ && !IsDefaultRoute(network.name())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#elif defined(WEBRTC_WIN)
|
#elif defined(WEBRTC_WIN)
|
||||||
// Ignore any HOST side vmware adapters with a description like:
|
// Ignore any HOST side vmware adapters with a description like:
|
||||||
// VMware Virtual Ethernet Adapter for VMnet1
|
// VMware Virtual Ethernet Adapter for VMnet1
|
||||||
|
|||||||
@ -238,14 +238,6 @@ class RTC_EXPORT BasicNetworkManager : public NetworkManagerBase,
|
|||||||
network_ignore_list_ = list;
|
network_ignore_list_ = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WEBRTC_LINUX)
|
|
||||||
// Sets the flag for ignoring non-default routes.
|
|
||||||
// Defaults to false.
|
|
||||||
void set_ignore_non_default_routes(bool value) {
|
|
||||||
ignore_non_default_routes_ = value;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if defined(WEBRTC_POSIX)
|
#if defined(WEBRTC_POSIX)
|
||||||
// Separated from CreateNetworks for tests.
|
// Separated from CreateNetworks for tests.
|
||||||
@ -286,7 +278,6 @@ class RTC_EXPORT BasicNetworkManager : public NetworkManagerBase,
|
|||||||
bool sent_first_update_;
|
bool sent_first_update_;
|
||||||
int start_count_;
|
int start_count_;
|
||||||
std::vector<std::string> network_ignore_list_;
|
std::vector<std::string> network_ignore_list_;
|
||||||
bool ignore_non_default_routes_;
|
|
||||||
std::unique_ptr<NetworkMonitorInterface> network_monitor_;
|
std::unique_ptr<NetworkMonitorInterface> network_monitor_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -900,51 +900,6 @@ TEST_F(NetworkTest, TestGetAdapterTypeFromNameMatching) {
|
|||||||
}
|
}
|
||||||
#endif // defined(WEBRTC_POSIX)
|
#endif // defined(WEBRTC_POSIX)
|
||||||
|
|
||||||
#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
|
|
||||||
// If you want to test non-default routes, you can do the following on a linux
|
|
||||||
// machine:
|
|
||||||
// 1) Load the dummy network driver:
|
|
||||||
// sudo modprobe dummy
|
|
||||||
// sudo ifconfig dummy0 127.0.0.1
|
|
||||||
// 2) Run this test and confirm the output says it found a dummy route (and
|
|
||||||
// passes).
|
|
||||||
// 3) When done:
|
|
||||||
// sudo rmmmod dummy
|
|
||||||
TEST_F(NetworkTest, TestIgnoreNonDefaultRoutes) {
|
|
||||||
BasicNetworkManager manager;
|
|
||||||
NetworkManager::NetworkList list;
|
|
||||||
list = GetNetworks(manager, false);
|
|
||||||
bool found_dummy = false;
|
|
||||||
RTC_LOG(LS_INFO) << "Looking for dummy network: ";
|
|
||||||
for (NetworkManager::NetworkList::iterator it = list.begin();
|
|
||||||
it != list.end(); ++it) {
|
|
||||||
RTC_LOG(LS_INFO) << " Network name: " << (*it)->name();
|
|
||||||
found_dummy |= (*it)->name().find("dummy0") != std::string::npos;
|
|
||||||
}
|
|
||||||
for (NetworkManager::NetworkList::iterator it = list.begin();
|
|
||||||
it != list.end(); ++it) {
|
|
||||||
delete (*it);
|
|
||||||
}
|
|
||||||
if (!found_dummy) {
|
|
||||||
RTC_LOG(LS_INFO) << "No dummy found, quitting.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
RTC_LOG(LS_INFO) << "Found dummy, running again while ignoring non-default "
|
|
||||||
"routes.";
|
|
||||||
manager.set_ignore_non_default_routes(true);
|
|
||||||
list = GetNetworks(manager, false);
|
|
||||||
for (NetworkManager::NetworkList::iterator it = list.begin();
|
|
||||||
it != list.end(); ++it) {
|
|
||||||
RTC_LOG(LS_INFO) << " Network name: " << (*it)->name();
|
|
||||||
EXPECT_TRUE((*it)->name().find("dummy0") == std::string::npos);
|
|
||||||
}
|
|
||||||
for (NetworkManager::NetworkList::iterator it = list.begin();
|
|
||||||
it != list.end(); ++it) {
|
|
||||||
delete (*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Test MergeNetworkList successfully combines all IPs for the same
|
// Test MergeNetworkList successfully combines all IPs for the same
|
||||||
// prefix/length into a single Network.
|
// prefix/length into a single Network.
|
||||||
TEST_F(NetworkTest, TestMergeNetworkList) {
|
TEST_F(NetworkTest, TestMergeNetworkList) {
|
||||||
|
|||||||
Reference in New Issue
Block a user