Thread-safe ARP / ND throttling
[vpp.git] / src / vnet / ip / ip4_input.c
index 15c2ebf..d11d558 100644 (file)
@@ -340,17 +340,7 @@ VLIB_REGISTER_NODE (ip4_input_no_checksum_node) = {
   .name = "ip4-input-no-checksum",
   .vector_size = sizeof (u32),
 
-  .n_next_nodes = IP4_INPUT_N_NEXT,
-  .next_nodes = {
-    [IP4_INPUT_NEXT_DROP] = "error-drop",
-    [IP4_INPUT_NEXT_PUNT] = "error-punt",
-    [IP4_INPUT_NEXT_OPTIONS] = "ip4-options",
-    [IP4_INPUT_NEXT_LOOKUP] = "ip4-lookup",
-    [IP4_INPUT_NEXT_LOOKUP_MULTICAST] = "ip4-mfib-forward-lookup",
-    [IP4_INPUT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
-    [IP4_INPUT_NEXT_REASSEMBLY] = "ip4-reassembly",
-  },
-
+  .sibling_of = "ip4-input",
   .format_buffer = format_ip4_header,
   .format_trace = format_ip4_input_trace,
 };
@@ -393,6 +383,28 @@ ip4_init (vlib_main_t * vm)
 }
 
 VLIB_INIT_FUNCTION (ip4_init);
+
+static clib_error_t *
+ip4_main_loop_enter (vlib_main_t * vm)
+{
+  ip4_main_t *im = &ip4_main;
+  vlib_thread_main_t *tm = &vlib_thread_main;
+  u32 n_vlib_mains = tm->n_vlib_mains;
+  int i;
+
+
+  vec_validate (im->arp_throttle_bitmaps, n_vlib_mains);
+  vec_validate (im->arp_throttle_seeds, n_vlib_mains);
+  vec_validate (im->arp_throttle_last_seed_change_time, n_vlib_mains);
+
+  for (i = 0; i < n_vlib_mains; i++)
+    vec_validate (im->arp_throttle_bitmaps[i],
+                 (ARP_THROTTLE_BITS / BITS (uword)) - 1);
+  return 0;
+}
+
+VLIB_MAIN_LOOP_ENTER_FUNCTION (ip4_main_loop_enter);
+
 #endif
 
 /*