From 46529cda4bf08ca6cad46cce26eb83ede4e3d4d9 Mon Sep 17 00:00:00 2001 From: Billy McFall Date: Fri, 14 Oct 2016 10:45:49 -0400 Subject: VPP-490: vpp crash in show ip6 neighbor Change-Id: I003f95db85ce5085045c607f0b1daaefa792c910 Signed-off-by: Billy McFall --- vnet/vnet/ip/ip6_neighbor.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c index 3aef2326..5482a58b 100644 --- a/vnet/vnet/ip/ip6_neighbor.c +++ b/vnet/vnet/ip/ip6_neighbor.c @@ -766,14 +766,17 @@ show_ip6_neighbors (vlib_main_t * vm, ns = 0; pool_foreach (n, nm->neighbor_pool, ({ vec_add1 (ns, n[0]); })); - vec_sort_with_function (ns, ip6_neighbor_sort); - vlib_cli_output (vm, "%U", format_ip6_neighbor_ip6_entry, vm, 0); - vec_foreach (n, ns) { - if (sw_if_index != ~0 && n->key.sw_if_index != sw_if_index) - continue; - vlib_cli_output (vm, "%U", format_ip6_neighbor_ip6_entry, vm, n); - } - vec_free (ns); + if (ns) + { + vec_sort_with_function (ns, ip6_neighbor_sort); + vlib_cli_output (vm, "%U", format_ip6_neighbor_ip6_entry, vm, 0); + vec_foreach (n, ns) { + if (sw_if_index != ~0 && n->key.sw_if_index != sw_if_index) + continue; + vlib_cli_output (vm, "%U", format_ip6_neighbor_ip6_entry, vm, n); + } + vec_free (ns); + } return error; } -- cgit 1.2.3-korg