summaryrefslogtreecommitdiffstats
path: root/ipv4.c
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2013-04-10 16:52:22 +0900
committerLorenzo Colitti <lorenzo@google.com>2013-04-12 12:35:41 +0900
commitee80ca65907d214e2483e315a1ba7f610184de03 (patch)
tree9fb525e543515052c55a8c52ca9db6c4a790d89a /ipv4.c
parentd90841824dc00f65a48a789396c7f428807432ca (diff)
downloadandroid_external_android-clat-ee80ca65907d214e2483e315a1ba7f610184de03.tar.gz
android_external_android-clat-ee80ca65907d214e2483e315a1ba7f610184de03.tar.bz2
android_external_android-clat-ee80ca65907d214e2483e315a1ba7f610184de03.zip
Improve checksum calculation and address checking
1. Add a function that calculates the checksum of all the packet components starting from the specified position. This simplifies the code a bit and makes it easier to translate nested packets like ICMP error messages. 2. Don't hardcode IP source and destination addresses. This is required to translate ICMP error messages. Bug: 8276725 Change-Id: I2cae45683ae3943e508608fd0a140180dbc60823
Diffstat (limited to 'ipv4.c')
-rw-r--r--ipv4.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipv4.c b/ipv4.c
index 1d34e1e..89e47e4 100644
--- a/ipv4.c
+++ b/ipv4.c
@@ -139,6 +139,6 @@ int ipv4_packet(clat_packet out, int pos, const char *packet, size_t len) {
}
// Set the length.
- ip6_targ->ip6_plen = htons(payload_length(out, pos));
+ ip6_targ->ip6_plen = htons(packet_length(out, pos));
return iov_len;
}