diff options
author | John Lo <loj@cisco.com> | 2018-10-03 16:32:44 -0400 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-10-04 07:46:10 +0000 |
commit | 06fda9cea94e0009fd0238a77d2e0f39e46f666c (patch) | |
tree | 9fc05d35f1ba7012cbf112e202849b560ea3c87f /src/vnet | |
parent | 744da656d3442bb812f50d6e8746f0f11adee8b3 (diff) |
Fix handling of mpls_tunnel_add_del API
Handles next_hop_weight, next_hop_preference and next_hop_table_id
properly in vl_api_mpls_tunnel_add_del_t_handler(). Also updated
vpp_api_test and custom_dump handling of related APIs.
Change-Id: I89e211bfa3b9d8ead396b24b3c46b7c7f6511f44
Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/mpls/mpls_api.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c index 18eb748c423..84532bffbda 100644 --- a/src/vnet/mpls/mpls_api.c +++ b/src/vnet/mpls/mpls_api.c @@ -311,7 +311,7 @@ mpls_table_create (u32 table_id, u8 is_api, const u8 * name) static void vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp) { - u32 tunnel_sw_if_index, tunnel_index, next_hop_via_label; + u32 tunnel_sw_if_index = ~0, tunnel_index = ~0, next_hop_via_label; vl_api_mpls_tunnel_add_del_reply_t *rmp; fib_route_path_t rpath, *rpaths = NULL; int ii, rv = 0; @@ -333,7 +333,8 @@ vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp) mp->mt_next_hop, sizeof (rpath.frp_addr.ip6)); } rpath.frp_sw_if_index = ntohl (mp->mt_next_hop_sw_if_index); - rpath.frp_weight = 1; + rpath.frp_weight = mp->mt_next_hop_weight; + rpath.frp_preference = mp->mt_next_hop_preference; next_hop_via_label = ntohl (mp->mt_next_hop_via_label); if ((MPLS_LABEL_INVALID != next_hop_via_label) && (0 != next_hop_via_label)) @@ -343,6 +344,18 @@ vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp) rpath.frp_eos = MPLS_NON_EOS; } + if (rpath.frp_sw_if_index == ~0) + { /* recursive path, set fib index */ + rpath.frp_fib_index = + fib_table_find (dpo_proto_to_fib (rpath.frp_proto), + ntohl (mp->mt_next_hop_table_id)); + if (rpath.frp_fib_index == ~0) + { + rv = VNET_API_ERROR_NO_SUCH_FIB; + goto out; + } + } + if (mp->mt_is_add) { for (ii = 0; ii < mp->mt_next_hop_n_out_labels; ii++) @@ -383,6 +396,7 @@ vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp) stats_dsunlock (); +out: /* *INDENT-OFF* */ REPLY_MACRO2(VL_API_MPLS_TUNNEL_ADD_DEL_REPLY, ({ |