commit ba88ae7622f86a9ebe8a4af8d1825daf3ff78aab Author: Arturo Filastò art@fuffa.org Date: Sun Aug 10 20:01:47 2014 +0200
Fix a bug that lead ooniprobe to require root when set_pcap was not used. --- ooni/director.py | 5 ++++- ooni/oonicli.py | 2 +- ooni/templates/scapyt.py | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ooni/director.py b/ooni/director.py index d81010a..43269cc 100644 --- a/ooni/director.py +++ b/ooni/director.py @@ -265,7 +265,10 @@ class Director(object): """ Start sniffing with Scapy. Exits if required privileges (root) are not available. """ - from ooni.utils.txscapy import ScapySniffer + from ooni.utils.txscapy import ScapySniffer, ScapyFactory + + if config.scapyFactory is None: + config.scapyFactory = ScapyFactory(config.advanced.interface)
if not config.reports.pcap: prefix = 'report' diff --git a/ooni/oonicli.py b/ooni/oonicli.py index 2320dec..eef3112 100644 --- a/ooni/oonicli.py +++ b/ooni/oonicli.py @@ -125,10 +125,10 @@ def runWithDirector(logging=True, start_tor=True, check_incoherences=True): if logging: log.start(global_options['logfile'])
- config.scapyFactory = ScapyFactory(config.advanced.interface) if config.privacy.includepcap: try: checkForRoot() + config.scapyFactory = ScapyFactory(config.advanced.interface) except errors.InsufficientPrivileges: log.err("Insufficient Privileges to capture packets." " See ooniprobe.conf privacy.includepcap") diff --git a/ooni/templates/scapyt.py b/ooni/templates/scapyt.py index d99ea3f..c6dedd7 100644 --- a/ooni/templates/scapyt.py +++ b/ooni/templates/scapyt.py @@ -41,6 +41,10 @@ class BaseScapyTest(NetTestCase): def _setUp(self): super(BaseScapyTest, self)._setUp()
+ if config.scapyFactory is None: + log.debug("Scapy factory not set, registering it.") + config.scapyFactory = ScapyFactory(config.advanced.interface) + self.report['answer_flags'] = [] if self.localOptions['ipsrc']: config.checkIPsrc = 0
tor-commits@lists.torproject.org