Add generic IP packet code and use it for GRE.

Bug: 11542311
Change-Id: I174e0b268869bc77927feeee57003580c47c30f2
diff --git a/ipv6.c b/ipv6.c
index 9eaa6ab..04d9f9c 100644
--- a/ipv6.c
+++ b/ipv6.c
@@ -137,14 +137,16 @@
   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);