[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Detect default interface with the one that is the default gateway.



commit 34d402d34cc2a610538f8603809dd6753e48c783
Author: kudrom <kudrom@xxxxxxxxxx>
Date:   Sun Jul 20 21:27:13 2014 +0200

    Detect default interface with the one that is the default gateway.
---
 ooni/utils/txscapy.py |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py
index 340885a..54b4102 100644
--- a/ooni/utils/txscapy.py
+++ b/ooni/utils/txscapy.py
@@ -124,13 +124,9 @@ def getAddresses():
 
 def getDefaultIface():
     """ Return the default interface or raise IfaceError """
-    # XXX: currently broken on OpenVZ environments, because
-    # the routing table does not contain a default route
-    # Workaround: Set the default interface in ooniprobe.conf
-    networks = getNetworksFromRoutes()
-    for net in networks:
-        if net.is_private:
-            return net.iface
+    for route in read_routes():
+        if route[2] == '0.0.0.0' and route[3] != 'lo':
+            return route[3]
     raise IfaceError
 
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits