Dear Stephen,

On 8/13/2025 1:57 AM, Stephen Hemminger wrote:
[...]

Yes this is similar but in UDP/TCP case the UDP/TCP header is included in
the checksum. l4_hdr points to the UDP/TCP header. l4_len is the payload
length that is TCP/UDP header and the associated data.

Yes, when I tried using the rte_ipv6_udptcp_cksum() function, I supplied a pointer to the ICMPv6 header as the second argument. My code line was:

    reply_icmpv6_hdr->checksum=rte_ipv6_udptcp_cksum(reply_ipv6_hdr,reply_icmpv6_hdr);  

And the internal function reads out the payload length from the IPv6 header as follows:

    l4_len = rte_be_to_cpu_16(ipv6_hdr->payload_len);

This is also correct.

The pseudo header is done by rte_ipv6_phdr_cksum().

For ICMPv6 you would need to point l4_hdr at ICMP header.
Even though ICMP is not really an L4 protocol.

https://en.wikipedia.org/wiki/ICMPv6#Checksum

Yes, I checked the drawing, this is the same as https://www.rfc-editor.org/rfc/rfc2460#section-8.1 and the code calculates exactly the same (with some trick, as I mentioned earlier).

And the calculated checksum is CORRECT! :-)

It turned out, that I had made a programming error. (My calculation of the address of the checksum field was incorrect, and thus I manipulated a wrong field.)

Anyway, thank you very much for all your help! 

I learnt a lot from checking how ICMPv6 checksum is calculated. :-)

And I hope that it will be useful information for others that the rte_ipv6_udptcp_cksum() function is perfectly suitable for calculating ICMPv6 checksum, too. :-)

Best regards,

Gábor