diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2019-09-19 18:49:41 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2019-09-19 18:49:41 +0000 |
commit | b5fe0415f41f66797ad9d578db4880c2249dbcf7 (patch) | |
tree | 44733b187c4268f4e109774e6ef2b796adc42457 | |
parent | f46f1d03786635298fd1c87b8b36463f261ee951 (diff) |
Make checksum comparison more robust. 0xffff is the same as 0.
-rw-r--r-- | regress/sys/netinet/frag/frag_refrag.py | 2 | ||||
-rw-r--r-- | regress/sys/netinet6/frag6/frag6_refrag.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/regress/sys/netinet/frag/frag_refrag.py b/regress/sys/netinet/frag/frag_refrag.py index 2fdff6d0e09..9ac27897f8e 100644 --- a/regress/sys/netinet/frag/frag_refrag.py +++ b/regress/sys/netinet/frag/frag_refrag.py @@ -57,7 +57,7 @@ for a in ans: print "reply cksum=%#x" % (reply_cksum) # change request checksum incrementaly and check with reply diff_cksum=~(~reply_cksum+~(~request_cksum+~0x0800+0x0000)) - if diff_cksum != -1: + if diff_cksum & 0xffff != 0xffff and diff_cksum & 0xffff != 0: print "CHECKSUM ERROR diff cksum=%#x" % (diff_cksum) exit(1) exit(0) diff --git a/regress/sys/netinet6/frag6/frag6_refrag.py b/regress/sys/netinet6/frag6/frag6_refrag.py index 3ae38b00a2e..61f6dff4711 100644 --- a/regress/sys/netinet6/frag6/frag6_refrag.py +++ b/regress/sys/netinet6/frag6/frag6_refrag.py @@ -57,7 +57,7 @@ for a in ans: print "reply cksum=%#x" % (reply_cksum) # change request checksum incrementaly and check with reply diff_cksum=~(~reply_cksum+~(~request_cksum+~0x8000+0x8100)) - if diff_cksum != -1: + if diff_cksum & 0xffff != 0xffff and diff_cksum & 0xffff != 0: print "CHECKSUM ERROR diff cksum=%#x" % (diff_cksum) exit(1) exit(0) |