[tor-commits] [ooni-probe/master] Detect default interface with active probing.
art at torproject.org
art at torproject.org
Tue Aug 5 10:33:36 UTC 2014
commit 1a661944c8fde17d37f4306a1da67229996e163e
Author: kudrom <kudrom at riseup.net>
Date: Sun Jul 20 21:43:25 2014 +0200
Detect default interface with active probing.
---
Vagrantfile | 2 +-
ooni/utils/txscapy.py | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Vagrantfile b/Vagrantfile
index 419f0c6..74fe50f 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -10,7 +10,7 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/ooni"
# Place the ooni-backend source code in ../ooni-backend to sync it with the vagrant instance
- # config.vm.synced_folder "../ooni-backend", "/oonib"
+ config.vm.synced_folder "../ooni-backend", "/oonib"
end
diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py
index 54b4102..1cd4d46 100644
--- a/ooni/utils/txscapy.py
+++ b/ooni/utils/txscapy.py
@@ -10,7 +10,7 @@ from twisted.internet import defer, abstract
from scapy.config import conf
from scapy.supersocket import L3RawSocket
-from scapy.all import RandShort, IP, IPerror, ICMP, ICMPerror, TCP, TCPerror, UDP, UDPerror, read_routes
+from scapy.all import RandShort, IP, IPerror, ICMP, ICMPerror, TCP, TCPerror, UDP, UDPerror
from ooni.utils import log
from ooni.settings import config
@@ -124,9 +124,9 @@ def getAddresses():
def getDefaultIface():
""" Return the default interface or raise IfaceError """
- for route in read_routes():
- if route[2] == '0.0.0.0' and route[3] != 'lo':
- return route[3]
+ iface = conf.route.route('0.0.0.0', verbose=0)[0]
+ if len(iface) > 0:
+ return iface
raise IfaceError
More information about the tor-commits
mailing list