tcp 校验和和 tcp 卸载
我正在使用原始套接字来创建我自己的套接字。我需要设置 tcp_checksum。
我尝试了很多参考资料,但都不起作用(我正在使用wireshark进行测试)。
你能帮我一下吗?
顺便说一句,我在某处读到如果你设置 tcp_checksum=0。然后硬件会自动为你计算校验和。这是真的吗?我尝试过,但在wireshark中tcp_checksum给出的值为0X000并表示tcp卸载。我还阅读了有关 tcp 卸载的内容,但不明白,是否只是wireshark无法检查卸载的tcp校验和,但有一个正确的校验和?
编辑:我意识到,如果将 tcpChecksum 设置为 0,那么网卡将设置它,而不是操作系统。我正在使用wireshark和虚拟机进行测试,所以这解释了为什么校验和是0x000(因为数据包甚至没有传递到网卡。)
但我仍然对手动计算 tcp_checksum 感到好奇...有任何帮助或链接吗?
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 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
本文试图解释它是如何完成的。
另一个值得一看的地方是 Linux 内核源代码,从文件
net/ipv4/tcp__ipv4.c
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