i am using raw sockets to create my own socket. i need to set the tcp_checksum.
i have tried a lot of references but all are not working (i am using wireshark for testing). could you help me please. by the way, i read somewhere that if you set tcp_checksum=0. then the hardware will calculate the checksum automatically for you. is开发者_如何学JAVA this true? i tried it, but in wireshark the tcp_checksum gives a value of 0X000 and says tcp offload. i also read about tcp offloading, and didn't understand, is it only that wireshark cannot check an offloaded tcp checksum, but there is a correct one??EDIT: i realized that if you set tcpChecksum to 0, then the network card will set it and not the operating system. i was testing using wireshark and a virtual machine, so this explains why the checksum is 0x000 (since the packet is not even passing to the network card.)
but i am still curious about calculating the tcp_checksum manually... any help or links?This article tries to explain how it's done.
Another place worth taking a look at is for Linux kernel sources, start from the file net/ipv4/tcp__ipv4.c
精彩评论