LISP: Fix several control plane message issues, VPP-558
[vpp.git] / plugins / flowperpkt-plugin / flowperpkt / flowperpkt.c
index dbdb189..96c930a 100644 (file)
@@ -143,7 +143,10 @@ flowperpkt_template_rewrite (flow_report_main_t * frm,
   /*
    * Supported Fields:
    *
+   * ingressInterface, TLV type 10, u32
    * egressInterface, TLV type 14, u32
+   * sourceIpv4Address, TLV type 8, u32
+   * destinationIPv4Address, TLV type 12, u32
    * ipClassOfService, TLV type 5, u8
    * flowStartNanoseconds, TLV type 156, dateTimeNanoseconds (f64)
    *   Implementation: f64 nanoseconds since VPP started
@@ -152,8 +155,8 @@ flowperpkt_template_rewrite (flow_report_main_t * frm,
    *   warning: wireshark doesn't understand this TLV at all
    */
 
-  /* Currently 4 fields */
-  field_count += 4;
+  /* Currently 7 fields */
+  field_count += 7;
 
   /* allocate rewrite space */
   vec_validate_aligned (rewrite,
@@ -183,9 +186,18 @@ flowperpkt_template_rewrite (flow_report_main_t * frm,
   h->domain_id = clib_host_to_net_u32 (stream->domain_id);
 
   /* Add TLVs to the template */
+  f->e_id_length = ipfix_e_id_length (0 /* enterprise */ , ingressInterface,
+                                     4);
+  f++;
   f->e_id_length = ipfix_e_id_length (0 /* enterprise */ , egressInterface,
                                      4);
   f++;
+  f->e_id_length = ipfix_e_id_length (0 /* enterprise */ , sourceIPv4Address,
+                                     4);
+  f++;
+  f->e_id_length = ipfix_e_id_length (0 /* enterprise */ ,
+                                     destinationIPv4Address, 4);
+  f++;
   f->e_id_length = ipfix_e_id_length (0 /* enterprise */ , ipClassOfService,
                                      1);
   f++;
@@ -438,6 +450,19 @@ flowperpkt_plugin_api_hookup (vlib_main_t * vm)
   return 0;
 }
 
+#define vl_msg_name_crc_list
+#include <flowperpkt/flowperpkt_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (flowperpkt_main_t * fm, api_main_t * am)
+{
+#define _(id,n,crc) \
+  vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + fm->msg_id_base);
+  foreach_vl_msg_name_crc_flowperpkt;
+#undef _
+}
+
 /**
  * @brief Set up the API message handling tables
  * @param vm vlib_main_t * vlib main data structure pointer
@@ -462,6 +487,9 @@ flowperpkt_init (vlib_main_t * vm)
   /* Hook up message handlers */
   error = flowperpkt_plugin_api_hookup (vm);
 
+  /* Add our API messages to the global name_crc hash table */
+  setup_message_id_table (fm, &api_main);
+
   vec_free (name);
 
   /* Decide how many worker threads we have */