VPP-490: vpp crash in show ip6 neighbor 28/3428/1
authorBilly McFall <bmcfall@redhat.com>
Fri, 14 Oct 2016 14:45:49 +0000 (10:45 -0400)
committerBilly McFall <bmcfall@redhat.com>
Fri, 14 Oct 2016 14:45:49 +0000 (10:45 -0400)
Change-Id: I003f95db85ce5085045c607f0b1daaefa792c910
Signed-off-by: Billy McFall <bmcfall@redhat.com>
vnet/vnet/ip/ip6_neighbor.c

index 3aef232..5482a58 100644 (file)
@@ -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;
 }