fib: constify the adjacency in the rewrite nodes

Type: refactor

Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: I3aad20b35d89fc541fdf185096d71ca12b09a6e2
diff --git a/src/vnet/adj/adj.h b/src/vnet/adj/adj.h
index 58e5ebf..cd6e838 100644
--- a/src/vnet/adj/adj.h
+++ b/src/vnet/adj/adj.h
@@ -150,7 +150,7 @@
  * @brief A function type for post-rewrite fixups on midchain adjacency
  */
 typedef void (*adj_midchain_fixup_t) (vlib_main_t * vm,
-				      struct ip_adjacency_t_ * adj,
+				      const struct ip_adjacency_t_ * adj,
 				      vlib_buffer_t * b0,
                                       const void *data);
 
diff --git a/src/vnet/adj/rewrite.h b/src/vnet/adj/rewrite.h
index c2084ea..5c1d24e 100644
--- a/src/vnet/adj/rewrite.h
+++ b/src/vnet/adj/rewrite.h
@@ -154,7 +154,7 @@
   vnet_rewrite_get_data_internal (&((rw).rewrite_header), sizeof ((rw).rewrite_data))
 
 always_inline void
-_vnet_rewrite_one_header (vnet_rewrite_header_t * h0,
+_vnet_rewrite_one_header (const vnet_rewrite_header_t * h0,
 			  void *packet0, int most_likely_size)
 {
   /* 0xfefe => poisoned adjacency => crash */
@@ -172,8 +172,8 @@
 }
 
 always_inline void
-_vnet_rewrite_two_headers (vnet_rewrite_header_t * h0,
-			   vnet_rewrite_header_t * h1,
+_vnet_rewrite_two_headers (const vnet_rewrite_header_t * h0,
+			   const vnet_rewrite_header_t * h1,
 			   void *packet0, void *packet1, int most_likely_size)
 {
   /* 0xfefe => poisoned adjacency => crash */
diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c
index ab2567d..4f16b5d 100644
--- a/src/vnet/gre/gre.c
+++ b/src/vnet/gre/gre.c
@@ -276,7 +276,7 @@
 
 static void
 gre4_fixup (vlib_main_t * vm,
-	    ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
+	    const ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
 {
   ip4_header_t *ip0;
 
@@ -290,7 +290,7 @@
 
 static void
 gre6_fixup (vlib_main_t * vm,
-	    ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
+	    const ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
 {
   ip6_header_t *ip0;
 
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 44a6819..a67b061 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2423,7 +2423,7 @@
   b = bufs;
   while (n_left_from >= 8)
     {
-      ip_adjacency_t *adj0, *adj1;
+      const ip_adjacency_t *adj0, *adj1;
       ip4_header_t *ip0, *ip1;
       u32 rw_len0, error0, adj_index0;
       u32 rw_len1, error1, adj_index1;
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 9656621..acf6501 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -1699,7 +1699,7 @@
 
       while (n_left_from >= 4 && n_left_to_next >= 2)
 	{
-	  ip_adjacency_t *adj0, *adj1;
+	  const ip_adjacency_t *adj0, *adj1;
 	  vlib_buffer_t *p0, *p1;
 	  ip6_header_t *ip0, *ip1;
 	  u32 pi0, rw_len0, next0, error0, adj_index0;
diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c
index 15f453a..fc71b5b 100644
--- a/src/vnet/ipip/ipip.c
+++ b/src/vnet/ipip/ipip.c
@@ -104,7 +104,7 @@
 }
 
 static void
-ipip4_fixup (vlib_main_t * vm, ip_adjacency_t * adj, vlib_buffer_t * b,
+ipip4_fixup (vlib_main_t * vm, const ip_adjacency_t * adj, vlib_buffer_t * b,
 	     const void *data)
 {
   ip4_header_t *ip4;
@@ -145,7 +145,7 @@
 }
 
 static void
-ipip6_fixup (vlib_main_t * vm, ip_adjacency_t * adj, vlib_buffer_t * b,
+ipip6_fixup (vlib_main_t * vm, const ip_adjacency_t * adj, vlib_buffer_t * b,
 	     const void *data)
 {
   ip6_header_t *ip6;
diff --git a/src/vnet/ipip/sixrd.c b/src/vnet/ipip/sixrd.c
index d4adf9d..04df0ee 100644
--- a/src/vnet/ipip/sixrd.c
+++ b/src/vnet/ipip/sixrd.c
@@ -85,8 +85,8 @@
 }
 
 static void
-sixrd_fixup (vlib_main_t * vm, ip_adjacency_t * adj, vlib_buffer_t * b0,
-	     const void *data)
+sixrd_fixup (vlib_main_t * vm,
+	     const ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
 {
   ip4_header_t *ip4 = vlib_buffer_get_current (b0);
   ip6_header_t *ip6 = vlib_buffer_get_current (b0) + sizeof (ip4_header_t);
@@ -99,8 +99,8 @@
 }
 
 static void
-ip6ip_fixup (vlib_main_t * vm, ip_adjacency_t * adj, vlib_buffer_t * b0,
-	     const void *data)
+ip6ip_fixup (vlib_main_t * vm,
+	     const ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data)
 {
   const ipip_tunnel_t *t = data;
   ip4_header_t *ip4 = vlib_buffer_get_current (b0);
diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
index 4b5ca17..d9c22a4 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
@@ -206,7 +206,8 @@
 }
 
 static void
-lisp_gpe_increment_stats_counters (lisp_cp_main_t * lcm, ip_adjacency_t * adj,
+lisp_gpe_increment_stats_counters (lisp_cp_main_t * lcm,
+				   const ip_adjacency_t * adj,
 				   vlib_buffer_t * b)
 {
   lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
@@ -273,7 +274,8 @@
 
 static void
 lisp_gpe_fixup (vlib_main_t * vm,
-		ip_adjacency_t * adj, vlib_buffer_t * b, const void *data)
+		const ip_adjacency_t * adj,
+		vlib_buffer_t * b, const void *data)
 {
   lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
 
diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c
index b7bcbfd..3ed77e6 100644
--- a/src/vnet/mpls/mpls_tunnel.c
+++ b/src/vnet/mpls/mpls_tunnel.c
@@ -376,7 +376,7 @@
  */
 static void
 mpls_tunnel_fixup (vlib_main_t *vm,
-                   ip_adjacency_t *adj,
+                   const ip_adjacency_t *adj,
                    vlib_buffer_t *b0,
                    const void*data)
 {