Modify the pseudo-header checksum functions.
- Remove the initial checksum, which we don't use anywhere.
- Add the upper-layer protocol to the IPv6 function. Currently
this is always the same as the next header field in the IPv6
header, but technically it's the upper-layer header after all
the extension headers. This is required to support fragments.
Bug: 11542311
Change-Id: Ie1a20fa74ee5bc933c1014bab74ae2957979b2b8
diff --git a/ipv4.c b/ipv4.c
index c828ffa..e2636b4 100644
--- a/ipv4.c
+++ b/ipv4.c
@@ -112,8 +112,8 @@
out[pos].iov_len = sizeof(struct ip6_hdr);
// Calculate the pseudo-header checksum.
- old_sum = ipv4_pseudo_header_checksum(0, header, len_left);
- new_sum = ipv6_pseudo_header_checksum(0, ip6_targ, len_left);
+ old_sum = ipv4_pseudo_header_checksum(header, len_left);
+ new_sum = ipv6_pseudo_header_checksum(ip6_targ, len_left, nxthdr);
if (nxthdr == IPPROTO_ICMPV6) {
iov_len = icmp_packet(out, pos + 1, (const struct icmphdr *) next_header, new_sum, len_left);