diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2014-03-08 20:57:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-08 20:57:46 +0000 |
commit | ad21a1f63cbc6a0ef5d207c4bab38171bfcecd76 (patch) | |
tree | d5dd29290809c9f03638ced89fb991c91916ec67 | |
parent | a24fc7c545c22b0413fc324ecde96721b5a49b30 (diff) | |
parent | 5658b2563f0a939e424cd7ef34643cf5141a6bf1 (diff) | |
download | android_external_android-clat-ad21a1f63cbc6a0ef5d207c4bab38171bfcecd76.tar.gz android_external_android-clat-ad21a1f63cbc6a0ef5d207c4bab38171bfcecd76.tar.bz2 android_external_android-clat-ad21a1f63cbc6a0ef5d207c4bab38171bfcecd76.zip |
Merge "Revert "DO NOT MERGE: Add generic IP packet code and use it for GRE."" into klp-dev
-rw-r--r-- | ipv4.c | 8 | ||||
-rw-r--r-- | ipv6.c | 8 | ||||
-rw-r--r-- | translate.c | 16 | ||||
-rw-r--r-- | translate.h | 3 |
4 files changed, 6 insertions, 29 deletions
@@ -123,14 +123,12 @@ int ipv4_packet(clat_packet out, int pos, const char *packet, size_t len) { // Calculate the pseudo-header checksum. checksum = ipv6_pseudo_header_checksum(0, ip6_targ, len_left); - if (nxthdr == IPPROTO_ICMPV6) { + if(nxthdr == IPPROTO_ICMPV6) { iov_len = icmp_packet(out, pos + 1, (const struct icmphdr *) next_header, checksum, len_left); - } else if (nxthdr == IPPROTO_TCP) { + } else if(nxthdr == IPPROTO_TCP) { iov_len = tcp_packet(out, pos + 1, (const struct tcphdr *) next_header, checksum, len_left); - } else if (nxthdr == IPPROTO_UDP) { + } else if(nxthdr == IPPROTO_UDP) { iov_len = udp_packet(out, pos + 1, (const struct udphdr *) next_header, checksum, len_left); - } else if (nxthdr == IPPROTO_GRE) { - iov_len = generic_packet(out, pos + 1, next_header, len_left); } else { #if CLAT_DEBUG logmsg_dbg(ANDROID_LOG_ERROR, "ip_packet/unknown protocol: %x",header->protocol); @@ -136,16 +136,14 @@ int ipv6_packet(clat_packet out, int pos, const char *packet, size_t len) { checksum = ipv4_pseudo_header_checksum(0, ip_targ, len_left); // does not support IPv6 extension headers, this will drop any packet with them - if (protocol == IPPROTO_ICMP) { + if(protocol == IPPROTO_ICMP) { iov_len = icmp6_packet(out, pos + 1, (const struct icmp6_hdr *) next_header, len_left); - } else if (ip6->ip6_nxt == IPPROTO_TCP) { + } else if(ip6->ip6_nxt == IPPROTO_TCP) { iov_len = tcp_packet(out, pos + 1, (const struct tcphdr *) next_header, checksum, len_left); - } else if (ip6->ip6_nxt == IPPROTO_UDP) { + } else if(ip6->ip6_nxt == IPPROTO_UDP) { iov_len = udp_packet(out, pos + 1, (const struct udphdr *) next_header, checksum, len_left); - } else if (ip6->ip6_nxt == IPPROTO_GRE) { - iov_len = generic_packet(out, pos + 1, next_header, len_left); } else { #if CLAT_DEBUG logmsg(ANDROID_LOG_ERROR, "ipv6_packet/unknown next header type: %x", ip6->ip6_nxt); diff --git a/translate.c b/translate.c index 00ea0b9..599182d 100644 --- a/translate.c +++ b/translate.c @@ -278,22 +278,6 @@ int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6, return clat_packet_len; } -/* function: generic_packet - * takes a generic IP packet and sets it up for translation - * out - output packet - * pos - position in the output packet of the transport header - * payload - pointer to IP payload - * len - size of ip payload - * returns: the highest position in the output clat_packet that's filled in - */ -int generic_packet(clat_packet out, int pos, const char *payload, size_t len) { - out[pos].iov_len = 0; - out[CLAT_POS_PAYLOAD].iov_base = (char *) payload; - out[CLAT_POS_PAYLOAD].iov_len = len; - - return CLAT_POS_PAYLOAD + 1; -} - /* function: udp_packet * takes a udp packet and sets it up for translation * out - output packet diff --git a/translate.h b/translate.h index 9f1ac15..c4d8ede 100644 --- a/translate.h +++ b/translate.h @@ -57,9 +57,6 @@ int icmp_to_icmp6(clat_packet out, int pos, const struct icmphdr *icmp, uint32_t int icmp6_to_icmp(clat_packet out, int pos, const struct icmp6_hdr *icmp6, const char *payload, size_t payload_size); -// Translate generic IP packets. -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); |