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

commit 34d402d34cc2a610538f8603809dd6753e48c783 Author: kudrom <kudrom@riseup.net> 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
participants (1)
-
art@torproject.org