/* ns_cksum.c 1.1 86/01/23 */
* ns_cksum.c - Xerox Internet Datagram protocol checksum
* Perform (slowly) the Xerox Internet checksum algorithm on a
* chain of mbufs. This means we add all the 16-bits words,
* shifting the sum after each 16-bit add. Ones-complement
* arithmetic is required, so we fold the carry bits after
* each 16-bit add as well.
* If the result is the *no-checksum* value 0xffff, return zero instead.
* Chris Torek <chris@maryland>
* James O'Toole <james@maryland>
printf("ns_cksum: odd length\n");
if ((shift
= 8 - shift
) != 0) {
cksum
= (cksum
& 0xffff) + (cksum
>> 16);
printf("ns_cksum: out of data\n");
return (cksum
== 0xffff ? 0 : cksum
);