From 39ae0a07ac17640a7f8ba136eaaf334bfd504030 Mon Sep 17 00:00:00 2001 From: IJsbrand Wijnands Date: Thu, 5 Mar 2020 10:56:26 -0800 Subject: mpls: add user defined name tag to mpls tunnels This allows a user creating MPLS tunnel through the bin_api to add a name tag. This is useful to correlate the Tunnel with its use-case. Also useful if the user needs to recover the MPLS Tunnel after a restart (mark-sweep). Type: feature Change-Id: Signed-off-by: IJsbrand Wijnands Change-Id: Idc080a63810a176ab090a2678a73d2cf9f7b523f --- src/vnet/mpls/mpls_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/vnet/mpls/mpls_api.c') diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c index 0185e373a41..70e8872317a 100644 --- a/src/vnet/mpls/mpls_api.c +++ b/src/vnet/mpls/mpls_api.c @@ -283,7 +283,8 @@ vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp) if (~0 == tunnel_sw_if_index) tunnel_sw_if_index = vnet_mpls_tunnel_create (mp->mt_tunnel.mt_l2_only, - mp->mt_tunnel.mt_is_multicast); + mp->mt_tunnel.mt_is_multicast, + mp->mt_tunnel.mt_tag); vnet_mpls_tunnel_path_add (tunnel_sw_if_index, rpaths); tunnel_index = vnet_mpls_tunnel_get_index (tunnel_sw_if_index); @@ -365,6 +366,7 @@ send_mpls_tunnel_entry (u32 mti, void *arg) mp->mt_tunnel.mt_tunnel_index = ntohl (mti); mp->mt_tunnel.mt_l2_only = ! !(MPLS_TUNNEL_FLAG_L2 & mt->mt_flags); mp->mt_tunnel.mt_is_multicast = ! !(MPLS_TUNNEL_FLAG_MCAST & mt->mt_flags); + memcpy (mp->mt_tunnel.mt_tag, mt->mt_tag, sizeof (mp->mt_tunnel.mt_tag)); fib_path_list_walk_w_ext (mt->mt_path_list, &mt->mt_path_exts, fib_path_encode, &path_ctx); -- cgit 1.2.3-korg