[PATCH 2/5] TestPktCounter: fix error when dport option is None

olichtne at redhat.com olichtne at redhat.com
Fri Feb 8 10:09:46 UTC 2013


From: Ondrej Lichtner <olichtne at redhat.com>

The dport option is not mandatory, but when not specified the
constructed iptables command would contain the string "None" where the
dport value would be. This commnit fixes that.

Signed-off-by: Ondrej Lichtner <olichtne at redhat.com>
---
 test_modules/TestPktCounter.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test_modules/TestPktCounter.py b/test_modules/TestPktCounter.py
index 727d472..7eec92c 100644
--- a/test_modules/TestPktCounter.py
+++ b/test_modules/TestPktCounter.py
@@ -23,7 +23,10 @@ def get_pkt_count(indev_name, dport, proto):
         p_indev_name = "\*"
     if proto:
         p_proto = proto
-        p_protodport = "%s dpt:%s" % (proto, dport)
+        if dport:
+            p_protodport = "%s dpt:%s" % (proto, dport)
+        else:
+            p_protodport = ""
     else:
         p_proto = "all"
         p_protodport = ""
-- 
1.7.11.7



More information about the LNST-developers mailing list