Remove unsed parameter from fib_table_entry_special_add() (only used in FIB tests). The DPO was incorrectly initialised with FIB_PROTO_MAX

Change-Id: I962df9e162e4dfb6837a5ce79ea795d5ff2d7315
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/plugins/ila/ila.c b/src/plugins/ila/ila.c
index edbf301..fd56043 100644
--- a/src/plugins/ila/ila.c
+++ b/src/plugins/ila/ila.c
@@ -736,8 +736,7 @@
 	      fib_table_entry_special_add(0,
 					  &next_hop,
 					  FIB_SOURCE_RR,
-					  FIB_ENTRY_FLAG_NONE,
-					  ADJ_INDEX_INVALID);
+					  FIB_ENTRY_FLAG_NONE);
 	  e->next_hop_child_index =
 	      fib_entry_child_add(e->next_hop_fib_entry_index,
 				  ila_fib_node_type,
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
index 88d7d20..cfc550c 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
@@ -336,9 +336,7 @@
 	  t1->fib_entry_index =
 	    fib_table_entry_special_add (outer_fib_index,
 					 &tun_dst_pfx,
-					 FIB_SOURCE_RR,
-					 FIB_ENTRY_FLAG_NONE,
-					 ADJ_INDEX_INVALID);
+					 FIB_SOURCE_RR, FIB_ENTRY_FLAG_NONE);
 	  t1->sibling_index =
 	    fib_entry_child_add (t1->fib_entry_index,
 				 hm->fib_entry_type, t1 - hm->dst_tunnels);
diff --git a/src/plugins/lb/lb.c b/src/plugins/lb/lb.c
index addc2a4..cc3f853 100644
--- a/src/plugins/lb/lb.c
+++ b/src/plugins/lb/lb.c
@@ -510,8 +510,7 @@
 	fib_table_entry_special_add(0,
 				    &nh,
 				    FIB_SOURCE_RR,
-				    FIB_ENTRY_FLAG_NONE,
-				    ADJ_INDEX_INVALID);
+				    FIB_ENTRY_FLAG_NONE);
     as->next_hop_child_index =
 	fib_entry_child_add(as->next_hop_fib_entry_index,
 			    lbm->fib_node_type,
diff --git a/src/vnet/dhcp/client.c b/src/vnet/dhcp/client.c
index 29749a3..7c3f7f6 100644
--- a/src/vnet/dhcp/client.c
+++ b/src/vnet/dhcp/client.c
@@ -781,8 +781,7 @@
 				      c->sw_if_index),
 				  &all_1s,
 				  FIB_SOURCE_DHCP,
-				  FIB_ENTRY_FLAG_LOCAL,
-				  ADJ_INDEX_INVALID);
+				  FIB_ENTRY_FLAG_LOCAL);
 
      /*
        * enable the interface to RX IPv4 packets
diff --git a/src/vnet/dhcp/dhcp4_proxy_node.c b/src/vnet/dhcp/dhcp4_proxy_node.c
index 1c84881..26e1e65 100644
--- a/src/vnet/dhcp/dhcp4_proxy_node.c
+++ b/src/vnet/dhcp/dhcp4_proxy_node.c
@@ -807,8 +807,7 @@
           fib_table_entry_special_add(rx_fib_index,
                                       &all_1s,
                                       FIB_SOURCE_DHCP,
-                                      FIB_ENTRY_FLAG_LOCAL,
-                                      ADJ_INDEX_INVALID);
+                                      FIB_ENTRY_FLAG_LOCAL);
           fib_table_lock (rx_fib_index, FIB_PROTOCOL_IP4);
       }
   }
diff --git a/src/vnet/fib/fib_bfd.c b/src/vnet/fib/fib_bfd.c
index e5affb8..734ee8c 100644
--- a/src/vnet/fib/fib_bfd.c
+++ b/src/vnet/fib/fib_bfd.c
@@ -109,8 +109,7 @@
             fei = fib_table_entry_special_add(key->fib_index,
                                               &pfx,
                                               FIB_SOURCE_RR,
-                                              FIB_ENTRY_FLAG_NONE,
-                                              ADJ_INDEX_INVALID);
+                                              FIB_ENTRY_FLAG_NONE);
             fib_entry_lock(fei);
 
             fed = fib_entry_delegate_find_or_add(fib_entry_get(fei),
diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c
index cd7d927..70c8790 100644
--- a/src/vnet/fib/fib_path.c
+++ b/src/vnet/fib/fib_path.c
@@ -1621,8 +1621,7 @@
 	fei = fib_table_entry_special_add(path->recursive.fp_tbl_id,
 					  &pfx,
 					  FIB_SOURCE_RR,
-					  FIB_ENTRY_FLAG_NONE,
-					  ADJ_INDEX_INVALID);
+					  FIB_ENTRY_FLAG_NONE);
 
 	path = fib_path_get(path_index);
 	path->fp_via_fib = fei;
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index b31f35e..0938ce9 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -371,23 +371,12 @@
 fib_table_entry_special_add (u32 fib_index,
 			     const fib_prefix_t *prefix,
 			     fib_source_t source,
-			     fib_entry_flag_t flags,
-			     adj_index_t adj_index)
+			     fib_entry_flag_t flags)
 {
     fib_node_index_t fib_entry_index;
     dpo_id_t tmp_dpo = DPO_INVALID;
 
-    if (ADJ_INDEX_INVALID != adj_index)
-    {
-        dpo_set(&tmp_dpo,
-                DPO_ADJACENCY,
-                FIB_PROTOCOL_MAX,
-                adj_index);
-    }
-    else
-    {
-        dpo_copy(&tmp_dpo, drop_dpo_get(fib_proto_to_dpo(prefix->fp_proto)));
-    }
+    dpo_copy(&tmp_dpo, drop_dpo_get(fib_proto_to_dpo(prefix->fp_proto)));
  
     fib_entry_index = fib_table_entry_special_dpo_add(fib_index, prefix, source,
                                                       flags, &tmp_dpo);
diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h
index b310aea..f24d28b 100644
--- a/src/vnet/fib/fib_table.h
+++ b/src/vnet/fib/fib_table.h
@@ -126,14 +126,16 @@
 
 /**
  * @brief
- *  Add a 'special' entry to the FIB that links to the adj passed
+ *  Add a 'special' entry to the FIB.
  *  A special entry is an entry that the FIB is not expect to resolve
  *  via the usual mechanisms (i.e. recurisve or neighbour adj DB lookup).
- *  Instead the client/source provides the adj to link to.
+ *  Instead the will link to a DPO valid for the source and/or the flags.
  *  This add is reference counting per-source. So n 'removes' are required
  *  for n 'adds', if the entry is no longer required.
+ *  If the source needs to provide non-default forwarding use:
+ *  fib_table_entry_special_dpo_add()
  *
-  * @param fib_index
+ * @param fib_index
  *  The index of the FIB
  *
  * @param prefix
@@ -145,17 +147,13 @@
  * @param flags
  *  Flags for the entry.
  *
- * @param adj_index
- *  The adjacency to link to.
- *
  * @return
  *  the index of the fib_entry_t that is created (or exists already).
  */
 extern fib_node_index_t fib_table_entry_special_add(u32 fib_index,
 						    const fib_prefix_t *prefix,
 						    fib_source_t source,
-						    fib_entry_flag_t flags,
-						    adj_index_t adj_index);
+						    fib_entry_flag_t flags);
 
 /**
  * @brief
diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c
index e4a8a70..c58dc5a 100644
--- a/src/vnet/fib/fib_test.c
+++ b/src/vnet/fib/fib_test.c
@@ -1378,8 +1378,8 @@
 	     fib_entry_pool_size());
 
     /*
-     * An EXCLUSIVE route; one where the user (me) provides the exclusive
-     * adjacency through which the route will resovle
+     * An special route; one where the user (me) provides the
+     * adjacency through which the route will resovle by setting the flags
      */
     fib_prefix_t ex_pfx = {
 	.fp_len = 32,
@@ -1393,11 +1393,12 @@
     fib_table_entry_special_add(fib_index,
 				&ex_pfx,
 				FIB_SOURCE_SPECIAL,
-				FIB_ENTRY_FLAG_EXCLUSIVE,
-				locked_ai);
+				FIB_ENTRY_FLAG_LOCAL);
     fei = fib_table_lookup_exact_match(fib_index, &ex_pfx);
-    FIB_TEST((ai == fib_entry_get_adj(fei)),
-	     "Exclusive route links to user adj");
+    dpo = fib_entry_contribute_ip_forwarding(fei);
+    dpo = load_balance_get_bucket(dpo->dpoi_index, 0);
+    FIB_TEST((DPO_RECEIVE == dpo->dpoi_type),
+	     "local interface adj is local");
 
     fib_table_entry_special_remove(fib_index,
 				   &ex_pfx,
@@ -3675,8 +3676,7 @@
     fei = fib_table_entry_special_add(fib_index,
 				      &pfx_4_1_1_1_s_32,
 				      FIB_SOURCE_URPF_EXEMPT,
-				      FIB_ENTRY_FLAG_DROP,
-				      ADJ_INDEX_INVALID);
+				      FIB_ENTRY_FLAG_DROP);
     dpo = fib_entry_contribute_ip_forwarding(fei);
     FIB_TEST(load_balance_is_drop(dpo),
 	     "uRPF exempt 4.1.1.1/32 DROP");
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index b03186e..8e92d85 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -149,8 +149,7 @@
 	fib_table_entry_special_add(fib_table->ft_index,
 				    &prefix,
 				    ip4_specials[ii].ift_source,
-				    ip4_specials[ii].ift_flag,
-				    ADJ_INDEX_INVALID);
+				    ip4_specials[ii].ift_flag);
     }
 
     return (fib_table->ft_index);
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index 0029714..d00f4c5 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -35,8 +35,7 @@
     fib_table_entry_special_add(fib_index,
 				&pfx,
 				FIB_SOURCE_DEFAULT_ROUTE,
-				FIB_ENTRY_FLAG_DROP,
-				ADJ_INDEX_INVALID);
+				FIB_ENTRY_FLAG_DROP);
 
     /*
      * all link local for us
@@ -47,8 +46,7 @@
     fib_table_entry_special_add(fib_index,
 				&pfx,
 				FIB_SOURCE_SPECIAL,
-				FIB_ENTRY_FLAG_LOCAL,
-				ADJ_INDEX_INVALID);
+				FIB_ENTRY_FLAG_LOCAL);
 }
 
 static u32
diff --git a/src/vnet/gre/interface.c b/src/vnet/gre/interface.c
index 91a3899..d574e59 100644
--- a/src/vnet/gre/interface.c
+++ b/src/vnet/gre/interface.c
@@ -427,8 +427,7 @@
       fib_table_entry_special_add(outer_fib_index,
                                   &t->tunnel_dst,
                                   FIB_SOURCE_RR,
-                                  FIB_ENTRY_FLAG_NONE,
-                                  ADJ_INDEX_INVALID);
+                                  FIB_ENTRY_FLAG_NONE);
   t->sibling_index =
       fib_entry_child_add(t->fib_entry_index,
                           FIB_NODE_TYPE_GRE_TUNNEL,
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index e42b363..0f56203 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -732,16 +732,14 @@
                                     &net_pfx,
                                     FIB_SOURCE_INTERFACE,
                                     (FIB_ENTRY_FLAG_DROP |
-                                     FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT),
-                                    ADJ_INDEX_INVALID);
+                                     FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT));
       net_pfx.fp_addr.ip4.as_u32 |= ~im->fib_masks[pfx.fp_len];
       if (net_pfx.fp_addr.ip4.as_u32 != pfx.fp_addr.ip4.as_u32)
         fib_table_entry_special_add(fib_index,
                                     &net_pfx,
                                     FIB_SOURCE_INTERFACE,
                                     (FIB_ENTRY_FLAG_DROP |
-                                     FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT),
-                                    ADJ_INDEX_INVALID);
+                                     FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT));
     }
   else if (pfx.fp_len == 31)
     {
diff --git a/src/vnet/ip/ip4_source_check.c b/src/vnet/ip/ip4_source_check.c
index 63b7594..17a1cb1 100644
--- a/src/vnet/ip/ip4_source_check.c
+++ b/src/vnet/ip/ip4_source_check.c
@@ -509,7 +509,7 @@
       fib_table_entry_special_add (fib_index,
 				   &pfx,
 				   FIB_SOURCE_URPF_EXEMPT,
-				   FIB_ENTRY_FLAG_DROP, ADJ_INDEX_INVALID);
+				   FIB_ENTRY_FLAG_DROP);
     }
   else
     {
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
index 444bfe1..dd6c6fd 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
@@ -179,8 +179,7 @@
       lgt->fib_entry_index = fib_table_entry_special_add (rloc_fib_index,
 							  &pfx,
 							  FIB_SOURCE_RR,
-							  FIB_ENTRY_FLAG_NONE,
-							  ADJ_INDEX_INVALID);
+							  FIB_ENTRY_FLAG_NONE);
 
       hash_set_mem (lisp_gpe_tunnel_db, &lgt->key,
 		    (lgt - lisp_gpe_tunnel_pool));
diff --git a/src/vnet/map/map.c b/src/vnet/map/map.c
index 811a0ab..6a707df 100644
--- a/src/vnet/map/map.c
+++ b/src/vnet/map/map.c
@@ -518,9 +518,7 @@
 
   pr->fei = fib_table_entry_special_add (0,	// default fib
 					 &pfx,
-					 FIB_SOURCE_RR,
-					 FIB_ENTRY_FLAG_NONE,
-					 ADJ_INDEX_INVALID);
+					 FIB_SOURCE_RR, FIB_ENTRY_FLAG_NONE);
   pr->sibling = fib_entry_child_add (pr->fei, FIB_NODE_TYPE_MAP_E, proto);
   map_stack (pr);
 }
diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c
index 61cb13c..1b3df2a 100644
--- a/src/vnet/vxlan/vxlan.c
+++ b/src/vnet/vxlan/vxlan.c
@@ -486,7 +486,7 @@
           vtep_addr_ref(&t->src);
           t->fib_entry_index = fib_table_entry_special_add
             (t->encap_fib_index, &tun_dst_pfx, FIB_SOURCE_RR,
-	     FIB_ENTRY_FLAG_NONE, ADJ_INDEX_INVALID);
+	     FIB_ENTRY_FLAG_NONE);
           t->sibling_index = fib_entry_child_add
             (t->fib_entry_index, FIB_NODE_TYPE_VXLAN_TUNNEL, t - vxm->tunnels);
           vxlan_tunnel_restack_dpo(t);