projects
/
oweals
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ea33920
)
Add explanation for CDP checksum algorithm
author
Wolfgang Denk
<wd@pollux.(none)>
Thu, 10 Nov 2005 19:59:46 +0000
(20:59 +0100)
committer
Wolfgang Denk
<wd@pollux.(none)>
Thu, 10 Nov 2005 19:59:46 +0000
(20:59 +0100)
net/net.c
patch
|
blob
|
history
diff --git
a/net/net.c
b/net/net.c
index 2986924824b1a166b2f210ba6a4444ace9f30758..37c5fb698e1b18ef1a4bc925a3685b1fe9dbddb1 100644
(file)
--- a/
net/net.c
+++ b/
net/net.c
@@
-829,7
+829,10
@@
static ushort CDP_compute_csum(const uchar *buff, ushort len)
}
if (len) {
leftover = (signed short)(*(const signed char *)buff);
- /* * XXX CISCO SUCKS big time! (and blows too) */
+ /* CISCO SUCKS big time! (and blows too):
+ * CDP uses the IP checksum algorithm with a twist;
+ * for the last byte it *sign* extends and sums.
+ */
result = (result & 0xffff0000) | ((result + leftover) & 0x0000ffff);
}
while (result >> 16)