diff options
author | Billy McFall <bmcfall@redhat.com> | 2016-10-14 10:45:49 -0400 |
---|---|---|
committer | Billy McFall <bmcfall@redhat.com> | 2016-10-14 10:45:49 -0400 |
commit | 46529cda4bf08ca6cad46cce26eb83ede4e3d4d9 (patch) | |
tree | 24afb3e250bc33fad5e8a4474c4f0f0c7e3a468f | |
parent | 309fe069dbfc36cf2274cd70ea43a1f2f9cce507 (diff) |
VPP-490: vpp crash in show ip6 neighbor
Change-Id: I003f95db85ce5085045c607f0b1daaefa792c910
Signed-off-by: Billy McFall <bmcfall@redhat.com>
-rw-r--r-- | vnet/vnet/ip/ip6_neighbor.c | 19 |
1 files 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; } |