projects
/
l2tpns.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
661da3e
)
fix checksum
author
Brendan O'Dea
<bod@optus.net>
Tue, 7 Jun 2005 05:08:16 +0000
(
05:08
+0000)
committer
Brendan O'Dea
<bod@optus.net>
Tue, 7 Jun 2005 05:08:16 +0000
(
05:08
+0000)
test/generateload.c
patch
|
blob
|
history
diff --git
a/test/generateload.c
b/test/generateload.c
index
5119920
..
a58d5f2
100644
(file)
--- a/
test/generateload.c
+++ b/
test/generateload.c
@@
-645,14
+645,14
@@
__u16 checksum(unsigned char *addr, int count)
for (; count > 1; count -= 2)
{
for (; count > 1; count -= 2)
{
- sum += ntohs(*(u
32
*)addr);
+ sum += ntohs(*(u
16
*)addr);
addr += 2;
}
addr += 2;
}
- if (count >
1
) sum += *(unsigned char *)addr;
+ if (count >
0
) sum += *(unsigned char *)addr;
// take only 16 bits out of the 32 bit sum and add up the carries
// take only 16 bits out of the 32 bit sum and add up the carries
-
while
(sum >> 16)
+
if
(sum >> 16)
sum = (sum & 0xFFFF) + (sum >> 16);
// one's complement the result
sum = (sum & 0xFFFF) + (sum >> 16);
// one's complement the result