James,
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.
static int tcp6_cksum(const struct ip6_hdr *ip6, const struct tcphdr
*tp,
u_int len)
{
size_t i;
register const u_int16_t *sp;
u_int32_t sum;
union {
struct {
struct in6_addr ph_src;
struct in6_addr ph_dst;
u_int32_t ph_len;
u_int8_t ph_zero[3];
u_int8_t ph_nxt;
} ph;
u_int16_t pa[20];
} phu;
/* pseudo-header */
bzero((char *)&phu, sizeof(phu));
phu.ph.ph_src = ip6->ip6_src;
phu.ph.ph_dst = ip6->ip6_dst;
phu.ph.ph_len = htonl(len);
phu.ph.ph_nxt = IPPROTO_TCP;
sum = 0;
for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)
sum += phu.pa[i];
sp = (const u_int16_t *)tp;
for (i = 0; i < (len & ~1); i += 2)
sum += *sp++;
if (len & 1)
sum += htons((*(const u_int8_t *)sp) << 8);
while (sum > 0xffff)
sum = (sum & 0xffff) + (sum >> 16);
sum = ~sum & 0xffff;
return (sum);
}
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.
Thanks,
Lenin
-----Original Message-----
From: James Carlson [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 12, 2007 7:04 PM
To: Lenin Lakshminarayanan -X (lelakshm - HCL at Cisco)
Cc: [email protected]
Subject: Re: [networking-discuss] Telnet hangs during authentication !
Lenin writes:
> > 2001:410:0:1::2 -> 2001:410:0:1:203:baff:fe05:31b2 TELNET R
> > port=33746
> > 2001:410:0:1:203:baff:fe05:31b2 -> 2001:410:0:1::2 TELNET C
> > port=33746 e
> > 2001:410:0:1::2 -> 2001:410:0:1:203:baff:fe05:31b2 TELNET R
> > port=33746
> [u]> 2001:410:0:1:203:baff:fe05:31b2 -> 2001:410:0:1::2 TELNET C
> port=33746 ni
> > 2001:410:0:1:203:baff:fe05:31b2 -> 2001:410:0:1::2 TELNET C
> > port=33746 ni
> > 2001:410:0:1:203:baff:fe05:31b2 -> 2001:410:0:1::2 TELNET C
> > port=33746 ni[/u]
>
> Problem is that the packets being sent out [ three pkts that are
underlined above ] have incorrect TCP checksum and that's the reason the
router is dropping the packets. However, i am wondering what could be
the problem. If i give my credentials a bit slowly when i do a telnet, i
am able to communicate properly. On the other hand, when i send in the
credentials a bit fast, i see this checksum issue. Could this be due to
threading ? that the data is corrupted ? Should i protect this code
where i recreate the v4 to v6 packet ? Please advice.
Rather than something exotic, like a threading problem, it seems more
likely to me that the code in this module that updates the checksum
(going from IPv4 to IPv6 pseudoheader) is just incorrect.
But without source posted somewhere to review, it seems unlikely that
anyone can offer solid help.
--
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]