简体   繁体   English

确定是否使用Boost.Asio计算UDP校验和

[英]Determine if UDP Checksum is Computed using Boost.Asio

I did found some other related questions but nothing which really gives me the answer I'm looking for. 我确实找到了其他一些相关问题,但没有任何东西能真正给我我想要的答案。

I'm using Boost.Asio with ip::udp::socket ( http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/reference.html ) 我正在将Boost.Asio与ip :: udp :: socket( http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/reference.html )一起使用

From this page: http://en.wikipedia.org/wiki/User_Datagram_Protocol#IPv4_Pseudo_Header : It states that the UDP checksum is optional with IPv4. 在此页面上: http : //en.wikipedia.org/wiki/User_Datagram_Protocol#IPv4_Pseudo_Header :它指出UDP校验和对于IPv4是可选的。

Looking at http://tools.ietf.org/html/rfc768 it seems that this would usually only be the case if Debugging is enabled? 查看http://tools.ietf.org/html/rfc768 ,看来只有启用了调试功能时,情况才会如此?

see also: http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/reference/basic_datagram_socket/debug.html 另请参阅: http : //www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/reference/basic_datagram_socket/debug.html

Would setting debugging to false be enough to ensure that a UDP checksum is computed, or how can I make 100% sure that UDP checksums are computed so that I can safely ignore checksum computation in my underlying packet protocol when using UDP/IPv4? 将调试设置为false是否足以确保计算UDP校验和,或者我如何才能100%确保计算UDP校验和,以便在使用UDP / IPv4时可以安全地忽略基础数据包协议中的校验和计算?

I'm aware that UDP/IPv6 garuntees checksum computation but I can't limit my system to using only IPv6. 我知道UDP / IPv6可以确保校验和计算,但是我不能将系统限制为仅使用IPv6。

Use a tool like tcpdump/wireshark/ethereal/etc. 使用tcpdump / wireshark / ethereal / etc之类的工具。 to dump the actual traffic. 转储实际流量。

It seems to me that the checksums might actually be handled at the driver level. 在我看来,校验和实际上可能是在驱动程序级别处理的。 You could use eg ethertool to enable them (? http://www.linuxquestions.org/questions/linux-networking-3/help-needed-disabling-tcp-udp-checksum-offloading-in-debian-880233/ ) 您可以使用例如ethertool启用它们(? http://www.linuxquestions.org/questions/linux-networking-3/help-needed-disabling-tcp-udp-checksum-offloading-in-debian-880233/

Indeed the Wireshark FAQ has an entry about this: 实际上, Wireshark常见问题解答中有关于此的条目:

You see the "incorrect" checksums due to a feature called TCP checksum offloading. 由于称为TCP校验和卸载的功能,您会看到“错误的”校验和。 The checksum fields for outgoing TCP packets are not pre-calculated by the operating system but set to 0 and left for calculation by the NIC processor. 传出TCP数据包的校验和字段不是由操作系统预先计算的,而是设置为0,留给NIC处理器计算。 ¹ ¹

¹ source: https://serverfault.com/a/288493 ¹来源: https//serverfault.com/a/288493

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM