aboutsummaryrefslogtreecommitdiffstats
path: root/resources/traffic_scripts/icmpv6_echo_req_resp.py
diff options
context:
space:
mode:
authorJuraj Sloboda <jsloboda@cisco.com>2016-02-25 16:03:51 +0100
committerGerrit Code Review <gerrit@fd.io>2016-02-27 09:07:56 +0000
commitbc4d98a34af3f26a1c9264758186189f15513a7e (patch)
tree40be5b38e26dc98eb06fef41eced0b07a9f74251 /resources/traffic_scripts/icmpv6_echo_req_resp.py
parent994580369f92db56c79bab13c75180c9f38b9187 (diff)
Fix checksum comparison in traffic scripts
Change-Id: Ibeff7c790ed4aba8b3a0534681912d0d5b826dbb Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'resources/traffic_scripts/icmpv6_echo_req_resp.py')
-rwxr-xr-xresources/traffic_scripts/icmpv6_echo_req_resp.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/resources/traffic_scripts/icmpv6_echo_req_resp.py b/resources/traffic_scripts/icmpv6_echo_req_resp.py
index 582114cb28..c2cc4d20a0 100755
--- a/resources/traffic_scripts/icmpv6_echo_req_resp.py
+++ b/resources/traffic_scripts/icmpv6_echo_req_resp.py
@@ -19,7 +19,8 @@
import sys
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
-from resources.libraries.python.PacketVerifier import RxQueue, TxQueue
+from resources.libraries.python.PacketVerifier import RxQueue, TxQueue,\
+ checksum_equal
from resources.libraries.python.TrafficScriptArg import TrafficScriptArg
from scapy.layers.inet6 import IPv6, ICMPv6ND_NA, ICMPv6NDOptDstLLAddr
from scapy.layers.inet6 import ICMPv6EchoRequest, ICMPv6EchoReply
@@ -104,7 +105,7 @@ def main():
cksum = icmpv6.cksum
del icmpv6.cksum
tmp = ICMPv6EchoRequest(str(icmpv6))
- if tmp.cksum != cksum:
+ if not checksum_equal(tmp.cksum, cksum):
raise RuntimeError(
'Invalid checksum {0} should be {1}'.format(cksum, tmp.cksum))
@@ -149,7 +150,7 @@ def main():
cksum = icmpv6.cksum
del icmpv6.cksum
tmp = ICMPv6EchoReply(str(icmpv6))
- if tmp.cksum != cksum:
+ if not checksum_equal(tmp.cksum, cksum):
raise RuntimeError(
'Invalid checksum {0} should be {1}'.format(cksum, tmp.cksum))