Add generic IP packet code and use it for GRE.
Bug: 11542311
Change-Id: I174e0b268869bc77927feeee57003580c47c30f2
diff --git a/ipv4.c b/ipv4.c
index 47f2422..b5cbf80 100644
--- a/ipv4.c
+++ b/ipv4.c
@@ -123,12 +123,14 @@
// 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);