aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bier/bier_api.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-12-05 13:24:04 -0800
committerFlorin Coras <florin.coras@gmail.com>2017-12-09 20:55:08 +0000
commit9128637ee8f7b0d903551f165a1447d427e8dd19 (patch)
tree244014dd1064643946d64066e352ee1627bf622c /src/vnet/bier/bier_api.c
parentcef87f1a5eb4d69cf11ce1cd3c5506edcfba74c4 (diff)
BIER in non-MPLS netowrks
as decsribed in section 2.2 ihttps://tools.ietf.org/html/draft-ietf-bier-mpls-encapsulation-10 with BIFT encoding from: https://tools.ietf.org/html/draft-wijnandsxu-bier-non-mpls-bift-encoding-00 changes: 1 - introduce the new BIFT lookup table. BIER tables that have an associated MPLS label are added to the MPLS-FIB. Those that don't are added to the BIER table 2 - BIER routes that have no associated output MPLS label will add a BIFT label. 3 - The BIER FMask has a path-list as a member to resolve via any possible path. Change-Id: I1fd4d9dbd074f0e855c16e9329b81460ebe1efce Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/bier/bier_api.c')
-rw-r--r--src/vnet/bier/bier_api.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/src/vnet/bier/bier_api.c b/src/vnet/bier/bier_api.c
index cd1f40b1eaa..67c70462540 100644
--- a/src/vnet/bier/bier_api.c
+++ b/src/vnet/bier/bier_api.c
@@ -83,7 +83,17 @@ vl_api_bier_table_add_del_t_handler (vl_api_bier_table_add_del_t * mp)
if (mp->bt_is_add)
{
- bier_table_add_or_lock(&bti, ntohl(mp->bt_label));
+ mpls_label_t label = ntohl(mp->bt_label);
+
+ /*
+ * convert acceptable 'don't want a label' values from
+ * the API to the correct internal INVLID value
+ */
+ if ((0 == label) || (~0 == label))
+ {
+ label = MPLS_LABEL_INVALID;
+ }
+ bier_table_add_or_lock(&bti, label);
}
else
{
@@ -175,7 +185,7 @@ vl_api_bier_route_add_del_t_handler (vl_api_bier_route_add_del_t * mp)
{
brpath = &brpaths[ii];
memset(brpath, 0, sizeof(*brpath));
- brpath->frp_flags = FIB_ROUTE_PATH_BIER_FMASK;
+ brpath->frp_sw_if_index = ~0;
vec_validate(brpath->frp_label_stack,
mp->br_paths[ii].n_labels - 1);
@@ -185,30 +195,41 @@ vl_api_bier_route_add_del_t_handler (vl_api_bier_route_add_del_t * mp)
ntohl(mp->br_paths[ii].label_stack[jj]);
}
- if (0 == mp->br_paths[ii].afi)
+ if (mp->br_paths[ii].is_udp_encap)
{
- clib_memcpy (&brpath->frp_addr.ip4,
- mp->br_paths[ii].next_hop,
- sizeof (brpath->frp_addr.ip4));
+ brpath->frp_flags |= FIB_ROUTE_PATH_UDP_ENCAP;
+ brpath->frp_udp_encap_id = ntohl(mp->br_paths[ii].next_hop_id);
}
else
{
- clib_memcpy (&brpath->frp_addr.ip6,
- mp->br_paths[ii].next_hop,
- sizeof (brpath->frp_addr.ip6));
- }
- if (ip46_address_is_zero(&brpath->frp_addr))
- {
- index_t bdti;
-
- bdti = bier_disp_table_find(ntohl(mp->br_paths[ii].table_id));
-
- if (INDEX_INVALID != bdti)
- brpath->frp_fib_index = bdti;
+ if (0 == mp->br_paths[ii].afi)
+ {
+ clib_memcpy (&brpath->frp_addr.ip4,
+ mp->br_paths[ii].next_hop,
+ sizeof (brpath->frp_addr.ip4));
+ }
else
{
- rv = VNET_API_ERROR_NO_SUCH_FIB;
- goto done;
+ clib_memcpy (&brpath->frp_addr.ip6,
+ mp->br_paths[ii].next_hop,
+ sizeof (brpath->frp_addr.ip6));
+ }
+ if (ip46_address_is_zero(&brpath->frp_addr))
+ {
+ index_t bdti;
+
+ bdti = bier_disp_table_find(ntohl(mp->br_paths[ii].table_id));
+
+ if (INDEX_INVALID != bdti)
+ {
+ brpath->frp_fib_index = bdti;
+ brpath->frp_proto = DPO_PROTO_BIER;
+ }
+ else
+ {
+ rv = VNET_API_ERROR_NO_SUCH_FIB;
+ goto done;
+ }
}
}
}