* limitations under the License.
*/
-#include <vnet/flow/flow_report.h>
+#include <vnet/ipfix-export/flow_report.h>
#include <vlibmemory/api.h>
+#include <nat/nat_inlines.h>
#include <nat/nat_ipfix_logging.h>
snat_ipfix_logging_main_t snat_ipfix_logging_main;
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, NAT_ADDRESSES_EXHAUTED, 0);
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, NAT44_SESSION_CREATE, 0);
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, QUOTA_EXCEEDED,
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, QUOTA_EXCEEDED,
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, QUOTA_EXCEEDED,
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, QUOTA_EXCEEDED,
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, QUOTA_EXCEEDED,
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, NAT64_BIB_CREATE, 0);
flow_report_t * fr,
ip4_address_t * collector_address,
ip4_address_t * src_address,
- u16 collector_port)
+ u16 collector_port,
+ ipfix_report_element_t *elts,
+ u32 n_elts, u32 *stream_index)
{
return snat_template_rewrite (frm, fr, collector_address, src_address,
collector_port, NAT64_SESSION_CREATE, 0);
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
{
- clib_warning ("can't allocate buffer for NAT IPFIX event");
+ nat_log_err ("can't allocate buffer for NAT IPFIX event");
return;
}
silm->enabled = e;
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.is_add = enable;
a.domain_id = domain_id ? domain_id : 1;
a.src_port = src_port ? src_port : UDP_DST_PORT_ipfix;
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
rv = vnet_flow_report_add_del (frm, &a, NULL);
if (rv)
{
- clib_warning ("vnet_flow_report_add_del returned %d", rv);
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
return -1;
}
+
+ if (sm->endpoint_dependent)
+ {
+ a.rewrite_callback = snat_template_rewrite_max_entries_per_usr;
+ a.flow_data_callback = snat_data_callback_max_entries_per_usr;
+
+ rv = vnet_flow_report_add_del (frm, &a, NULL);
+ if (rv)
+ {
+ nat_log_warn ("vnet_flow_report_add_del returned %d", rv);
+ return -1;
+ }
+ }
}
return 0;