- inline the FIB lookup function; this requires access to the bihash, so for files that use more than one type this casues problems. those files that include ip6_fib.h unnecessarily have been updated
- better use of the feature arcs. ip6-lookup and interface-output are now sentinels (end-node-index in the cm speak) rather than enabled features.
Change-Id: I9d1375fee63f7dbb2d327da6124d8e60b63367ec
Signed-off-by: Neale Ranns <nranns@cisco.com>
#include <ioam/lib-vxlan-gpe/vxlan_gpe_ioam_packet.h>
#include <ioam/lib-vxlan-gpe/vxlan_gpe_ioam.h>
#include <ioam/lib-vxlan-gpe/vxlan_gpe_ioam_util.h>
-#include <vnet/fib/ip6_fib.h>
#include <vnet/fib/ip4_fib.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/vxlan-gpe/vxlan_gpe_packet.h>
#include <vnet/ip/format.h>
#include <ioam/lib-vxlan-gpe/vxlan_gpe_ioam.h>
-#include <vnet/fib/ip6_fib.h>
+#include <vnet/dpo/load_balance.h>
#include <vnet/fib/ip4_fib.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/pg/pg.h>
#include <vnet/dhcp/dhcp_proxy.h>
#include <vnet/dhcp/dhcp6_packet.h>
-#include <vnet/fib/ip6_fib.h>
#include <vnet/mfib/mfib_table.h>
#include <vnet/mfib/ip6_mfib.h>
+#include <vnet/fib/fib.h>
static char * dhcpv6_proxy_error_strings[] = {
#define dhcpv6_proxy_error(n,s) s,
format_dhcp6_proxy_server (u8 * s, va_list * args)
{
dhcp_proxy_t * proxy = va_arg (*args, dhcp_proxy_t *);
- ip6_fib_t *server_fib;
+ fib_table_t *server_fib;
dhcp_server_t *server;
ip6_mfib_t *rx_fib;
vec_foreach(server, proxy->dhcp_servers)
{
- server_fib = ip6_fib_get(server->server_fib_index);
+ server_fib = fib_table_get(server->server_fib_index,
+ FIB_PROTOCOL_IP6);
s = format (s, "%u,%U ",
- server_fib->table_id,
+ server_fib->ft_table_id,
format_ip46_address, &server->dhcp_server, IP46_TYPE_ANY);
}
#include <vnet/fib/fib_table.h>
#include <vnet/fib/fib_entry.h>
-#include <vnet/fib/ip4_fib.h>
-#include <vnet/fib/ip6_fib.h>
#endif
compute_prefix_lengths_in_search_order (table);
}
-u32
-ip6_fib_table_fwding_lookup (ip6_main_t * im,
- u32 fib_index,
- const ip6_address_t * dst)
-{
- const ip6_fib_table_instance_t *table;
- int i, len;
- int rv;
- BVT(clib_bihash_kv) kv, value;
- u64 fib;
-
- table = &ip6_main.ip6_table[IP6_FIB_TABLE_FWDING];
- len = vec_len (table->prefix_lengths_in_search_order);
-
- kv.key[0] = dst->as_u64[0];
- kv.key[1] = dst->as_u64[1];
- fib = ((u64)((fib_index))<<32);
-
- for (i = 0; i < len; i++)
- {
- int dst_address_length = table->prefix_lengths_in_search_order[i];
- ip6_address_t * mask = &ip6_main.fib_masks[dst_address_length];
-
- ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
- //As lengths are decreasing, masks are increasingly specific.
- kv.key[0] &= mask->as_u64[0];
- kv.key[1] &= mask->as_u64[1];
- kv.key[2] = fib | dst_address_length;
-
- rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
- if (rv == 0)
- return value.value;
- }
-
- /* default route is always present */
- ASSERT(0);
- return 0;
-}
-
u32 ip6_fib_table_fwding_lookup_with_if_index (ip6_main_t * im,
u32 sw_if_index,
const ip6_address_t * dst)
u32 ip6_fib_table_fwding_lookup_with_if_index(ip6_main_t * im,
u32 sw_if_index,
const ip6_address_t * dst);
-u32 ip6_fib_table_fwding_lookup(ip6_main_t * im,
- u32 fib_index,
- const ip6_address_t * dst);
/**
* @brief Walk all entries in a FIB table
fib_table_walk_fn_t fn,
void *ctx);
+always_inline u32
+ip6_fib_table_fwding_lookup (ip6_main_t * im,
+ u32 fib_index,
+ const ip6_address_t * dst)
+{
+ const ip6_fib_table_instance_t *table;
+ int i, len;
+ int rv;
+ BVT(clib_bihash_kv) kv, value;
+ u64 fib;
+
+ table = &ip6_main.ip6_table[IP6_FIB_TABLE_FWDING];
+ len = vec_len (table->prefix_lengths_in_search_order);
+
+ kv.key[0] = dst->as_u64[0];
+ kv.key[1] = dst->as_u64[1];
+ fib = ((u64)((fib_index))<<32);
+
+ for (i = 0; i < len; i++)
+ {
+ int dst_address_length = table->prefix_lengths_in_search_order[i];
+ ip6_address_t * mask = &ip6_main.fib_masks[dst_address_length];
+
+ ASSERT(dst_address_length >= 0 && dst_address_length <= 128);
+ //As lengths are decreasing, masks are increasingly specific.
+ kv.key[0] &= mask->as_u64[0];
+ kv.key[1] &= mask->as_u64[1];
+ kv.key[2] = fib | dst_address_length;
+
+ rv = BV(clib_bihash_search_inline_2)(&table->ip6_hash, &kv, &value);
+ if (rv == 0)
+ return value.value;
+ }
+
+ /* default route is always present */
+ ASSERT(0);
+ return 0;
+}
+
/**
* @brief return the DPO that the LB stacks on.
*/
return;
}
- vnet_feature_enable_disable ("ip6-unicast", "ip6-lookup", sw_if_index,
- is_enable, 0, 0);
-
- vnet_feature_enable_disable ("ip6-multicast", "ip6-mfib-forward-lookup",
- sw_if_index, is_enable, 0, 0);
+ vnet_feature_enable_disable ("ip6-unicast", "ip6-drop", sw_if_index,
+ !is_enable, 0, 0);
+ vnet_feature_enable_disable ("ip6-multicast", "ip6-drop", sw_if_index,
+ !is_enable, 0, 0);
}
/* get first interface address */
.runs_before = VNET_FEATURES ("ip6-lookup"),
};
-VNET_FEATURE_INIT (ip6_lookup, static) =
+VNET_FEATURE_INIT (ip6_drop, static) =
{
.arc_name = "ip6-unicast",
- .node_name = "ip6-lookup",
- .runs_before = VNET_FEATURES ("ip6-drop"),
+ .node_name = "ip6-drop",
+ .runs_before = VNET_FEATURES ("ip6-lookup"),
};
-VNET_FEATURE_INIT (ip6_drop, static) =
+VNET_FEATURE_INIT (ip6_lookup, static) =
{
.arc_name = "ip6-unicast",
- .node_name = "ip6-drop",
+ .node_name = "ip6-lookup",
.runs_before = 0, /*last feature*/
};
.runs_before = VNET_FEATURES ("ip6-mfib-forward-lookup"),
};
-VNET_FEATURE_INIT (ip6_mc_lookup, static) = {
+VNET_FEATURE_INIT (ip6_drop_mc, static) = {
.arc_name = "ip6-multicast",
- .node_name = "ip6-mfib-forward-lookup",
- .runs_before = VNET_FEATURES ("ip6-drop"),
+ .node_name = "ip6-drop",
+ .runs_before = VNET_FEATURES ("ip6-mfib-forward-lookup"),
};
-VNET_FEATURE_INIT (ip6_drop_mc, static) = {
+VNET_FEATURE_INIT (ip6_mc_lookup, static) = {
.arc_name = "ip6-multicast",
- .node_name = "ip6-drop",
+ .node_name = "ip6-mfib-forward-lookup",
.runs_before = 0, /* last feature */
};
vnet_feature_enable_disable ("ip6-multicast", "ip6-drop", sw_if_index,
is_add, 0, 0);
- vnet_feature_enable_disable ("ip6-output", "interface-output", sw_if_index,
- is_add, 0, 0);
-
return /* no error */ 0;
}
else if (unformat (line_input, "encap-vrf-id %d", &tmp))
{
if (ipv6_set)
- encap_fib_index = ip6_fib_index_from_table_id (tmp);
+ encap_fib_index = fib_table_find (FIB_PROTOCOL_IP6, tmp);
else
- encap_fib_index = ip4_fib_index_from_table_id (tmp);
+ encap_fib_index = fib_table_find (FIB_PROTOCOL_IP4, tmp);
if (encap_fib_index == ~0)
{
else if (unformat (line_input, "decap-vrf-id %d", &tmp))
{
if (ipv6_set)
- decap_fib_index = ip6_fib_index_from_table_id (tmp);
+ decap_fib_index = fib_table_find (FIB_PROTOCOL_IP6, tmp);
else
- decap_fib_index = ip4_fib_index_from_table_id (tmp);
+ decap_fib_index = fib_table_find (FIB_PROTOCOL_IP4, tmp);
if (decap_fib_index == ~0)
{
#include <vnet/l2/l2_bd.h>
#include <vpp/api/vpe_msg_enum.h>
#include <vnet/span/span.h>
-#include <vnet/fib/ip6_fib.h>
-#include <vnet/fib/ip4_fib.h>
#include <vnet/fib/fib_api.h>
#include <vnet/dpo/drop_dpo.h>
#include <vnet/dpo/receive_dpo.h>