我确实发现了一些其他相关问题,但没有真正给出我正在寻找的答案。
我将 Boost.Asio 与 ip::udp::socket ( http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/reference.html ) 一起使用
从此页面:http://en.wikipedia.org/wiki/User_Datagram_Protocol#IPv4_Pseudo_Header :它指出 UDP 校验和对于 IPv4 是可选的。
查看 https://www.rfc-editor.org/rfc/rfc768似乎只有启用调试时才会出现这种情况?
另请参阅:http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/reference/basic_datagram_socket/debug.html
将调试设置为 false 是否足以确保计算 UDP 校验和,或者如何 100% 确保计算 UDP 校验和,以便在使用 UDP/IPv4 时可以安全地忽略底层数据包协议(protocol)中的校验和计算?
我知道 UDP/IPv6 保证校验和计算,但我不能限制我的系统仅使用 IPv6。
最佳答案
使用tcpdump/wireshark/ethereal/等工具。转储实际流量。
在我看来,校验和实际上可能是在驱动程序级别处理的。你可以使用例如ethertool
启用它们 (? http://www.linuxquestions.org/questions/linux-networking-3/help-needed-disabling-tcp-udp-checksum-offloading-in-debian-880233/ )
确实是Wireshark FAQ有一个关于此的条目:
You see the "incorrect" checksums due to a feature called TCP checksum offloading. 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. ¹
关于c++ - 确定是否使用 Boost.Asio 计算 UDP 校验和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30117414/