ip: Replace Sematics for Interface IP addresses
[vpp.git] / src / vnet / flow / flow.c
index c4f57a2..9b6a376 100644 (file)
@@ -47,7 +47,7 @@ vnet_flow_add (vnet_main_t * vnm, vnet_flow_t * flow, u32 * flow_index)
 
   pool_get (fm->global_flow_pool, f);
   *flow_index = f - fm->global_flow_pool;
-  clib_memcpy (f, flow, sizeof (vnet_flow_t));
+  clib_memcpy_fast (f, flow, sizeof (vnet_flow_t));
   f->private_data = 0;
   f->index = *flow_index;
   return 0;
@@ -82,7 +82,7 @@ vnet_flow_del (vnet_main_t * vnm, u32 flow_index)
   /* *INDENT-ON* */
 
   hash_free (f->private_data);
-  memset (f, 0, sizeof (*f));
+  clib_memset (f, 0, sizeof (*f));
   pool_put (fm->global_flow_pool, f);
   return 0;
 }
@@ -96,6 +96,9 @@ vnet_flow_enable (vnet_main_t * vnm, u32 flow_index, u32 hw_if_index)
   uword private_data;
   int rv;
 
+  if (f == 0)
+    return VNET_FLOW_ERROR_NO_SUCH_ENTRY;
+
   if (!vnet_hw_interface_is_valid (vnm, hw_if_index))
     return VNET_FLOW_ERROR_NO_SUCH_INTERFACE;
 
@@ -137,6 +140,9 @@ vnet_flow_disable (vnet_main_t * vnm, u32 flow_index, u32 hw_if_index)
   uword *p;
   int rv;
 
+  if (f == 0)
+    return VNET_FLOW_ERROR_NO_SUCH_ENTRY;
+
   if (!vnet_hw_interface_is_valid (vnm, hw_if_index))
     return VNET_FLOW_ERROR_NO_SUCH_INTERFACE;