mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
Add explanation for CDP checksum algorithm
This commit is contained in:
parent
ea339205a9
commit
3ada834e30
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue