From 02aa73e95e6c1c13994f278aee20e40cb31784c7 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 3 Mar 2002 14:03:34 +0000 Subject: [PATCH] Iteratively ones-c the checksum --- make-probes.tcl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/make-probes.tcl b/make-probes.tcl index a23edff..3466cdb 100755 --- a/make-probes.tcl +++ b/make-probes.tcl @@ -49,7 +49,10 @@ proc packet-csum-ip {packet} { set cs [expr "\$cs + 0x$this"] debug 7 [format "0x%s 0x%08x" $this $cs] } - return [expr {(($cs & 0xffff) + (($cs >> 16) & 0xffff)) ^ 0xffff}] + while {$cs > 0xffff} { + set cs [expr {($cs & 0xffff) + (($cs >> 16) & 0xffff)}] + } + return [expr {$cs ^ 0xffff}] } proc packet-fromstring {s} { -- 2.30.2