host stack: update stale copyright
[vpp.git] / src / vnet / tcp / tcp_syn_filter4.c
index c7605a3..ffcd596 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Copyright (c) 2016-2019 Cisco and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
@@ -80,9 +80,9 @@ typedef enum
 
 extern vnet_feature_arc_registration_t vnet_feat_arc_ip4_local;
 
-static uword
-syn_filter4_node_fn (vlib_main_t * vm,
-                    vlib_node_runtime_t * node, vlib_frame_t * frame)
+VLIB_NODE_FN (syn_filter4_node) (vlib_main_t * vm,
+                                vlib_node_runtime_t * node,
+                                vlib_frame_t * frame)
 {
   u32 n_left_from, *from, *to_next;
   syn_filter_next_t next_index;
@@ -101,7 +101,7 @@ syn_filter4_node_fn (vlib_main_t * vm,
 
   if (now > rt->next_reset)
     {
-      memset (rt->syn_counts, 0, vec_len (rt->syn_counts));
+      clib_memset (rt->syn_counts, 0, vec_len (rt->syn_counts));
       rt->next_reset = now + rt->reset_interval;
     }
 
@@ -402,7 +402,6 @@ syn_filter4_node_fn (vlib_main_t * vm,
 /* *INDENT-OFF* */
 VLIB_REGISTER_NODE (syn_filter4_node, static) =
 {
-  .function = syn_filter4_node_fn,
   .name = "syn-filter-4",
   .vector_size = sizeof (u32),
   .format_trace = format_syn_filter4_trace,
@@ -421,8 +420,6 @@ VLIB_REGISTER_NODE (syn_filter4_node, static) =
 };
 /* *INDENT-ON* */
 
-VLIB_NODE_FUNCTION_MULTIARCH (syn_filter4_node, syn_filter4_node_fn);
-
 /* *INDENT-OFF* */
 VNET_FEATURE_INIT (syn_filter_4, static) =
 {
@@ -432,6 +429,7 @@ VNET_FEATURE_INIT (syn_filter_4, static) =
 };
 /* *INDENT-ON* */
 
+#ifndef CLIB_MARCH_VARIANT
 int
 syn_filter_enable_disable (u32 sw_if_index, int enable_disable)
 {
@@ -450,18 +448,21 @@ syn_filter_enable_disable (u32 sw_if_index, int enable_disable)
 
   if (enable_disable)
     {
-      vlib_main_t *vm = vlib_get_main ();
       syn_filter4_runtime_t *rt;
 
-      rt = vlib_node_get_runtime_data (vm, syn_filter4_node.index);
-      vec_validate (rt->syn_counts, 1023);
-      /*
-       * Given perfect disperson / optimal hashing results:
-       * Allow 128k (successful) syns/sec. 1024, buckets each of which
-       * absorb 128 syns before filtering. Reset table once a second.
-       * Reality bites, lets try resetting once every 100ms.
-       */
-      rt->reset_interval = 0.1;        /* reset interval in seconds */
+      /* *INDENT-OFF* */
+      foreach_vlib_main ({
+       rt = vlib_node_get_runtime_data (this_vlib_main, syn_filter4_node.index);
+       vec_validate (rt->syn_counts, 1023);
+       /*
+        * Given perfect disperson / optimal hashing results:
+        * Allow 128k (successful) syns/sec. 1024, buckets each of which
+        * absorb 128 syns before filtering. Reset table once a second.
+        * Reality bites, lets try resetting once every 100ms.
+        */
+       rt->reset_interval = 0.1;       /* reset interval in seconds */
+      });
+      /* *INDENT-ON* */
     }
 
   rv = vnet_feature_enable_disable ("ip4-local", "syn-filter-4",
@@ -532,6 +533,7 @@ VLIB_CLI_COMMAND (sr_content_command, static) =
   .function = syn_filter_enable_disable_command_fn,
 };
 /* *INDENT-ON* */
+#endif /* CLIB_MARCH_VARIANT */
 
 /*
  * fd.io coding-style-patch-verification: ON