From: Wolfgang Denk Date: Thu, 10 Nov 2005 19:59:46 +0000 (+0100) Subject: Add explanation for CDP checksum algorithm X-Git-Tag: LABEL_2006_03_12_0025~73 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3ada834e30a0742991209140049035c626ccea85;p=u-boot Add explanation for CDP checksum algorithm --- 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)