From: Billy McFall Date: Fri, 14 Oct 2016 14:45:49 +0000 (-0400) Subject: VPP-490: vpp crash in show ip6 neighbor X-Git-Tag: v17.01-rc0~85 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=46529cda4bf08ca6cad46cce26eb83ede4e3d4d9;p=vpp.git VPP-490: vpp crash in show ip6 neighbor Change-Id: I003f95db85ce5085045c607f0b1daaefa792c910 Signed-off-by: Billy McFall --- diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c index 3aef2326237..5482a58be74 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; }