summaryrefslogtreecommitdiffstats
path: root/translate.h
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-02-09 10:35:38 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-02-22 12:46:06 +0900
commit57d480d2b425ef20d8b6f84abd4e9e3209fa9422 (patch)
tree1d4d53278970b0681042e4f10ef44c1c5334bc5f /translate.h
parent07f0265830fcae2632159e9993b93a161d7ea23b (diff)
downloadandroid_external_android-clat-57d480d2b425ef20d8b6f84abd4e9e3209fa9422.tar.gz
android_external_android-clat-57d480d2b425ef20d8b6f84abd4e9e3209fa9422.tar.bz2
android_external_android-clat-57d480d2b425ef20d8b6f84abd4e9e3209fa9422.zip
Support translating fragmented packets.
Bug: 11542311 Change-Id: I14a20b9ac669cdb5927f6ac26147bb0109099497
Diffstat (limited to 'translate.h')
-rw-r--r--translate.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/translate.h b/translate.h
index 3378254..5efa817 100644
--- a/translate.h
+++ b/translate.h
@@ -36,9 +36,11 @@
// The CLAT_POS_XXX constants represent the array indices within the clat_packet that contain
// specific parts of the packet. The packet_* functions operate on all the packet segments past a
// given position.
-enum clat_packet_index { CLAT_POS_TUNHDR, CLAT_POS_IPHDR, CLAT_POS_TRANSPORTHDR,
- CLAT_POS_ICMPERR_IPHDR, CLAT_POS_ICMPERR_TRANSPORTHDR,
- CLAT_POS_PAYLOAD, CLAT_POS_MAX };
+enum clat_packet_index {
+ CLAT_POS_TUNHDR, CLAT_POS_IPHDR, CLAT_POS_FRAGHDR, CLAT_POS_TRANSPORTHDR,
+ CLAT_POS_ICMPERR_IPHDR, CLAT_POS_ICMPERR_FRAGHDR, CLAT_POS_ICMPERR_TRANSPORTHDR,
+ CLAT_POS_PAYLOAD, CLAT_POS_MAX
+};
typedef struct iovec clat_packet[CLAT_POS_MAX];
// Calculates the checksum over all the packet components starting from pos.
@@ -65,6 +67,11 @@ void translate_packet(const struct tun_data *tunnel, struct tun_pi *tun_header,
int ipv4_packet(clat_packet out, int pos, const char *packet, size_t len);
int ipv6_packet(clat_packet out, int pos, const char *packet, size_t len);
+// Deal with fragmented packets.
+size_t maybe_fill_frag_header(struct ip6_frag *frag_hdr, struct ip6_hdr *ip6_targ,
+ const struct iphdr *old_header);
+uint8_t parse_frag_header(const struct ip6_frag *frag_hdr, struct iphdr *ip_targ);
+
// Translate ICMP packets.
int icmp_to_icmp6(clat_packet out, int pos, const struct icmphdr *icmp, uint32_t checksum,
const char *payload, size_t payload_size);