Problem with calculation on UDP checksum in SRv6
Summary
the IPv6 + SRH + UDP packet will validate the UDP checksum when check the option "Validate the UDP checksum if possible". currently, when I update my wireshark version from 3.2.4 to 3.4.0, one of my SRv6 packet shows UDP checksum is wrong, which was right before.
I check the packet in scapy, it show the checksum is right. Then I check the RFC 2460 to make sure the UDP checksum calculation is in the right place. It shows:
If the IPv6 packet contains a Routing header, the Destination Address used in the pseudo-header is that of the final destination.At the originating node, that address will be in the last element of the Routing header; at the recipient(s), that address will be in the Destination Address field of the IPv6 header.
So the IPv6 DST used in UDP pseudo-header supposed to be the first segment in segment list in SRv6, a.k.a segment[0]. Scapy is right, so is the wireshark 3.2.4.
I looked into 3.4.0 wireshark code, find that in file packet-ipv6.c
, the function dissect_routing6_srh
was rewritten for RFC8754(compared to version 3.2.4 ,where code is based on rfc draft). But the logic is also rewritten for pinfo->dst
---- from segment[0] in 3.2.4 to original IPv6 dst in 3.4.0.
This modification is happened in Commit ca43dace 'IPv6: Update SRH dissection to RFC8754'
.
So I figured, this change is not right, based on RFC2460.
Steps to reproduce
What is the current bug behavior?
the UDP pseudo-header use IPv6 DA for UDP checksum, not look into segment list.
What is the expected correct behavior?
the UDP checksum calculation should use segment[0] for IPv6 DST in pseudo-header.