L2 over MPLS

[support for VPWS/VPLS]
- switch to using dpo_proto_t rather than fib_protocol_t in fib_paths so that we can describe L2 paths
- VLIB nodes to handle pop/push of MPLS labels to L2

Change-Id: Id050d06a11fd2c9c1c81ce5a0654e6c5ae6afa6e
Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:
Neale Ranns
2017-05-24 09:15:43 -07:00
committed by Florin Coras
parent b60f4965bf
commit da78f957e4
62 changed files with 889 additions and 556 deletions
+1 -1
View File
@@ -534,7 +534,7 @@ int vnet_gtpu_add_del_tunnel
fib_node_index_t mfei;
adj_index_t ai;
fib_route_path_t path = {
.frp_proto = fp,
.frp_proto = fib_proto_to_dpo (fp),
.frp_addr = zero_addr,
.frp_sw_if_index = 0xffffffff,
.frp_fib_index = ~0,
+1 -1
View File
@@ -135,7 +135,7 @@ snat_add_del_addr_to_fib (ip4_address_t * addr, u8 p_len, u32 sw_if_index,
(FIB_ENTRY_FLAG_CONNECTED |
FIB_ENTRY_FLAG_LOCAL |
FIB_ENTRY_FLAG_EXCLUSIVE),
FIB_PROTOCOL_IP4,
DPO_PROTO_IP4,
NULL,
sw_if_index,
~0,
+9 -8
View File
@@ -7498,7 +7498,7 @@ api_mpls_route_add_del (vat_main_t * vam)
mpls_label_t *next_hop_out_label_stack = NULL;
mpls_label_t local_label = MPLS_LABEL_INVALID;
u8 is_eos = 0;
u8 next_hop_proto_is_ip4 = 1;
dpo_proto_t next_hop_proto = DPO_PROTO_IP4;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -7517,13 +7517,13 @@ api_mpls_route_add_del (vat_main_t * vam)
&v4_next_hop_address))
{
next_hop_set = 1;
next_hop_proto_is_ip4 = 1;
next_hop_proto = DPO_PROTO_IP4;
}
else if (unformat (i, "via %U", unformat_ip6_address,
&v6_next_hop_address))
{
next_hop_set = 1;
next_hop_proto_is_ip4 = 0;
next_hop_proto = DPO_PROTO_IP6;
}
else if (unformat (i, "weight %d", &next_hop_weight))
;
@@ -7548,12 +7548,12 @@ api_mpls_route_add_del (vat_main_t * vam)
else if (unformat (i, "lookup-in-ip4-table %d", &next_hop_table_id))
{
next_hop_set = 1;
next_hop_proto_is_ip4 = 1;
next_hop_proto = DPO_PROTO_IP4;
}
else if (unformat (i, "lookup-in-ip6-table %d", &next_hop_table_id))
{
next_hop_set = 1;
next_hop_proto_is_ip4 = 0;
next_hop_proto = DPO_PROTO_IP6;
}
else if (unformat (i, "next-hop-table %d", &next_hop_table_id))
;
@@ -7599,7 +7599,7 @@ api_mpls_route_add_del (vat_main_t * vam)
mp->mr_create_table_if_needed = create_table_if_needed;
mp->mr_is_add = is_add;
mp->mr_next_hop_proto_is_ip4 = next_hop_proto_is_ip4;
mp->mr_next_hop_proto = next_hop_proto;
mp->mr_is_classify = is_classify;
mp->mr_is_multipath = is_multipath;
mp->mr_is_resolve_host = resolve_host;
@@ -7622,13 +7622,14 @@ api_mpls_route_add_del (vat_main_t * vam)
if (next_hop_set)
{
if (next_hop_proto_is_ip4)
if (DPO_PROTO_IP4 == next_hop_proto)
{
clib_memcpy (mp->mr_next_hop,
&v4_next_hop_address,
sizeof (v4_next_hop_address));
}
else
else if (DPO_PROTO_IP6 == next_hop_proto)
{
clib_memcpy (mp->mr_next_hop,
&v6_next_hop_address,
+3 -3
View File
@@ -296,7 +296,7 @@ int dhcp_client_for_us (u32 bi, vlib_buffer_t * b,
&all_0s,
FIB_SOURCE_DHCP,
FIB_ENTRY_FLAG_NONE,
FIB_PROTOCOL_IP4,
DPO_PROTO_IP4,
&nh,
c->sw_if_index,
~0,
@@ -605,7 +605,7 @@ dhcp_bound_state (dhcp_client_main_t * dcm, dhcp_client_t * c, f64 now)
c->sw_if_index),
&all_0s,
FIB_SOURCE_DHCP,
FIB_PROTOCOL_IP4,
DPO_PROTO_IP4,
&nh,
c->sw_if_index,
~0,
@@ -900,7 +900,7 @@ int dhcp_client_add_del (dhcp_client_add_del_args_t * a)
c->sw_if_index),
&all_0s,
FIB_SOURCE_DHCP,
FIB_PROTOCOL_IP4,
DPO_PROTO_IP4,
&nh,
c->sw_if_index,
~0,
+1 -1
View File
@@ -857,7 +857,7 @@ dhcp6_proxy_set_server (ip46_address_t *addr,
else
{
const fib_route_path_t path_for_us = {
.frp_proto = FIB_PROTOCOL_IP6,
.frp_proto = DPO_PROTO_IP6,
.frp_addr = zero_addr,
.frp_sw_if_index = 0xffffffff,
.frp_fib_index = ~0,
+19
View File
@@ -109,6 +109,25 @@ vnet_link_to_dpo_proto (vnet_link_t linkt)
return (0);
}
vnet_link_t
dpo_proto_to_link (dpo_proto_t dp)
{
switch (dp)
{
case DPO_PROTO_IP6:
return (VNET_LINK_IP6);
case DPO_PROTO_IP4:
return (VNET_LINK_IP4);
case DPO_PROTO_MPLS:
return (VNET_LINK_MPLS);
case DPO_PROTO_ETHERNET:
return (VNET_LINK_ETHERNET);
case DPO_PROTO_NSH:
return (VNET_LINK_NSH);
}
return (~0);
}
u8 *
format_dpo_type (u8 * s, va_list * args)
{
+6 -5
View File
@@ -59,14 +59,10 @@ typedef u32 index_t;
*/
typedef enum dpo_proto_t_
{
#if CLIB_DEBUG > 0
DPO_PROTO_IP4 = 1,
#else
DPO_PROTO_IP4 = 0,
#endif
DPO_PROTO_IP6,
DPO_PROTO_ETHERNET,
DPO_PROTO_MPLS,
DPO_PROTO_ETHERNET,
DPO_PROTO_NSH,
} __attribute__((packed)) dpo_proto_t;
@@ -272,6 +268,11 @@ extern u8 *format_dpo_type(u8 * s, va_list * args);
*/
extern u8 *format_dpo_proto(u8 * s, va_list * args);
/**
* @brief format a DPO protocol
*/
extern vnet_link_t dpo_proto_to_link(dpo_proto_t dp);
/**
* @brief
* Set and stack a DPO.
+30
View File
@@ -195,11 +195,17 @@ const static char* const interface_dpo_ip6_nodes[] =
"interface-dpo-ip4",
NULL,
};
const static char* const interface_dpo_l2_nodes[] =
{
"interface-dpo-l2",
NULL,
};
const static char* const * const interface_dpo_nodes[DPO_PROTO_NUM] =
{
[DPO_PROTO_IP4] = interface_dpo_ip4_nodes,
[DPO_PROTO_IP6] = interface_dpo_ip6_nodes,
[DPO_PROTO_ETHERNET] = interface_dpo_l2_nodes,
[DPO_PROTO_MPLS] = NULL,
};
@@ -382,6 +388,14 @@ interface_dpo_ip6 (vlib_main_t * vm,
return (interface_dpo_inline(vm, node, from_frame));
}
static uword
interface_dpo_l2 (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame)
{
return (interface_dpo_inline(vm, node, from_frame));
}
VLIB_REGISTER_NODE (interface_dpo_ip4_node) = {
.function = interface_dpo_ip4,
.name = "interface-dpo-ip4",
@@ -414,3 +428,19 @@ VLIB_REGISTER_NODE (interface_dpo_ip6_node) = {
VLIB_NODE_FUNCTION_MULTIARCH (interface_dpo_ip6_node,
interface_dpo_ip6)
VLIB_REGISTER_NODE (interface_dpo_l2_node) = {
.function = interface_dpo_l2,
.name = "interface-dpo-l2",
.vector_size = sizeof (u32),
.format_trace = format_interface_dpo_trace,
.n_next_nodes = 2,
.next_nodes = {
[INTERFACE_DPO_DROP] = "error-drop",
[INTERFACE_DPO_INPUT] = "l2-input",
},
};
VLIB_NODE_FUNCTION_MULTIARCH (interface_dpo_l2_node,
interface_dpo_l2)
+41 -4
View File
@@ -192,7 +192,8 @@ mpls_label_imposition_inline (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * from_frame,
u8 payload_is_ip4,
u8 payload_is_ip6)
u8 payload_is_ip6,
u8 payload_is_ethernet)
{
u32 n_left_from, next_index, * from, * to_next;
@@ -320,6 +321,13 @@ mpls_label_imposition_inline (vlib_main_t * vm,
ttl2 = ip2->hop_limit;
ttl3 = ip3->hop_limit;
}
else if (payload_is_ethernet)
{
/*
* nothing to chang ein the ethernet header
*/
ttl0 = ttl1 = ttl2 = ttl3 = 255;
}
else
{
/*
@@ -551,7 +559,7 @@ mpls_label_imposition (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
return (mpls_label_imposition_inline(vm, node, frame, 0, 0));
return (mpls_label_imposition_inline(vm, node, frame, 0, 0, 0));
}
VLIB_REGISTER_NODE (mpls_label_imposition_node) = {
@@ -573,7 +581,7 @@ ip4_mpls_label_imposition (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
return (mpls_label_imposition_inline(vm, node, frame, 1, 0));
return (mpls_label_imposition_inline(vm, node, frame, 1, 0, 0));
}
VLIB_REGISTER_NODE (ip4_mpls_label_imposition_node) = {
@@ -595,7 +603,7 @@ ip6_mpls_label_imposition (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
return (mpls_label_imposition_inline(vm, node, frame, 0, 1));
return (mpls_label_imposition_inline(vm, node, frame, 0, 1, 0));
}
VLIB_REGISTER_NODE (ip6_mpls_label_imposition_node) = {
@@ -612,6 +620,28 @@ VLIB_REGISTER_NODE (ip6_mpls_label_imposition_node) = {
VLIB_NODE_FUNCTION_MULTIARCH (ip6_mpls_label_imposition_node,
ip6_mpls_label_imposition)
static uword
ethernet_mpls_label_imposition (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
return (mpls_label_imposition_inline(vm, node, frame, 0, 0, 1));
}
VLIB_REGISTER_NODE (ethernet_mpls_label_imposition_node) = {
.function = ethernet_mpls_label_imposition,
.name = "ethernet-mpls-label-imposition",
.vector_size = sizeof (u32),
.format_trace = format_mpls_label_imposition_trace,
.n_next_nodes = 1,
.next_nodes = {
[0] = "error-drop",
}
};
VLIB_NODE_FUNCTION_MULTIARCH (ethernet_mpls_label_imposition_node,
ethernet_mpls_label_imposition)
static void
mpls_label_dpo_mem_show (void)
{
@@ -643,11 +673,18 @@ const static char* const mpls_label_imp_mpls_nodes[] =
"mpls-label-imposition",
NULL,
};
const static char* const mpls_label_imp_ethernet_nodes[] =
{
"ethernet-mpls-label-imposition",
NULL,
};
const static char* const * const mpls_label_imp_nodes[DPO_PROTO_NUM] =
{
[DPO_PROTO_IP4] = mpls_label_imp_ip4_nodes,
[DPO_PROTO_IP6] = mpls_label_imp_ip6_nodes,
[DPO_PROTO_MPLS] = mpls_label_imp_mpls_nodes,
[DPO_PROTO_ETHERNET] = mpls_label_imp_ethernet_nodes,
};
+2 -2
View File
@@ -588,7 +588,7 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm,
e->fib_entry_index =
fib_table_entry_path_add (fib_index, &pfx, FIB_SOURCE_ADJ,
FIB_ENTRY_FLAG_ATTACHED,
FIB_PROTOCOL_IP4, &pfx.fp_addr,
DPO_PROTO_IP4, &pfx.fp_addr,
e->sw_if_index, ~0, 1, NULL,
FIB_ROUTE_PATH_FLAG_NONE);
}
@@ -1621,7 +1621,7 @@ arp_entry_free (ethernet_arp_interface_t * eai, ethernet_arp_ip4_entry_t * e)
fib_table_entry_path_remove (fib_index, &pfx,
FIB_SOURCE_ADJ,
FIB_PROTOCOL_IP4,
DPO_PROTO_IP4,
&pfx.fp_addr,
e->sw_if_index, ~0, 1,
FIB_ROUTE_PATH_FLAG_NONE);
+2 -2
View File
@@ -21,7 +21,7 @@ int
add_del_route_check (fib_protocol_t table_proto,
u32 table_id,
u32 next_hop_sw_if_index,
fib_protocol_t next_hop_table_proto,
dpo_proto_t next_hop_table_proto,
u32 next_hop_table_id,
u8 create_missing_tables,
u8 is_rpf_id,
@@ -43,7 +43,7 @@ add_del_route_t_handler (u8 is_multipath,
u8 is_rpf_id,
u32 fib_index,
const fib_prefix_t * prefix,
u8 next_hop_proto_is_ip4,
dpo_proto_t next_hop_proto,
const ip46_address_t * next_hop,
u32 next_hop_sw_if_index,
u8 next_hop_fib_index,
+7 -1
View File
@@ -58,12 +58,18 @@ fib_entry_get_index (const fib_entry_t * fib_entry)
return (fib_entry - fib_entry_pool);
}
static fib_protocol_t
fib_protocol_t
fib_entry_get_proto (const fib_entry_t * fib_entry)
{
return (fib_entry->fe_prefix.fp_proto);
}
dpo_proto_t
fib_entry_get_dpo_proto (const fib_entry_t * fib_entry)
{
return (fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto));
}
fib_forward_chain_type_t
fib_entry_get_default_chain_type (const fib_entry_t *fib_entry)
{
+4 -12
View File
@@ -29,12 +29,6 @@
*/
static fib_entry_src_vft_t fib_entry_src_vft[FIB_SOURCE_MAX];
static fib_protocol_t
fib_entry_get_proto (const fib_entry_t * fib_entry)
{
return (fib_entry->fe_prefix.fp_proto);
}
void
fib_entry_src_register (fib_source_t source,
const fib_entry_src_vft_t *vft)
@@ -861,7 +855,7 @@ fib_entry_src_action_add (fib_entry_t *fib_entry,
fib_entry_src_vft[source].fesv_add(esrc,
fib_entry,
flags,
fib_entry_get_proto(fib_entry),
fib_entry_get_dpo_proto(fib_entry),
dpo);
}
@@ -914,7 +908,7 @@ fib_entry_src_action_update (fib_entry_t *fib_entry,
fib_entry_src_vft[source].fesv_add(esrc,
fib_entry,
flags,
fib_entry_get_proto(fib_entry),
fib_entry_get_dpo_proto(fib_entry),
dpo);
}
@@ -1106,8 +1100,7 @@ fib_entry_src_action_path_add (fib_entry_t *fib_entry,
source,
flags,
drop_dpo_get(
fib_proto_to_dpo(
fib_entry_get_proto(fib_entry))));
fib_entry_get_dpo_proto(fib_entry)));
esrc = fib_entry_src_find(fib_entry, source, NULL);
}
@@ -1166,8 +1159,7 @@ fib_entry_src_action_path_swap (fib_entry_t *fib_entry,
source,
flags,
drop_dpo_get(
fib_proto_to_dpo(
fib_entry_get_proto(fib_entry))));
fib_entry_get_dpo_proto(fib_entry)));
esrc = fib_entry_src_find(fib_entry, source, NULL);
}
+3 -1
View File
@@ -73,7 +73,7 @@ typedef void (*fib_entry_src_deactivate_t)(fib_entry_src_t *src,
typedef void (*fib_entry_src_add_t)(fib_entry_src_t *src,
const fib_entry_t *entry,
fib_entry_flag_t flags,
fib_protocol_t proto,
dpo_proto_t proto,
const dpo_id_t *dpo);
/**
@@ -277,6 +277,8 @@ extern void fib_entry_src_mk_lb (fib_entry_t *fib_entry,
fib_forward_chain_type_t fct,
dpo_id_t *dpo_lb);
extern fib_protocol_t fib_entry_get_proto(const fib_entry_t * fib_entry);
extern dpo_proto_t fib_entry_get_dpo_proto(const fib_entry_t * fib_entry);
/*
* Per-source registration. declared here so we save a separate .h file for each
+1 -1
View File
@@ -131,7 +131,7 @@ static void
fib_entry_src_api_add (fib_entry_src_t *src,
const fib_entry_t *entry,
fib_entry_flag_t flags,
fib_protocol_t proto,
dpo_proto_t proto,
const dpo_id_t *dpo)
{
if (FIB_ENTRY_FLAG_NONE != flags)
+1 -1
View File
@@ -35,7 +35,7 @@ static void
fib_entry_src_default_route_add (fib_entry_src_t *src,
const fib_entry_t *entry,
fib_entry_flag_t flags,
fib_protocol_t proto,
dpo_proto_t proto,
const dpo_id_t *dpo)
{
src->fes_pl = fib_path_list_create_special(proto,
+1 -1
View File
@@ -35,7 +35,7 @@ static void
fib_entry_src_interface_add (fib_entry_src_t *src,
const fib_entry_t *entry,
fib_entry_flag_t flags,
fib_protocol_t proto,
dpo_proto_t proto,
const dpo_id_t *dpo)
{
src->fes_pl = fib_path_list_create_special(
+4 -4
View File
@@ -79,10 +79,10 @@ fib_entry_src_lisp_path_remove (fib_entry_src_t *src,
static void
fib_entry_src_lisp_add (fib_entry_src_t *src,
const fib_entry_t *entry,
fib_entry_flag_t flags,
fib_protocol_t proto,
const dpo_id_t *dpo)
const fib_entry_t *entry,
fib_entry_flag_t flags,
dpo_proto_t proto,
const dpo_id_t *dpo)
{
if (FIB_ENTRY_FLAG_NONE != flags)
{
+2 -2
View File
@@ -57,13 +57,13 @@ static void
fib_entry_src_mpls_add (fib_entry_src_t *src,
const fib_entry_t *entry,
fib_entry_flag_t flags,
fib_protocol_t proto,
dpo_proto_t proto,
const dpo_id_t *dpo)
{
src->fes_pl =
fib_path_list_create_special(proto,
FIB_PATH_LIST_FLAG_DROP,
drop_dpo_get(fib_proto_to_dpo(proto)));
drop_dpo_get(proto));
}
static void
+7 -8
View File
@@ -35,7 +35,7 @@ fib_entry_src_rr_resolve_via_connected (fib_entry_src_t *src,
const fib_entry_t *cover)
{
const fib_route_path_t path = {
.frp_proto = fib_entry->fe_prefix.fp_proto,
.frp_proto = fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto),
.frp_addr = fib_entry->fe_prefix.fp_addr,
.frp_sw_if_index = fib_entry_get_resolving_interface(
fib_entry_get_index(cover)),
@@ -90,18 +90,17 @@ fib_entry_src_rr_use_covers_pl (fib_entry_src_t *src,
const fib_entry_t *cover)
{
fib_node_index_t *entries = NULL;
fib_protocol_t proto;
dpo_proto_t proto;
proto = fib_entry->fe_prefix.fp_proto;
proto = fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto);
vec_add1(entries, fib_entry_get_index(fib_entry));
if (fib_path_list_recursive_loop_detect(cover->fe_parent,
&entries))
{
src->fes_pl = fib_path_list_create_special(
proto,
FIB_PATH_LIST_FLAG_DROP,
drop_dpo_get(fib_proto_to_dpo(proto)));
src->fes_pl = fib_path_list_create_special(proto,
FIB_PATH_LIST_FLAG_DROP,
drop_dpo_get(proto));
}
else
{
@@ -126,7 +125,7 @@ fib_entry_src_rr_activate (fib_entry_src_t *src,
*/
if (FIB_PROTOCOL_MPLS == fib_entry->fe_prefix.fp_proto)
{
src->fes_pl = fib_path_list_create_special(FIB_PROTOCOL_MPLS,
src->fes_pl = fib_path_list_create_special(DPO_PROTO_MPLS,
FIB_PATH_LIST_FLAG_DROP,
NULL);
fib_path_list_lock(src->fes_pl);
+1 -1
View File
@@ -43,7 +43,7 @@ static void
fib_entry_src_special_add (fib_entry_src_t *src,
const fib_entry_t *entry,
fib_entry_flag_t flags,
fib_protocol_t proto,
dpo_proto_t proto,
const dpo_id_t *dpo)
{
src->fes_pl =
+35 -44
View File
@@ -193,7 +193,7 @@ typedef struct fib_path_t_ {
* next-hop's address. We can't derive this from the address itself
* since the address can be all zeros
*/
fib_protocol_t fp_nh_proto;
dpo_proto_t fp_nh_proto;
/**
* UCMP [unnormalised] weigth
@@ -381,7 +381,7 @@ format_fib_path (u8 * s, va_list * args)
s = format (s, " index:%d ", fib_path_get_index(path));
s = format (s, "pl-index:%d ", path->fp_pl_index);
s = format (s, "%U ", format_fib_protocol, path->fp_nh_proto);
s = format (s, "%U ", format_dpo_proto, path->fp_nh_proto);
s = format (s, "weight=%d ", path->fp_weight);
s = format (s, "pref=%d ", path->fp_preference);
s = format (s, "%s: ", fib_path_type_names[path->fp_type]);
@@ -454,7 +454,7 @@ format_fib_path (u8 * s, va_list * args)
}
break;
case FIB_PATH_TYPE_RECURSIVE:
if (FIB_PROTOCOL_MPLS == path->fp_nh_proto)
if (DPO_PROTO_MPLS == path->fp_nh_proto)
{
s = format (s, "via %U %U",
format_mpls_unicast_label,
@@ -552,14 +552,14 @@ fib_path_attached_next_hop_get_adj (fib_path_t *path,
* the subnet address (the attached route) links to the
* auto-adj (see below), we want that adj here too.
*/
return (adj_nbr_add_or_lock(path->fp_nh_proto,
return (adj_nbr_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
link,
&zero_addr,
path->attached_next_hop.fp_interface));
}
else
{
return (adj_nbr_add_or_lock(path->fp_nh_proto,
return (adj_nbr_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
link,
&path->attached_next_hop.fp_nh,
path->attached_next_hop.fp_interface));
@@ -575,10 +575,10 @@ fib_path_attached_next_hop_set (fib_path_t *path)
*/
dpo_set(&path->fp_dpo,
DPO_ADJACENCY,
fib_proto_to_dpo(path->fp_nh_proto),
path->fp_nh_proto,
fib_path_attached_next_hop_get_adj(
path,
fib_proto_to_link(path->fp_nh_proto)));
dpo_proto_to_link(path->fp_nh_proto)));
/*
* become a child of the adjacency so we receive updates
@@ -607,14 +607,14 @@ fib_path_attached_get_adj (fib_path_t *path,
* point-2-point interfaces do not require a glean, since
* there is nothing to ARP. Install a rewrite/nbr adj instead
*/
return (adj_nbr_add_or_lock(path->fp_nh_proto,
return (adj_nbr_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
link,
&zero_addr,
path->attached.fp_interface));
}
else
{
return (adj_glean_add_or_lock(path->fp_nh_proto,
return (adj_glean_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
path->attached.fp_interface,
NULL));
}
@@ -650,7 +650,7 @@ fib_path_recursive_adj_update (fib_path_t *path,
if (path->fp_oper_flags & FIB_PATH_OPER_FLAG_RECURSIVE_LOOP)
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
dpo_copy(&via_dpo, drop_dpo_get(fib_proto_to_dpo(path->fp_nh_proto)));
dpo_copy(&via_dpo, drop_dpo_get(path->fp_nh_proto));
}
else if (path->fp_cfg_flags & FIB_PATH_CFG_FLAG_RESOLVE_HOST)
{
@@ -668,7 +668,7 @@ fib_path_recursive_adj_update (fib_path_t *path,
if (fib_entry_get_best_source(path->fp_via_fib) >= FIB_SOURCE_RR)
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
dpo_copy(&via_dpo, drop_dpo_get(fib_proto_to_dpo(path->fp_nh_proto)));
dpo_copy(&via_dpo, drop_dpo_get(path->fp_nh_proto));
/*
* PIC edge trigger. let the load-balance maps know
@@ -685,7 +685,7 @@ fib_path_recursive_adj_update (fib_path_t *path,
if (!(FIB_ENTRY_FLAG_ATTACHED & fib_entry_get_flags(path->fp_via_fib)))
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
dpo_copy(&via_dpo, drop_dpo_get(fib_proto_to_dpo(path->fp_nh_proto)));
dpo_copy(&via_dpo, drop_dpo_get(path->fp_nh_proto));
/*
* PIC edge trigger. let the load-balance maps know
@@ -699,7 +699,7 @@ fib_path_recursive_adj_update (fib_path_t *path,
if (!fib_entry_is_resolved(path->fp_via_fib))
{
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
dpo_copy(&via_dpo, drop_dpo_get(fib_proto_to_dpo(path->fp_nh_proto)));
dpo_copy(&via_dpo, drop_dpo_get(path->fp_nh_proto));
/*
* PIC edge trigger. let the load-balance maps know
@@ -720,9 +720,7 @@ fib_path_recursive_adj_update (fib_path_t *path,
*/
dpo_copy(dpo, &via_dpo);
FIB_PATH_DBG(path, "recursive update: %U",
fib_get_lookup_main(path->fp_nh_proto),
&path->fp_dpo, 2);
FIB_PATH_DBG(path, "recursive update:");
dpo_reset(&via_dpo);
}
@@ -804,13 +802,8 @@ fib_path_unresolve (fib_path_t *path)
static fib_forward_chain_type_t
fib_path_to_chain_type (const fib_path_t *path)
{
switch (path->fp_nh_proto)
if (DPO_PROTO_MPLS == path->fp_nh_proto)
{
case FIB_PROTOCOL_IP4:
return (FIB_FORW_CHAIN_TYPE_UNICAST_IP4);
case FIB_PROTOCOL_IP6:
return (FIB_FORW_CHAIN_TYPE_UNICAST_IP6);
case FIB_PROTOCOL_MPLS:
if (FIB_PATH_TYPE_RECURSIVE == path->fp_type &&
MPLS_EOS == path->recursive.fp_nh.fp_eos)
{
@@ -821,7 +814,10 @@ fib_path_to_chain_type (const fib_path_t *path)
return (FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS);
}
}
return (FIB_FORW_CHAIN_TYPE_UNICAST_IP4);
else
{
return (fib_forw_chain_type_from_dpo_proto(path->fp_nh_proto));
}
}
/*
@@ -927,7 +923,7 @@ FIXME comment
ai = fib_path_attached_next_hop_get_adj(
path,
fib_proto_to_link(path->fp_nh_proto));
dpo_proto_to_link(path->fp_nh_proto));
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
if (if_is_up && adj_is_up(ai))
@@ -935,9 +931,7 @@ FIXME comment
path->fp_oper_flags |= FIB_PATH_OPER_FLAG_RESOLVED;
}
dpo_set(&path->fp_dpo, DPO_ADJACENCY,
fib_proto_to_dpo(path->fp_nh_proto),
ai);
dpo_set(&path->fp_dpo, DPO_ADJACENCY, path->fp_nh_proto, ai);
adj_unlock(ai);
if (!if_is_up)
@@ -1141,7 +1135,7 @@ fib_path_create (fib_node_index_t pl_index,
else
{
path->fp_type = FIB_PATH_TYPE_RECURSIVE;
if (FIB_PROTOCOL_MPLS == path->fp_nh_proto)
if (DPO_PROTO_MPLS == path->fp_nh_proto)
{
path->recursive.fp_nh.fp_local_label = rpath->frp_local_label;
path->recursive.fp_nh.fp_eos = rpath->frp_eos;
@@ -1167,7 +1161,7 @@ fib_path_create (fib_node_index_t pl_index,
*/
fib_node_index_t
fib_path_create_special (fib_node_index_t pl_index,
fib_protocol_t nh_proto,
dpo_proto_t nh_proto,
fib_path_cfg_flags_t flags,
const dpo_id_t *dpo)
{
@@ -1433,7 +1427,7 @@ fib_path_cmp_w_route_path (fib_node_index_t path_index,
res = (path->attached.fp_interface - rpath->frp_sw_if_index);
break;
case FIB_PATH_TYPE_RECURSIVE:
if (FIB_PROTOCOL_MPLS == path->fp_nh_proto)
if (DPO_PROTO_MPLS == path->fp_nh_proto)
{
res = path->recursive.fp_nh.fp_local_label - rpath->frp_local_label;
@@ -1535,8 +1529,7 @@ fib_path_recursive_loop_detect (fib_node_index_t path_index,
FIB_PATH_DBG(path, "recursive loop formed");
path->fp_oper_flags |= FIB_PATH_OPER_FLAG_RECURSIVE_LOOP;
dpo_copy(&path->fp_dpo,
drop_dpo_get(fib_proto_to_dpo(path->fp_nh_proto)));
dpo_copy(&path->fp_dpo, drop_dpo_get(path->fp_nh_proto));
}
else
{
@@ -1590,8 +1583,7 @@ fib_path_resolve (fib_node_index_t path_index)
*/
if (fib_path_is_permanent_drop(path))
{
dpo_copy(&path->fp_dpo,
drop_dpo_get(fib_proto_to_dpo(path->fp_nh_proto)));
dpo_copy(&path->fp_dpo, drop_dpo_get(path->fp_nh_proto));
path->fp_oper_flags &= ~FIB_PATH_OPER_FLAG_RESOLVED;
return (fib_path_is_resolved(path_index));
}
@@ -1612,9 +1604,9 @@ fib_path_resolve (fib_node_index_t path_index)
}
dpo_set(&path->fp_dpo,
DPO_ADJACENCY,
fib_proto_to_dpo(path->fp_nh_proto),
path->fp_nh_proto,
fib_path_attached_get_adj(path,
fib_proto_to_link(path->fp_nh_proto)));
dpo_proto_to_link(path->fp_nh_proto)));
/*
* become a child of the adjacency so we receive updates
@@ -1639,7 +1631,7 @@ fib_path_resolve (fib_node_index_t path_index)
ASSERT(FIB_NODE_INDEX_INVALID == path->fp_via_fib);
if (FIB_PROTOCOL_MPLS == path->fp_nh_proto)
if (DPO_PROTO_MPLS == path->fp_nh_proto)
{
fib_prefix_from_mpls_label(path->recursive.fp_nh.fp_local_label,
path->recursive.fp_nh.fp_eos,
@@ -1680,8 +1672,7 @@ fib_path_resolve (fib_node_index_t path_index)
/*
* Resolve via the drop
*/
dpo_copy(&path->fp_dpo,
drop_dpo_get(fib_proto_to_dpo(path->fp_nh_proto)));
dpo_copy(&path->fp_dpo, drop_dpo_get(path->fp_nh_proto));
break;
case FIB_PATH_TYPE_DEAG:
{
@@ -1696,7 +1687,7 @@ fib_path_resolve (fib_node_index_t path_index)
LOOKUP_UNICAST);
lookup_dpo_add_or_lock_w_fib_index(path->deag.fp_tbl_id,
fib_proto_to_dpo(path->fp_nh_proto),
path->fp_nh_proto,
cast,
LOOKUP_INPUT_DST_ADDR,
LOOKUP_TABLE_FROM_CONFIG,
@@ -1707,7 +1698,7 @@ fib_path_resolve (fib_node_index_t path_index)
/*
* Resolve via a receive DPO.
*/
receive_dpo_add_or_lock(fib_proto_to_dpo(path->fp_nh_proto),
receive_dpo_add_or_lock(path->fp_nh_proto,
path->receive.fp_interface,
&path->receive.fp_addr,
&path->fp_dpo);
@@ -1716,7 +1707,7 @@ fib_path_resolve (fib_node_index_t path_index)
/*
* Resolve via a receive DPO.
*/
interface_dpo_add_or_lock(fib_proto_to_dpo(path->fp_nh_proto),
interface_dpo_add_or_lock(path->fp_nh_proto,
path->intf_rx.fp_interface,
&path->fp_dpo);
break;
@@ -2035,7 +2026,7 @@ fib_path_contribute_forwarding (fib_node_index_t path_index,
/*
* Create the adj needed for sending IP multicast traffic
*/
ai = adj_mcast_add_or_lock(path->fp_nh_proto,
ai = adj_mcast_add_or_lock(dpo_proto_to_fib(path->fp_nh_proto),
fib_forw_chain_type_to_link_type(fct),
path->attached.fp_interface);
dpo_set(dpo, DPO_ADJACENCY,
@@ -2187,7 +2178,7 @@ fib_path_encode (fib_node_index_t path_list_index,
return (FIB_PATH_LIST_WALK_CONTINUE);
}
fib_protocol_t
dpo_proto_t
fib_path_get_proto (fib_node_index_t path_index)
{
fib_path_t *path;
+9 -2
View File
@@ -78,6 +78,11 @@ typedef enum fib_path_cfg_attribute_t_ {
* The path is an interface recieve
*/
FIB_PATH_CFG_ATTRIBUTE_LOCAL,
/**
* The path is L2. i.e. the parameters therein are to be interpreted as
* pertaining to L2 config.
*/
FIB_PATH_CFG_ATTRIBUTE_L2,
/**
* Marker. Add new types before this one, then update it.
*/
@@ -98,6 +103,7 @@ typedef enum fib_path_cfg_attribute_t_ {
[FIB_PATH_CFG_ATTRIBUTE_ATTACHED] = "attached", \
[FIB_PATH_CFG_ATTRIBUTE_INTF_RX] = "interface-rx", \
[FIB_PATH_CFG_ATTRIBUTE_RPF_ID] = "rpf-id", \
[FIB_PATH_CFG_ATTRIBUTE_L2] = "l2", \
}
#define FOR_EACH_FIB_PATH_CFG_ATTRIBUTE(_item) \
@@ -118,6 +124,7 @@ typedef enum fib_path_cfg_flags_t_ {
FIB_PATH_CFG_FLAG_ATTACHED = (1 << FIB_PATH_CFG_ATTRIBUTE_ATTACHED),
FIB_PATH_CFG_FLAG_INTF_RX = (1 << FIB_PATH_CFG_ATTRIBUTE_INTF_RX),
FIB_PATH_CFG_FLAG_RPF_ID = (1 << FIB_PATH_CFG_ATTRIBUTE_RPF_ID),
FIB_PATH_CFG_FLAG_L2 = (1 << FIB_PATH_CFG_ATTRIBUTE_L2),
} __attribute__ ((packed)) fib_path_cfg_flags_t;
@@ -131,7 +138,7 @@ extern u8 * format_fib_path(u8 * s, va_list * args);
extern fib_node_index_t fib_path_create(fib_node_index_t pl_index,
const fib_route_path_t *path);
extern fib_node_index_t fib_path_create_special(fib_node_index_t pl_index,
fib_protocol_t nh_proto,
dpo_proto_t nh_proto,
fib_path_cfg_flags_t flags,
const dpo_id_t *dpo);
@@ -148,7 +155,7 @@ extern int fib_path_is_recursive_constrained(fib_node_index_t path_index);
extern int fib_path_is_exclusive(fib_node_index_t path_index);
extern int fib_path_is_deag(fib_node_index_t path_index);
extern int fib_path_is_looped(fib_node_index_t path_index);
extern fib_protocol_t fib_path_get_proto(fib_node_index_t path_index);
extern dpo_proto_t fib_path_get_proto(fib_node_index_t path_index);
extern void fib_path_destroy(fib_node_index_t path_index);
extern uword fib_path_hash(fib_node_index_t path_index);
extern load_balance_path_t * fib_path_append_nh_for_multipath_hash(
+3
View File
@@ -191,6 +191,9 @@ fib_path_ext_stack (fib_path_ext_t *path_ext,
case FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS:
parent_fct = child_fct;
break;
case FIB_FORW_CHAIN_TYPE_ETHERNET:
parent_fct = FIB_FORW_CHAIN_TYPE_MPLS_NON_EOS;
break;
default:
return (nhs);
break;
+2 -2
View File
@@ -611,7 +611,7 @@ fib_path_list_get_resolving_interface (fib_node_index_t path_list_index)
return (sw_if_index);
}
fib_protocol_t
dpo_proto_t
fib_path_list_get_proto (fib_node_index_t path_list_index)
{
fib_path_list_t *path_list;
@@ -753,7 +753,7 @@ fib_path_list_flags_2_path_flags (fib_path_list_flags_t plf)
}
fib_node_index_t
fib_path_list_create_special (fib_protocol_t nh_proto,
fib_path_list_create_special (dpo_proto_t nh_proto,
fib_path_list_flags_t flags,
const dpo_id_t *dpo)
{
+2 -2
View File
@@ -106,7 +106,7 @@ typedef enum fib_path_list_flags_t_ {
extern fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags,
const fib_route_path_t *paths);
extern fib_node_index_t fib_path_list_create_special(fib_protocol_t nh_proto,
extern fib_node_index_t fib_path_list_create_special(dpo_proto_t nh_proto,
fib_path_list_flags_t flags,
const dpo_id_t *dpo);
@@ -150,7 +150,7 @@ extern int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index,
extern u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index);
extern int fib_path_list_is_looped(fib_node_index_t path_list_index);
extern int fib_path_list_is_popular(fib_node_index_t path_list_index);
extern fib_protocol_t fib_path_list_get_proto(fib_node_index_t path_list_index);
extern dpo_proto_t fib_path_list_get_proto(fib_node_index_t path_list_index);
extern u8 * fib_path_list_format(fib_node_index_t pl_index,
u8 * s);
extern index_t fib_path_list_lb_map_add_or_lock(fib_node_index_t pl_index,
+3 -3
View File
@@ -505,7 +505,7 @@ fib_table_entry_path_add (u32 fib_index,
const fib_prefix_t *prefix,
fib_source_t source,
fib_entry_flag_t flags,
fib_protocol_t next_hop_proto,
dpo_proto_t next_hop_proto,
const ip46_address_t *next_hop,
u32 next_hop_sw_if_index,
u32 next_hop_fib_index,
@@ -664,7 +664,7 @@ void
fib_table_entry_path_remove (u32 fib_index,
const fib_prefix_t *prefix,
fib_source_t source,
fib_protocol_t next_hop_proto,
dpo_proto_t next_hop_proto,
const ip46_address_t *next_hop,
u32 next_hop_sw_if_index,
u32 next_hop_fib_index,
@@ -755,7 +755,7 @@ fib_table_entry_update_one_path (u32 fib_index,
const fib_prefix_t *prefix,
fib_source_t source,
fib_entry_flag_t flags,
fib_protocol_t next_hop_proto,
dpo_proto_t next_hop_proto,
const ip46_address_t *next_hop,
u32 next_hop_sw_if_index,
u32 next_hop_fib_index,
+3 -3
View File
@@ -288,7 +288,7 @@ extern fib_node_index_t fib_table_entry_path_add(u32 fib_index,
const fib_prefix_t *prefix,
fib_source_t source,
fib_entry_flag_t flags,
fib_protocol_t next_hop_proto,
dpo_proto_t next_hop_proto,
const ip46_address_t *next_hop,
u32 next_hop_sw_if_index,
u32 next_hop_fib_index,
@@ -364,7 +364,7 @@ extern fib_node_index_t fib_table_entry_path_add2(u32 fib_index,
extern void fib_table_entry_path_remove(u32 fib_index,
const fib_prefix_t *prefix,
fib_source_t source,
fib_protocol_t next_hop_proto,
dpo_proto_t next_hop_proto,
const ip46_address_t *next_hop,
u32 next_hop_sw_if_index,
u32 next_hop_fib_index,
@@ -471,7 +471,7 @@ extern fib_node_index_t fib_table_entry_update_one_path(u32 fib_index,
const fib_prefix_t *prefix,
fib_source_t source,
fib_entry_flag_t flags,
fib_protocol_t next_hop_proto,
dpo_proto_t next_hop_proto,
const ip46_address_t *next_hop,
u32 next_hop_sw_if_index,
u32 next_hop_fib_index,
+169 -169
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -32,9 +32,9 @@ typedef u32 fib_node_index_t;
* Protocol Type. packed so it consumes a u8 only
*/
typedef enum fib_protocol_t_ {
FIB_PROTOCOL_IP4 = 0,
FIB_PROTOCOL_IP6,
FIB_PROTOCOL_MPLS,
FIB_PROTOCOL_IP4 = DPO_PROTO_IP4,
FIB_PROTOCOL_IP6 = DPO_PROTO_IP6,
FIB_PROTOCOL_MPLS = DPO_PROTO_MPLS,
} __attribute__ ((packed)) fib_protocol_t;
#define FIB_PROTOCOLS { \
@@ -338,7 +338,7 @@ typedef struct fib_route_path_t_ {
* The protocol of the address below. We need this since the all
* zeros address is ambiguous.
*/
fib_protocol_t frp_proto;
dpo_proto_t frp_proto;
union {
/**

Some files were not shown because too many files have changed in this diff Show More