Removing dead code
This is a follow-up of
https://webrtc-review.googlesource.com/c/src/+/168403, removing code
that was only used from the now-deleted code.
The if.h include is still needed for some IFF_xxx flags, but can be
simplified to use the POSIX version as route.h isn't needed anymore.
Bug: None
Change-Id: Ic2def8b54a9d3aa1a0e3eabf6f1a837a0cf8a5a8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168483
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Xavier Lepaul <xalep@google.com>
Cr-Commit-Position: refs/heads/master@{#30523}
diff --git a/rtc_base/network.cc b/rtc_base/network.cc
index 58764c7..4906184 100644
--- a/rtc_base/network.cc
+++ b/rtc_base/network.cc
@@ -11,15 +11,7 @@
#include "rtc_base/network.h"
#if defined(WEBRTC_POSIX)
-// linux/if.h can't be included at the same time as the posix sys/if.h, and
-// it's transitively required by linux/route.h, so include that version on
-// linux instead of the standard posix one.
-#if defined(WEBRTC_LINUX)
-#include <linux/if.h>
-#include <linux/route.h>
-#elif !defined(__native_client__)
#include <net/if.h>
-#endif
#endif // WEBRTC_POSIX
#if defined(WEBRTC_WIN)
@@ -30,8 +22,6 @@
#include "rtc_base/ifaddrs_converter.h"
#endif
-#include <stdio.h>
-
#include <memory>
#include "absl/algorithm/container.h"
@@ -764,33 +754,6 @@
}
#endif // WEBRTC_WIN
-#if defined(WEBRTC_LINUX)
-bool IsDefaultRoute(const std::string& network_name) {
- FILE* f = fopen("/proc/net/route", "r");
- if (!f) {
- RTC_LOG(LS_WARNING)
- << "Couldn't read /proc/net/route, skipping default "
- "route check (assuming everything is a default route).";
- return true;
- }
- bool is_default_route = false;
- char line[500];
- while (fgets(line, sizeof(line), f)) {
- char iface_name[256];
- unsigned int iface_ip, iface_gw, iface_mask, iface_flags;
- if (sscanf(line, "%255s %8X %8X %4X %*d %*u %*d %8X", iface_name, &iface_ip,
- &iface_gw, &iface_flags, &iface_mask) == 5 &&
- network_name == iface_name && iface_mask == 0 &&
- (iface_flags & (RTF_UP | RTF_HOST)) == RTF_UP) {
- is_default_route = true;
- break;
- }
- }
- fclose(f);
- return is_default_route;
-}
-#endif
-
bool BasicNetworkManager::IsIgnoredNetwork(const Network& network) const {
// Ignore networks on the explicit ignore list.
for (const std::string& ignored_name : network_ignore_list_) {