Update libjingle to CL 53398036.

Review URL: https://webrtc-codereview.appspot.com/2323004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4872 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/base/network.cc b/talk/base/network.cc
index d6367c3..cbfcb5f 100644
--- a/talk/base/network.cc
+++ b/talk/base/network.cc
@@ -32,10 +32,18 @@
 #include "talk/base/network.h"
 
 #ifdef 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(ANDROID) || defined(LINUX)
+#include <linux/if.h>
+#include <linux/route.h>
+#else
+#include <net/if.h>
+#endif
 #include <sys/socket.h>
 #include <sys/utsname.h>
 #include <sys/ioctl.h>
-#include <net/if.h>
 #include <unistd.h>
 #include <errno.h>
 #ifdef ANDROID
@@ -173,7 +181,8 @@
 }
 
 BasicNetworkManager::BasicNetworkManager()
-    : thread_(NULL), sent_first_update_(false), start_count_(0) {
+    : thread_(NULL), sent_first_update_(false), start_count_(0),
+      ignore_non_default_routes_(false) {
 }
 
 BasicNetworkManager::~BasicNetworkManager() {
@@ -397,14 +406,52 @@
 }
 #endif  // WIN32
 
-bool BasicNetworkManager::IsIgnoredNetwork(const Network& network) {
+#if defined(ANDROID) || defined(LINUX)
+bool IsDefaultRoute(const std::string& network_name) {
+  FileStream fs;
+  if (!fs.Open("/proc/net/route", "r", NULL)) {
+    LOG(LS_WARNING) << "Couldn't read /proc/net/route, skipping default "
+                    << "route check (assuming everything is a default route).";
+    return true;
+  } else {
+    std::string line;
+    while (fs.ReadLine(&line) == SR_SUCCESS) {
+      char iface_name[256];
+      unsigned int iface_ip, iface_gw, iface_mask, iface_flags;
+      if (sscanf(line.c_str(),
+                 "%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) {
+        return true;
+      }
+    }
+  }
+  return false;
+}
+#endif
+
+bool BasicNetworkManager::IsIgnoredNetwork(const Network& network) const {
+  // Ignore networks on the explicit ignore list.
+  for (size_t i = 0; i < network_ignore_list_.size(); ++i) {
+    if (network.name() == network_ignore_list_[i]) {
+      return true;
+    }
+  }
 #ifdef POSIX
-  // Ignore local networks (lo, lo0, etc)
-  // Also filter out VMware interfaces, typically named vmnet1 and vmnet8
+  // Filter out VMware interfaces, typically named vmnet1 and vmnet8
   if (strncmp(network.name().c_str(), "vmnet", 5) == 0 ||
       strncmp(network.name().c_str(), "vnic", 4) == 0) {
     return true;
   }
+#if defined(ANDROID) || defined(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(WIN32)
   // Ignore any HOST side vmware adapters with a description like:
   // VMware Virtual Ethernet Adapter for VMnet1