aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-05-24 10:53:43 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-05-24 19:49:37 +0000
commitc13548a6056248278ae1a56a60adc197b3ceb860 (patch)
tree49056eedf5ab2d3a4f6e6bf9d150a09c1e10e488
parent6631e9c1648f08f7d4fbe94e1218eee7820b4c23 (diff)
MPLS tunnels; path-list lock leak and debug CLI imrpovements
Change-Id: Ifb51b49d4dac1f07027b12398314a52b5cce343e Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--src/vnet/mpls/mpls_tunnel.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c
index 776b23ba..c025cc58 100644
--- a/src/vnet/mpls/mpls_tunnel.c
+++ b/src/vnet/mpls/mpls_tunnel.c
@@ -290,7 +290,7 @@ mpls_tunnel_stack (adj_index_t ai)
FIB_NODE_TYPE_MPLS_TUNNEL,
mt - mpls_tunnel_pool);
- fib_path_list_lock(mt->mt_path_list);
+ fib_path_list_unlock(mt->mt_path_list);
}
/**
@@ -526,8 +526,6 @@ VNET_DEVICE_CLASS (mpls_tunnel_class) = {
VNET_HW_INTERFACE_CLASS (mpls_tunnel_hw_interface_class) = {
.name = "MPLS-Tunnel",
-// .format_header = format_mpls_eth_header_with_length,
-// .unformat_header = unformat_mpls_eth_header,
.update_adjacency = mpls_tunnel_update_adj,
.build_rewrite = mpls_tunnel_build_rewrite,
.flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P,
@@ -772,7 +770,7 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm,
u8 is_del = 0, l2_only = 0, is_multicast =0;
fib_route_path_t rpath, *rpaths = NULL;
mpls_label_t out_label = MPLS_LABEL_INVALID;
- u32 sw_if_index;
+ u32 sw_if_index = ~0;
clib_error_t *error = NULL;
memset(&rpath, 0, sizeof(rpath));
@@ -787,6 +785,10 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm,
unformat_vnet_sw_interface, vnm,
&sw_if_index))
is_del = 1;
+ else if (unformat (line_input, "add %U",
+ unformat_vnet_sw_interface, vnm,
+ &sw_if_index))
+ is_del = 0;
else if (unformat (line_input, "add"))
is_del = 0;
else if (unformat (line_input, "out-label %U",
@@ -843,9 +845,14 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm,
}
}
+ vec_add1(rpaths, rpath);
+
if (is_del)
{
- vnet_mpls_tunnel_del(sw_if_index);
+ if (!vnet_mpls_tunnel_path_remove(sw_if_index, rpaths))
+ {
+ vnet_mpls_tunnel_del(sw_if_index);
+ }
}
else
{
@@ -856,8 +863,10 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm,
goto done;
}
- vec_add1(rpaths, rpath);
- sw_if_index = vnet_mpls_tunnel_create(l2_only, is_multicast);
+ if (~0 == sw_if_index)
+ {
+ sw_if_index = vnet_mpls_tunnel_create(l2_only, is_multicast);
+ }
vnet_mpls_tunnel_path_add(sw_if_index, rpaths);
}