aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bier/bier_api.c
diff options
context:
space:
mode:
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;
+ }
}
}
}