commit 768bdbdc3dfe9f775981eb6320de325b1b3a13ad Author: Arturo Filastò arturo@filasto.net Date: Wed Nov 7 20:01:31 2012 +0100
Make the relevant changes to the ping test by isis * It appears to be broken in multiple points, so I just made the changes that are relevant to the test template changes. --- nettests/bridge_reachability/echo.py | 35 +++------------------------------ 1 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/nettests/bridge_reachability/echo.py b/nettests/bridge_reachability/echo.py index 0c20a3f..0440f2c 100644 --- a/nettests/bridge_reachability/echo.py +++ b/nettests/bridge_reachability/echo.py @@ -28,20 +28,11 @@ try: from scapy.all import sr1, IP, ICMP ## XXX v4/v6? from ooni.lib import txscapy from ooni.lib.txscapy import txsr, txsend - from ooni.templates.scapyt import ScapyTest + from ooni.templates.scapyt import BaseScapyTest except: log.msg("This test requires scapy, see www.secdev.org/projects/scapy")
-## xxx TODO: move these to a utility function for determining OSes -LINUX=sys.platform.startswith("linux") -OPENBSD=sys.platform.startswith("openbsd") -FREEBSD=sys.platform.startswith("freebsd") -NETBSD=sys.platform.startswith("netbsd") -DARWIN=sys.platform.startswith("darwin") -SOLARIS=sys.platform.startswith("sunos") -WINDOWS=sys.platform.startswith("win32") - -class EchoTest(ScapyTest): +class EchoTest(BaseScapyTest): """ xxx fill me in """ @@ -172,24 +163,6 @@ class EchoTest(ScapyTest): else: raise IfaceError("Could not find a working network interface.")
- def buildPackets(self): - log.debug("self.input is %s" % self.input) - log.debug("self.hosts is %s" % self.hosts) - for addr in self.input: - packet = IP(dst=self.input)/ICMP() - self.request.append(packet) - return packet - def test_icmp(self): - if self.recieve: - self.buildPackets() - all = [] - for packet in self.request: - d = self.sendReceivePackets(packets=packet) - all.append(d) - self.response.update({packet: d}) - d_list = defer.DeferredList(all) - return d_list - else: - d = self.sendPackets() - return d + self.sr(IP(dst=self.input)/ICMP()) +