Lenin Lakshminarayanan -X (lelakshm - HCL at Cisco) writes:
> Thanks for your inputs. I had the same doubt but this is the well tested
> cksum code. I didn't want to mess it up and used the tcp6_cksum. Here's
> the checksum code.

I think the code calling this function must be flawed.

>         sp = (const u_int16_t *)tp;
> 
>         for (i = 0; i < (len & ~1); i += 2)
>                 sum += *sp++;

This doesn't seem to account for the existing TCP checksum in the
packet.

>         if (len & 1)
>                 sum += htons((*(const u_int8_t *)sp) << 8);

The version in RFC 1071 doesn't do htons here.  Is this right?

Are you sure the buffer being used is contiguous (for the _entire_
packet length -- meaning it's in a single dblk_t) and aligned?

> One thing that bewilders me is that, the checksum is not always wrong.
> For instance, if I login to the device and provide my credentials
> leisurely it works. It doesn't work when I provide the credentials in a
> hurry. Pretty strange but that's the issue.

The packets are different lengths in those cases.

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to