chiark
/
gitweb
/
~ianmdlvl
/
vinegar-ip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0ddc85f
)
Iteratively ones-c the checksum
author
ian
<ian>
Sun, 3 Mar 2002 14:03:34 +0000
(14:03 +0000)
committer
ian
<ian>
Sun, 3 Mar 2002 14:03:34 +0000
(14:03 +0000)
make-probes.tcl
patch
|
blob
|
history
diff --git
a/make-probes.tcl
b/make-probes.tcl
index a23edff8bf7d816b7011e26e365938c1489e023c..3466cdbc63ad8d865f6bdad6b240743b9cc9baaa 100755
(executable)
--- 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} {