From 778267aa7590cf5ae8b30f0e77ba8ea4943530ca Mon Sep 17 00:00:00 2001 From: cody burkard <cody@onlab.us> Date: Wed, 1 Oct 2014 23:05:34 -0700 Subject: [PATCH] if there are no interfaces to ping, there are no packets sent --- mininet/net.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mininet/net.py b/mininet/net.py index fd0719b1..cd9b9885 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -562,8 +562,11 @@ def ping( self, hosts=None, timeout=None ): opts = '' if timeout: opts = '-W %s' % timeout - result = node.cmd( 'ping -c1 %s %s' % (opts, dest.IP()) ) - sent, received = self._parsePing( result ) + if dest.intfs: + result = node.cmd( 'ping -c1 %s %s' % (opts, dest.IP()) ) + sent, received = self._parsePing( result ) + else: + sent, received = 0, 0 packets += sent if received > sent: error( '*** Error: received too many packets' ) -- GitLab