From: Wolfgang Denk Date: Thu, 10 Nov 2005 19:59:46 +0000 (+0100) Subject: Add explanation for CDP checksum algorithm X-Git-Tag: v2008.10-rc1~1330 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ada834e30a0742991209140049035c626ccea85;p=platform%2Fkernel%2Fu-boot.git Add explanation for CDP checksum algorithm --- diff --git a/net/net.c b/net/net.c index 2986924..37c5fb6 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)