summaryrefslogtreecommitdiffstats
path: root/checksum.h
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-02-10 09:20:05 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-02-14 13:33:04 +0900
commit5a50c0283346a197cda7af19e68f611f14b8fe57 (patch)
tree1cccafeba5bbd41374daa0aed35379faa4c26a88 /checksum.h
parenta33592bd08a20c6a521b8508975b7a74ecdf4f03 (diff)
downloadplatform_external_android-clat-5a50c0283346a197cda7af19e68f611f14b8fe57.tar.gz
platform_external_android-clat-5a50c0283346a197cda7af19e68f611f14b8fe57.tar.bz2
platform_external_android-clat-5a50c0283346a197cda7af19e68f611f14b8fe57.zip
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: I6b78a94ca5bd96b13ee2653b6200551193b3dcc1
Diffstat (limited to 'checksum.h')
-rw-r--r--checksum.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/checksum.h b/checksum.h
index 473f5f5..44921f0 100644
--- a/checksum.h
+++ b/checksum.h
@@ -25,4 +25,6 @@ uint16_t ip_checksum(const void *data, int len);
uint32_t ipv6_pseudo_header_checksum(uint32_t current, const struct ip6_hdr *ip6, uint16_t len);
uint32_t ipv4_pseudo_header_checksum(uint32_t current, const struct iphdr *ip, uint16_t len);
+uint16_t ip_checksum_adjust(uint16_t checksum, uint32_t old_hdr_sum, uint32_t new_hdr_sum);
+
#endif /* __CHECKSUM_H__ */