X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=vnet%2Fvnet%2Fmpls%2Fmpls_tunnel.c;h=8d1e30a36fbc4aa2011fc9cc440762caabdf971b;hb=e3371afc8a90177eef331cf609ddd89c9413aeb5;hp=656bf330b1a58a9170e90e90c61684738f9984a8;hpb=ad422ed7eaafe993d5b530395cb11a708f2ed922;p=vpp.git diff --git a/vnet/vnet/mpls/mpls_tunnel.c b/vnet/vnet/mpls/mpls_tunnel.c index 656bf330b1a..8d1e30a36fb 100644 --- a/vnet/vnet/mpls/mpls_tunnel.c +++ b/vnet/vnet/mpls/mpls_tunnel.c @@ -104,7 +104,12 @@ mpls_tunnel_build_rewrite (vnet_main_t * vnm, mti = mpls_tunnel_db[sw_if_index]; mt = pool_elt_at_index(mpls_tunnel_pool, mti); + /* + * The vector must be allocated as u8 so the length is correct + */ + ASSERT(0 < vec_len(mt->mt_label_stack)); vec_validate(rewrite, (sizeof(*muh) * vec_len(mt->mt_label_stack)) - 1); + ASSERT(rewrite); muh = (mpls_unicast_header_t *)rewrite; /* @@ -123,15 +128,19 @@ mpls_tunnel_build_rewrite (vnet_main_t * vnm, vnet_mpls_uc_set_ttl(&muh[ii].label_exp_s_ttl, 255); vnet_mpls_uc_set_exp(&muh[ii].label_exp_s_ttl, 0); - if (VNET_LINK_MPLS == link_type && - mt->mt_label_stack[ii] != MPLS_IETF_IMPLICIT_NULL_LABEL) + if ((VNET_LINK_MPLS == link_type) && + (mt->mt_label_stack[ii] != MPLS_IETF_IMPLICIT_NULL_LABEL)) + { vnet_mpls_uc_set_s(&muh[ii].label_exp_s_ttl, MPLS_NON_EOS); + } else + { vnet_mpls_uc_set_s(&muh[ii].label_exp_s_ttl, MPLS_EOS); + } muh[ii].label_exp_s_ttl = clib_host_to_net_u32(muh[ii].label_exp_s_ttl); - return ((u8*)muh); + return (rewrite); } /** @@ -385,7 +394,6 @@ VNET_DEVICE_CLASS (mpls_tunnel_class) = { .format_device = format_mpls_tunnel_device, .format_tx_trace = format_mpls_tunnel_tx_trace, .tx_function = mpls_tunnel_tx, - .no_flatten_output_chains = 1, .admin_up_down_function = mpls_tunnel_admin_up_down, };