LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   TCP checksum error (https://www.linuxquestions.org/questions/programming-9/tcp-checksum-error-553709/)

mshenbagaraj 05-14-2007 05:36 AM

TCP checksum error
 
Hi
i was hooking the packet at the NET_IP_LOCAL_OUT or NET_IP_POST_ROUTING and added my AH header to that packet in between IP and TCP headers .....
i reduced the MSS to 1450(by default it is 1500)..because i was adding my AH header after all the packet formation was done i.e)befor hook the packet formation was done......
Also i calculated the check sum in that hook and replaced with that TCP checksum...
when i send lesser than 1500bytes of data..i was able to receive the packets at the receiver...
i was analysing the packet headers in receiver using
Ethereal Analyser........

But when i was tried to send more than 1500 bytes of data for example 5000bytes..i was able to receive the first ACK packet carries first 1500 bytes of data ..for that packet the check sum also showing corrct in ethereal.....but for the next ACK packet which carries next 1500 bytes ethereal is showing check sum error in TCP header...
similar thing is happenig for the proceeding ACK packets (next 1500 bytes of data)and PUSH packets(carries the remaining data)....

i am using Linux kernel 2.6.16.10 version........
i am not sure the problem is at the sending side or receiving side...because at the sending side the device driver may change the Checksum...i am not sure the full functioning of device driver...
Please help me on this issue....
I am waiting for the reply...

Thanks & regards
Shenbagaraj.M

Mara 05-14-2007 03:13 PM

If the first packet has right checksum and the second one not, I'd assume you're calculating checksum for incorrect data block or you're not including the AH header.

I understand the IP checksum is correct. It would mean it's either AH or TCP header. Look into that fragment carefully, it's probably something very simple. Also, if you have a debugging console where you can print something, write checksums after calculating it for one header after another (depending on the function you use; which should in fact calculate it all correctly if you give it correct packet boundaries). It should show something.

mshenbagaraj 05-15-2007 04:52 AM

thanks for the reply.....-:)
do i need to include AH header in calculating checksum..if so then what are the fields i need to include from that Ah header....
please reply ...

Mara 05-16-2007 02:43 PM

You don't include AH in TCP checksum, that's quite important.


All times are GMT -5. The time now is 01:25 PM.