misc: minimize dependencies on udp.h
[vpp.git] / src / plugins / ioam / ipfixcollector / ipfixcollector.c
index 4ae47ed..d4f57c5 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <vnet/ip/ip.h>
 #include <vnet/plugin/plugin.h>
-#include <vnet/ip/udp.h>
+#include <vnet/udp/udp_local.h>
 #include <ioam/ipfixcollector/ipfixcollector.h>
 
 ipfix_collector_main_t ipfix_collector_main;
@@ -26,9 +26,9 @@ ipfix_collector_main_t ipfix_collector_main;
  * This function can be used by other VPP graph nodes to receive IP-FIX packets
  * with a particular setid.
  *
- * @param vlib_main_t Vlib main of the graph node which is interseted in
+ * @param vm Vlib main of the graph node which is interested in
  *                    getting IP-Fix packet.
- * @param ipfix_client_add_del_t Structure describing the client node which
+ * @param info Structure describing the client node which
  *                               is interested in getting the IP-Fix packets for
  *                               a SetID.
  *
@@ -73,6 +73,11 @@ ipfix_collector_reg_setid (vlib_main_t * vm, ipfix_client_add_del_t * info)
   client->set_id = info->ipfix_setid;
 
   hash_set (cm->client_reg_table, info->ipfix_setid, i);
+
+  if (!udp_is_valid_dst_port (UDP_DST_PORT_ipfix, 1))
+    udp_register_dst_port (vm, UDP_DST_PORT_ipfix,
+                          ipfix_collector_node.index, 1);
+
   return 0;
 }
 
@@ -88,9 +93,6 @@ ipfix_collector_init (vlib_main_t * vm)
   cm->client_reg_pool = NULL;
   cm->client_reg_table = hash_create (0, sizeof (uword));
 
-  udp_register_dst_port (vm,
-                        UDP_DST_PORT_ipfix,
-                        ipfix_collector_node.index, 1 /* is_ip4 */ );
   return error;
 }