From 3ada834e30a0742991209140049035c626ccea85 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Thu, 10 Nov 2005 20:59:46 +0100 Subject: Add explanation for CDP checksum algorithm --- net/net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/net.c b/net/net.c index 298692482..37c5fb698 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) -- cgit v1.2.3