1

I am trying to programatically send out ICMPv6 echo requests (ping6) using WinSock2. The ICMPv6 checksum is calculated based on the whole IPv6 packet that will be sent out. For that reason - from what I understand - the OS (kernel?) is supposed to calculate it and write it into the ICMPv6 header when sending the packet.

This works very well on a SUSE Linux Enterprise Server 11, however, Windows XP does not seem to do this. It leaves the checksum to what I set it by default (zero, I analyzed this using Wireshark), thus the receiving end will discard it and not reply.

IPv6 is correctly set up on this WinXP machine. With the help of Wireshark I even found out that it responds correctly to ICMPv6 pings from the SUSE Linux server, sent using the very same code. So it cannot be that Windows XP doesn't support ICMPv6. However, I wonder whether WinSock2 under Windows XP does.

The WinSock2 API does provide the IPPROTO_ICMPV6 protocol which I create my raw socket for. Is there any special socket option I need to set for the ICMPv6 checksum to be calculated automatically, or are there any other tricks?

Community
  • 1
  • 1
pdinklag
  • 1,241
  • 1
  • 12
  • 28
  • I think you found a bug. I don't see a [socket option](http://msdn.microsoft.com/en-us/library/ms738574%28v=vs.85%29.aspx) for this, either. I wouldn't be surprised if the Windows `ping` implementation fills in the checksum manually after doing a route lookup. – mpontillo Mar 03 '11 at 01:44
  • you said you see checksum being set by default (zero) - did you see this via sniffer on the sending host or on the receiving host? If it is seen on the receiving host - it's definitely not a `checksum offloading` issue then – Andrey Mar 14 '11 at 23:12

1 Answers1

0

Most probable reason for the behavior you describe is checksum offloading. It means, checksum calculation might be delegated to networking hardware, so that sniffed packet doesn't contain the correct checksum value. Refer to http://www.wireshark.org/docs/wsug_html_chunked/ChAdvChecksums.html or to http://en.wikipedia.org/wiki/Transmission_Control_Protocol#Checksum_offload

Andrey
  • 4,216
  • 1
  • 23
  • 31
  • I can _ping6_ the same host via the command prompt without problem. I can't see why the WinSock API should use checksum offloading on Windows XP while everything else doesn't. It's still a possibility, because I doubt that my network hardware already supports ICMPv6 checksum calculation. Is there any way I can find out whether checksum offloading is being used? – pdinklag Mar 14 '11 at 07:08
  • You can check in the advanced settings of you network adapter (in Device Manager). Or take a look at the following link (if you are friendly with the registry) http://hefetz.net/blog/2009/11/25/enable-and-disable-task-offloading-tcp-chimney-offload/ – Andrey Mar 14 '11 at 23:15