summaryrefslogtreecommitdiffstats
path: root/ipv4.c
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-02-20 14:28:43 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-02-22 12:46:06 +0900
commit07f0265830fcae2632159e9993b93a161d7ea23b (patch)
tree04699deb1961d1ca61261da7af83d1be29755a14 /ipv4.c
parentfbef82d10366495bbd0dbb30cea015cb67c8105a (diff)
downloadandroid_external_android-clat-07f0265830fcae2632159e9993b93a161d7ea23b.tar.gz
android_external_android-clat-07f0265830fcae2632159e9993b93a161d7ea23b.tar.bz2
android_external_android-clat-07f0265830fcae2632159e9993b93a161d7ea23b.zip
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
Diffstat (limited to 'ipv4.c')
-rw-r--r--ipv4.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ipv4.c b/ipv4.c
index c828ffa..e2636b4 100644
--- a/ipv4.c
+++ b/ipv4.c
@@ -112,8 +112,8 @@ int ipv4_packet(clat_packet out, int pos, const char *packet, size_t len) {
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);