* tcp checkum claculation!!
@ 2004-09-16 16:43 Fallucchi Antonio
0 siblings, 0 replies; only message in thread
From: Fallucchi Antonio @ 2004-09-16 16:43 UTC (permalink / raw)
To: netfilter
Hi,
I need a Help for recalculate the checksum of TCP packet. I read the
packet from iptables_queue, and sum 16 bit word from and add the
pseudoheader ipsource, ipdest, 6, tcp_len (form the ip packet), and i
see the buddy. I all width complement!
I have see the site http://www.netfor2.com/tcpsum.htm
and the my code is:
for (i=0;i<11;i=i+2)
{
sum+=*pseudobuff++;
}
nwords=swap(len_tcp)-(len_ip*4);
while(nwords>1)
{
sum+=*buff++;
nwords-=2;
}
if(nwords==1)
{
sum+=*(unsigned char *)buff;
}
sum=(sum>>16)+(sum&0xffff);
sum+=(sum>>16);
sum = ~sum;
but the result isn't correct...
tancks for the help.
bye bye
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-09-16 16:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-16 16:43 tcp checkum claculation!! Fallucchi Antonio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox