summaryrefslogtreecommitdiffstats
path: root/translate.h
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-02-10 09:20:05 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-03-10 17:44:14 +0900
commitc1be4799c39775fecb004d92687fe95298cac380 (patch)
tree612f09a5ff8cd68a05ea901f7c08c4129036198a /translate.h
parent57bcefd5920c330f03aa76329b9f97f3f1e841ac (diff)
downloadandroid_external_android-clat-c1be4799c39775fecb004d92687fe95298cac380.tar.gz
android_external_android-clat-c1be4799c39775fecb004d92687fe95298cac380.tar.bz2
android_external_android-clat-c1be4799c39775fecb004d92687fe95298cac380.zip
DO NOT MERGE: Fix up checksums instead of recalculating them.
Currently the checksums of translated packets are calculated from scratch by checksumming the translated packet. This is slow and does not work in the case of fragments, because the whole packet is not available. Instead, calculate the checksum by adjusting the checksum of the original packet. Bug: 11542311 Bug: 12116252 Change-Id: I457347753d1bb5b23e3ae759bf2e4388102772d7
Diffstat (limited to 'translate.h')
-rw-r--r--translate.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/translate.h b/translate.h
index 9f1ac15..cfb7bbb 100644
--- a/translate.h
+++ b/translate.h
@@ -61,12 +61,14 @@ int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6,
int generic_packet(clat_packet out, int pos, const char *payload, size_t len);
// Translate TCP and UDP packets.
-int tcp_packet(clat_packet out, int pos, const struct tcphdr *tcp, uint32_t checksum, size_t len);
-int udp_packet(clat_packet out, int pos, const struct udphdr *udp, uint32_t checksum, size_t len);
+int tcp_packet(clat_packet out, int pos, const struct tcphdr *tcp,
+ uint32_t old_sum, uint32_t new_sum, size_t len);
+int udp_packet(clat_packet out, int pos, const struct udphdr *udp,
+ uint32_t old_sum, uint32_t new_sum, size_t len);
int tcp_translate(clat_packet out, int pos, const struct tcphdr *tcp, size_t header_size,
- uint32_t checksum, const char *payload, size_t payload_size);
-int udp_translate(clat_packet out, int pos, const struct udphdr *udp, uint32_t checksum,
- const char *payload, size_t payload_size);
+ uint32_t old_sum, uint32_t new_sum, const char *payload, size_t payload_size);
+int udp_translate(clat_packet out, int pos, const struct udphdr *udp,
+ uint32_t old_sum, uint32_t new_sum, const char *payload, size_t payload_size);
#endif /* __TRANSLATE_H__ */