MTU: IP fragmentation added to ip4-rewrite and ip6-rewrite

Change-Id: Ibae260273f25a319153be37470aed49ff73e957a
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 6d5f07b..3444eb8 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -39,6 +39,7 @@
 
 #include <vnet/vnet.h>
 #include <vnet/ip/ip.h>
+#include <vnet/ip/ip_frag.h>
 #include <vnet/ethernet/ethernet.h>	/* for ethernet_header_t */
 #include <vnet/ethernet/arp_packet.h>	/* for ethernet_arp_header_t */
 #include <vnet/ppp/ppp.h>
@@ -2013,6 +2014,8 @@
 {
   IP4_REWRITE_NEXT_DROP,
   IP4_REWRITE_NEXT_ICMP_ERROR,
+  IP4_REWRITE_NEXT_FRAGMENT,
+  IP4_REWRITE_N_NEXT		/* Last */
 } ip4_rewrite_next_t;
 
 /**
@@ -2042,8 +2045,10 @@
 	}
       else
 	{
-	  /* Add support for fragmentation here */
-	  *next = IP4_REWRITE_NEXT_DROP;
+	  /* IP fragmentation */
+	  ip_frag_set_vnet_buffer (b, 0, adj_packet_bytes,
+				   IP4_FRAG_NEXT_IP4_LOOKUP, 0);
+	  *next = IP4_REWRITE_NEXT_FRAGMENT;
 	}
     }
 }
@@ -2539,10 +2544,11 @@
 
   .format_trace = format_ip4_rewrite_trace,
 
-  .n_next_nodes = 2,
+  .n_next_nodes = IP4_REWRITE_N_NEXT,
   .next_nodes = {
     [IP4_REWRITE_NEXT_DROP] = "ip4-drop",
     [IP4_REWRITE_NEXT_ICMP_ERROR] = "ip4-icmp-error",
+    [IP4_REWRITE_NEXT_FRAGMENT] = "ip4-frag",
   },
 };
 VLIB_NODE_FUNCTION_MULTIARCH (ip4_rewrite_node, ip4_rewrite)