简体   繁体   中英

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 )

From this page: http://en.wikipedia.org/wiki/User_Datagram_Protocol#IPv4_Pseudo_Header : It states that the UDP checksum is optional with IPv4.

Looking at http://tools.ietf.org/html/rfc768 it seems that this would usually only be the case if Debugging is enabled?

see also: 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?

I'm aware that UDP/IPv6 garuntees checksum computation but I can't limit my system to using only IPv6.

Use a tool like 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/ )

Indeed the Wireshark FAQ has an entry about this:

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. ¹

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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