aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ipfix-export
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2021-04-28 11:48:39 -0500
committerAndrew Yourtchenko <ayourtch@gmail.com>2021-05-05 10:36:13 +0000
commitbaa18701b9d54d8924771c25b96bd5d99472b7ad (patch)
tree987533dfac0f5d54212d9ca578a32622e518e451 /src/vnet/ipfix-export
parentac0415fac89b186638fbcee1ab9f2cc5cb6d2824 (diff)
misc: ipfix process node wait time adjustment
Type: fix The ipfix process node has a hardcoded 5s sleep between sending packets. The interval between template packets is configurable, but the timing of packets being sent does not match configuration because of the time being hardcoded. E.g. - With template interval set to 3s, a packet will be sent every 5s. With template interval set to 8s, a packet will be sent every 10s. Honor the configuration by reducing the wait time to less than 5s if a template will need to be sent less than 5s from the current time. Change-Id: I8c11f7bc502ce5b20b6e82a7e7a135a8805a2bad Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/vnet/ipfix-export')
-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";