X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fmpls%2Fmpls_tunnel.c;h=55d814858c374ca33b72b46c918e3508ad3f7787;hb=39ae0a07ac17640a7f8ba136eaaf334bfd504030;hp=e70f42873605cfd56d9ab5199dccc04651b9e84f;hpb=901cbb9e4dcda09e93452129096c057efea4e390;p=vpp.git diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c index e70f4287360..55d814858c3 100644 --- a/src/vnet/mpls/mpls_tunnel.c +++ b/src/vnet/mpls/mpls_tunnel.c @@ -62,7 +62,7 @@ static u8* mpls_tunnel_build_rewrite_i (void) { /* - * passing the adj code a NULL rewirte means 'i don't have one cos + * passing the adj code a NULL rewrite means 'i don't have one cos * t'other end is unresolved'. That's not the case here. For the mpls * tunnel there are just no bytes of encap to apply in the adj. We'll impose * the label stack once we choose a path. So return a zero length rewrite. @@ -242,7 +242,7 @@ mpls_tunnel_stack (adj_index_t ai) mt = mpls_tunnel_get_from_sw_if_index(sw_if_index); - if (NULL == mt) + if (NULL == mt || FIB_NODE_INDEX_INVALID == mt->mt_path_list) return; if (FIB_NODE_INDEX_INVALID == mt->mt_path_list) @@ -376,7 +376,7 @@ mpls_tunnel_admin_up_down (vnet_main_t * vnm, */ static void mpls_tunnel_fixup (vlib_main_t *vm, - ip_adjacency_t *adj, + const ip_adjacency_t *adj, vlib_buffer_t *b0, const void*data) { @@ -606,7 +606,8 @@ vnet_mpls_tunnel_del (u32 sw_if_index) u32 vnet_mpls_tunnel_create (u8 l2_only, - u8 is_multicast) + u8 is_multicast, + u8 *tag) { vnet_hw_interface_t * hi; mpls_tunnel_t *mt; @@ -625,6 +626,10 @@ vnet_mpls_tunnel_create (u8 l2_only, mt->mt_flags |= MPLS_TUNNEL_FLAG_MCAST; if (l2_only) mt->mt_flags |= MPLS_TUNNEL_FLAG_L2; + if (tag) + memcpy(mt->mt_tag, tag, sizeof(mt->mt_tag)); + else + mt->mt_tag[0] = '\0'; /* * Create a new tunnel HW interface @@ -654,6 +659,7 @@ void vnet_mpls_tunnel_path_add (u32 sw_if_index, fib_route_path_t *rpaths) { + fib_route_path_t *rpath; mpls_tunnel_t *mt; u32 mti; @@ -695,10 +701,13 @@ vnet_mpls_tunnel_path_add (u32 sw_if_index, */ fib_path_ext_list_resolve(&mt->mt_path_exts, mt->mt_path_list); } - fib_path_ext_list_insert(&mt->mt_path_exts, - mt->mt_path_list, - FIB_PATH_EXT_MPLS, - rpaths); + vec_foreach(rpath, rpaths) + { + fib_path_ext_list_insert(&mt->mt_path_exts, + mt->mt_path_list, + FIB_PATH_EXT_MPLS, + rpath); + } mpls_tunnel_restack(mt); } @@ -854,7 +863,7 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm, if (~0 == sw_if_index) { - sw_if_index = vnet_mpls_tunnel_create(l2_only, is_multicast); + sw_if_index = vnet_mpls_tunnel_create(l2_only, is_multicast, NULL); } vnet_mpls_tunnel_path_add(sw_if_index, rpaths); }