summaryrefslogtreecommitdiffstats
path: root/clatd.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 /clatd.c
parentd90841824dc00f65a48a789396c7f428807432ca (diff)
downloadplatform_external_android-clat-ee80ca65907d214e2483e315a1ba7f610184de03.tar.gz
platform_external_android-clat-ee80ca65907d214e2483e315a1ba7f610184de03.tar.bz2
platform_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 'clatd.c')
-rw-r--r--clatd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/clatd.c b/clatd.c
index 8dddc96..a914f02 100644
--- a/clatd.c
+++ b/clatd.c
@@ -333,11 +333,11 @@ void packet_handler(const struct tun_data *tunnel, struct tun_pi *tun_header, co
if(ntohs(tun_header->proto) == ETH_P_IP) {
fd = tunnel->fd6;
fill_tun_header(&tun_targ, ETH_P_IPV6);
- iov_len = ipv4_packet(out, POS_IPHDR, packet, packetsize);
+ iov_len = ipv4_packet(out, CLAT_POS_IPHDR, packet, packetsize);
} else if(ntohs(tun_header->proto) == ETH_P_IPV6) {
fd = tunnel->fd4;
fill_tun_header(&tun_targ, ETH_P_IP);
- iov_len = ipv6_packet(out, POS_IPHDR, packet, packetsize);
+ iov_len = ipv6_packet(out, CLAT_POS_IPHDR, packet, packetsize);
} else {
logmsg(ANDROID_LOG_WARN,"packet_handler: unknown packet type = %x",tun_header->proto);
}