misc: allow disabling of ipfix exporter via api 03/29203/2
authorAlexander Chernavin <achernavin@netgate.com>
Thu, 1 Oct 2020 12:57:59 +0000 (08:57 -0400)
committerMatthew Smith <mgsmith@netgate.com>
Thu, 1 Oct 2020 21:23:53 +0000 (21:23 +0000)
Zero collector address indicates that the IPFIX exporter is disabled.
You can zero the collector address via vppctl but you can't do it via
the API because the handler returns an error if the address is zero.

With this change, do not return an error in the handler when the
collector address is zero thus allowing the IPFIX exporter be
disabled.

Type: fix
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Change-Id: I1335c0d06af81f11d743c395399a360c612c0c21

src/vnet/ipfix-export/flow_api.c

index 84babe7..217cf31 100644 (file)
@@ -113,13 +113,7 @@ vl_api_set_ipfix_exporter_t_handler (vl_api_set_ipfix_exporter_t * mp)
     template_interval = 20;
   udp_checksum = mp->udp_checksum;
 
-  if (collector.as_u32 == 0)
-    {
-      rv = VNET_API_ERROR_INVALID_VALUE;
-      goto out;
-    }
-
-  if (src.as_u32 == 0)
+  if (collector.as_u32 != 0 && src.as_u32 == 0)
     {
       rv = VNET_API_ERROR_INVALID_VALUE;
       goto out;