diff options
-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 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; } |