summaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.(none)>2005-11-10 20:59:46 +0100
committerWolfgang Denk <wd@pollux.(none)>2005-11-10 20:59:46 +0100
commit3ada834e30a0742991209140049035c626ccea85 (patch)
tree3f5a1eb9f1b923884dd4bccd6eb92a3aabc30dff /net/net.c
parentea339205a94706d8b9170bbd89e8c1373df9a92f (diff)
downloadu-boot-3ada834e30a0742991209140049035c626ccea85.tar.gz
u-boot-3ada834e30a0742991209140049035c626ccea85.tar.bz2
u-boot-3ada834e30a0742991209140049035c626ccea85.zip
Add explanation for CDP checksum algorithm
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/net.c b/net/net.c
index 2986924824..37c5fb698e 100644
--- 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)