summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/ipfix-export/flow_report.c16
-rw-r--r--src/vnet/ipfix-export/ipfix_export.api2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/vnet/ipfix-export/flow_report.c b/src/vnet/ipfix-export/flow_report.c
index 5d25bb5d413..760de5f8c66 100644
--- a/src/vnet/ipfix-export/flow_report.c
+++ b/src/vnet/ipfix-export/flow_report.c
@@ -260,7 +260,8 @@ flow_report_process (vlib_main_t * vm,
u32 template_bi;
u32 *to_next;
int send_template;
- f64 now;
+ f64 now, wait_time;
+ f64 def_wait_time = 5.0;
int rv;
uword event_type;
uword *event_data = 0;
@@ -276,14 +277,20 @@ flow_report_process (vlib_main_t * vm,
ip4_lookup_node = vlib_get_node_by_name (vm, (u8 *) "ip4-lookup");
ip4_lookup_node_index = ip4_lookup_node->index;
+ wait_time = def_wait_time;
+
while (1)
{
- vlib_process_wait_for_event_or_clock (vm, 5.0);
+ vlib_process_wait_for_event_or_clock (vm, wait_time);
event_type = vlib_process_get_events (vm, &event_data);
vec_reset_length (event_data);
+ /* 5s delay by default, possibly reduced by template intervals */
+ wait_time = def_wait_time;
+
vec_foreach (fr, frm->reports)
{
+ f64 next_template;
now = vlib_time_now (vm);
/* Need to send a template packet? */
@@ -299,6 +306,11 @@ flow_report_process (vlib_main_t * vm,
if (rv < 0)
continue;
+ /* decide if template should be sent sooner than current wait time */
+ next_template =
+ (fr->last_template_sent + frm->template_interval) - now;
+ wait_time = clib_min (wait_time, next_template);
+
nf = vlib_get_frame_to_node (vm, ip4_lookup_node_index);
nf->n_vectors = 0;
to_next = vlib_frame_vector_args (nf);
diff --git a/src/vnet/ipfix-export/ipfix_export.api b/src/vnet/ipfix-export/ipfix_export.api
index 147d7909252..a70b72bee39 100644
--- a/src/vnet/ipfix-export/ipfix_export.api
+++ b/src/vnet/ipfix-export/ipfix_export.api
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-option version = "2.0.2";
+option version = "2.0.3";
import "vnet/ip/ip_types.api";