summaryrefslogtreecommitdiffstats
path: root/src/vnet/mpls/mpls_tunnel.c
diff options
context:
space:
mode:
authorIJsbrand Wijnands <ice@cisco.com>2020-03-05 10:56:26 -0800
committerNeale Ranns <nranns@cisco.com>2020-03-10 13:47:10 +0000
commit39ae0a07ac17640a7f8ba136eaaf334bfd504030 (patch)
treec6c19f469f2b4d75ac54b890eda6a0dc3610ac30 /src/vnet/mpls/mpls_tunnel.c
parent287d5e109a93f14490f38bdbe34b6741af436984 (diff)
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 <ice@cisco.com> Change-Id: Idc080a63810a176ab090a2678a73d2cf9f7b523f
Diffstat (limited to 'src/vnet/mpls/mpls_tunnel.c')
-rw-r--r--src/vnet/mpls/mpls_tunnel.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c
index 3ed77e63a6a..55d814858c3 100644
--- a/src/vnet/mpls/mpls_tunnel.c
+++ b/src/vnet/mpls/mpls_tunnel.c
@@ -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
@@ -858,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);
}