summaryrefslogtreecommitdiffstats
path: root/ipv4.c
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2013-11-18 12:59:44 +0900
committerLorenzo Colitti <lorenzo@google.com>2013-11-25 18:45:45 +0900
commitc9f4c89da6c76ebc59a0ec1047853a13ce5f5d96 (patch)
tree9110629c337588c00c67a64b05fa498bd37423bc /ipv4.c
parent9fe1673c316988d0fb8dd85e9d86642e0ac6d1b4 (diff)
downloadandroid_external_android-clat-c9f4c89da6c76ebc59a0ec1047853a13ce5f5d96.tar.gz
android_external_android-clat-c9f4c89da6c76ebc59a0ec1047853a13ce5f5d96.tar.bz2
android_external_android-clat-c9f4c89da6c76ebc59a0ec1047853a13ce5f5d96.zip
Add generic IP packet code and use it for GRE.
Bug: 11542311 Change-Id: I174e0b268869bc77927feeee57003580c47c30f2
Diffstat (limited to 'ipv4.c')
-rw-r--r--ipv4.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ipv4.c b/ipv4.c
index 47f2422..b5cbf80 100644
--- a/ipv4.c
+++ b/ipv4.c
@@ -123,12 +123,14 @@ 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);