summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipfix-export/flow_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ipfix-export/flow_api.c')
-rw-r--r--src/vnet/ipfix-export/flow_api.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/vnet/ipfix-export/flow_api.c b/src/vnet/ipfix-export/flow_api.c
index e89f1a63ce6..959671d3751 100644
--- a/src/vnet/ipfix-export/flow_api.c
+++ b/src/vnet/ipfix-export/flow_api.c
@@ -51,13 +51,15 @@ _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \
_(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \
_(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \
_(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \
-_(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump)
+_(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \
+_(IPFIX_FLUSH, ipfix_flush)
static void
vl_api_set_ipfix_exporter_t_handler (vl_api_set_ipfix_exporter_t * mp)
{
vlib_main_t *vm = vlib_get_main ();
flow_report_main_t *frm = &flow_report_main;
+ vl_api_registration_t *reg;
vl_api_set_ipfix_exporter_reply_t *rmp;
ip4_address_t collector, src;
u16 collector_port = UDP_DST_PORT_ipfix;
@@ -68,6 +70,10 @@ vl_api_set_ipfix_exporter_t_handler (vl_api_set_ipfix_exporter_t * mp)
u32 fib_index = ~0;
int rv = 0;
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
memcpy (collector.data, mp->collector_address, sizeof (collector.data));
collector_port = ntohs (mp->collector_port);
if (collector_port == (u16) ~ 0)
@@ -155,7 +161,7 @@ vl_api_ipfix_exporter_dump_t_handler (vl_api_ipfix_exporter_dump_t * mp)
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
- return;;
+ return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
@@ -233,6 +239,7 @@ static void
(vl_api_ipfix_classify_table_add_del_t * mp)
{
vl_api_ipfix_classify_table_add_del_reply_t *rmp;
+ vl_api_registration_t *reg;
flow_report_classify_main_t *fcm = &flow_report_classify_main;
flow_report_main_t *frm = &flow_report_main;
vnet_flow_report_add_del_args_t args;
@@ -243,6 +250,10 @@ static void
u8 transport_protocol;
int rv = 0;
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
classify_table_index = ntohl (mp->table_id);
ip_version = mp->ip_version;
transport_protocol = mp->transport_protocol;
@@ -343,6 +354,25 @@ static void
send_ipfix_classify_table_details (i, reg, mp->context);
}
+static void
+vl_api_ipfix_flush_t_handler (vl_api_ipfix_flush_t * mp)
+{
+ vl_api_ipfix_flush_reply_t *rmp;
+ vl_api_registration_t *reg;
+ vlib_main_t *vm = vlib_get_main ();
+ int rv = 0;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ /* poke the flow reporting process */
+ vlib_process_signal_event (vm, flow_report_process_node.index,
+ 1 /* type_opaque */ , 0 /* data */ );
+
+ REPLY_MACRO (VL_API_IPFIX_FLUSH_REPLY);
+}
+
/*
* flow_api_hookup
* Add vpe's API message handlers to the table.