API: Change ip4_address and ip6_address to use type alias.
[vpp.git] / src / plugins / nat / nat_ipfix_logging.c
index ef1ab85..042239f 100644 (file)
@@ -15,8 +15,9 @@
  * 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;
@@ -403,7 +404,9 @@ snat_template_rewrite_addr_exhausted (flow_report_main_t * frm,
                                      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);
@@ -414,7 +417,9 @@ snat_template_rewrite_nat44_session (flow_report_main_t * frm,
                                     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);
@@ -425,7 +430,9 @@ snat_template_rewrite_max_entries_per_usr (flow_report_main_t * frm,
                                           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,
@@ -437,7 +444,9 @@ nat_template_rewrite_max_sessions (flow_report_main_t * frm,
                                   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,
@@ -449,7 +458,9 @@ nat_template_rewrite_max_bibs (flow_report_main_t * frm,
                               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,
@@ -461,7 +472,9 @@ nat_template_rewrite_max_frags_ip4 (flow_report_main_t * frm,
                                    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,
@@ -473,7 +486,9 @@ nat_template_rewrite_max_frags_ip6 (flow_report_main_t * frm,
                                    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,
@@ -485,7 +500,9 @@ nat_template_rewrite_nat64_bib (flow_report_main_t * frm,
                                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);
@@ -496,7 +513,9 @@ nat_template_rewrite_nat64_session (flow_report_main_t * frm,
                                    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);
@@ -519,7 +538,7 @@ snat_ipfix_header_create (flow_report_main_t * frm,
   b0->current_data = 0;
   b0->current_length = sizeof (*ip) + sizeof (*udp) + sizeof (*h) +
     sizeof (*s);
-  b0->flags |= (VLIB_BUFFER_TOTAL_LENGTH_VALID | VLIB_BUFFER_FLOW_REPORT);
+  b0->flags |= (VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_FLOW_REPORT);
   vnet_buffer (b0)->sw_if_index[VLIB_RX] = 0;
   vnet_buffer (b0)->sw_if_index[VLIB_TX] = frm->fib_index;
   tp = vlib_buffer_get_current (b0);
@@ -621,7 +640,7 @@ snat_ipfix_logging_nat44_ses (u8 nat_event, u32 src_ip, u32 nat_src_ip,
 
       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;
        }
 
@@ -655,28 +674,28 @@ snat_ipfix_logging_nat44_ses (u8 nat_event, u32 src_ip, u32 nat_src_ip,
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, &src_ip, sizeof (src_ip));
+      clib_memcpy_fast (b0->data + offset, &src_ip, sizeof (src_ip));
       offset += sizeof (src_ip);
 
-      clib_memcpy (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip));
+      clib_memcpy_fast (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip));
       offset += sizeof (nat_src_ip);
 
-      clib_memcpy (b0->data + offset, &proto, sizeof (proto));
+      clib_memcpy_fast (b0->data + offset, &proto, sizeof (proto));
       offset += sizeof (proto);
 
-      clib_memcpy (b0->data + offset, &src_port, sizeof (src_port));
+      clib_memcpy_fast (b0->data + offset, &src_port, sizeof (src_port));
       offset += sizeof (src_port);
 
-      clib_memcpy (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
+      clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
       offset += sizeof (nat_src_port);
 
-      clib_memcpy (b0->data + offset, &vrf_id, sizeof (vrf_id));
+      clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id));
       offset += sizeof (vrf_id);
 
       b0->current_length += NAT44_SESSION_CREATE_LEN;
@@ -722,7 +741,7 @@ snat_ipfix_logging_addr_exhausted (u32 pool_id, int do_flush)
 
       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;
        }
 
@@ -756,13 +775,13 @@ snat_ipfix_logging_addr_exhausted (u32 pool_id, int do_flush)
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, &pool_id, sizeof (pool_id));
+      clib_memcpy_fast (b0->data + offset, &pool_id, sizeof (pool_id));
       offset += sizeof (pool_id);
 
       b0->current_length += NAT_ADDRESSES_EXHAUTED_LEN;
@@ -809,7 +828,7 @@ snat_ipfix_logging_max_entries_per_usr (u32 limit, u32 src_ip, int do_flush)
 
       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;
        }
 
@@ -843,19 +862,19 @@ snat_ipfix_logging_max_entries_per_usr (u32 limit, u32 src_ip, int do_flush)
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, &quota_event, sizeof (quota_event));
+      clib_memcpy_fast (b0->data + offset, &quota_event, sizeof (quota_event));
       offset += sizeof (quota_event);
 
-      clib_memcpy (b0->data + offset, &limit, sizeof (limit));
+      clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit));
       offset += sizeof (limit);
 
-      clib_memcpy (b0->data + offset, &src_ip, sizeof (src_ip));
+      clib_memcpy_fast (b0->data + offset, &src_ip, sizeof (src_ip));
       offset += sizeof (src_ip);
 
       b0->current_length += MAX_ENTRIES_PER_USER_LEN;
@@ -902,7 +921,7 @@ nat_ipfix_logging_max_ses (u32 limit, int do_flush)
 
       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;
        }
 
@@ -936,16 +955,16 @@ nat_ipfix_logging_max_ses (u32 limit, int do_flush)
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, &quota_event, sizeof (quota_event));
+      clib_memcpy_fast (b0->data + offset, &quota_event, sizeof (quota_event));
       offset += sizeof (quota_event);
 
-      clib_memcpy (b0->data + offset, &limit, sizeof (limit));
+      clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit));
       offset += sizeof (limit);
 
       b0->current_length += MAX_SESSIONS_LEN;
@@ -992,7 +1011,7 @@ nat_ipfix_logging_max_bib (u32 limit, int do_flush)
 
       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;
        }
 
@@ -1026,16 +1045,16 @@ nat_ipfix_logging_max_bib (u32 limit, int do_flush)
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, &quota_event, sizeof (quota_event));
+      clib_memcpy_fast (b0->data + offset, &quota_event, sizeof (quota_event));
       offset += sizeof (quota_event);
 
-      clib_memcpy (b0->data + offset, &limit, sizeof (limit));
+      clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit));
       offset += sizeof (limit);
 
       b0->current_length += MAX_BIBS_LEN;
@@ -1082,7 +1101,7 @@ nat_ipfix_logging_max_frag_ip4 (u32 limit, u32 src, int do_flush)
 
       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;
        }
 
@@ -1116,19 +1135,19 @@ nat_ipfix_logging_max_frag_ip4 (u32 limit, u32 src, int do_flush)
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, &quota_event, sizeof (quota_event));
+      clib_memcpy_fast (b0->data + offset, &quota_event, sizeof (quota_event));
       offset += sizeof (quota_event);
 
-      clib_memcpy (b0->data + offset, &limit, sizeof (limit));
+      clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit));
       offset += sizeof (limit);
 
-      clib_memcpy (b0->data + offset, &src, sizeof (src));
+      clib_memcpy_fast (b0->data + offset, &src, sizeof (src));
       offset += sizeof (src);
 
       b0->current_length += MAX_FRAGMENTS_IP4_LEN;
@@ -1175,7 +1194,7 @@ nat_ipfix_logging_max_frag_ip6 (u32 limit, ip6_address_t * src, int do_flush)
 
       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;
        }
 
@@ -1209,19 +1228,19 @@ nat_ipfix_logging_max_frag_ip6 (u32 limit, ip6_address_t * src, int do_flush)
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, &quota_event, sizeof (quota_event));
+      clib_memcpy_fast (b0->data + offset, &quota_event, sizeof (quota_event));
       offset += sizeof (quota_event);
 
-      clib_memcpy (b0->data + offset, &limit, sizeof (limit));
+      clib_memcpy_fast (b0->data + offset, &limit, sizeof (limit));
       offset += sizeof (limit);
 
-      clib_memcpy (b0->data + offset, src, sizeof (ip6_address_t));
+      clib_memcpy_fast (b0->data + offset, src, sizeof (ip6_address_t));
       offset += sizeof (ip6_address_t);
 
       b0->current_length += MAX_FRAGMENTS_IP6_LEN;
@@ -1268,7 +1287,7 @@ nat_ipfix_logging_nat64_bibe (u8 nat_event, ip6_address_t * src_ip,
 
       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;
        }
 
@@ -1302,28 +1321,28 @@ nat_ipfix_logging_nat64_bibe (u8 nat_event, ip6_address_t * src_ip,
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, src_ip, sizeof (ip6_address_t));
+      clib_memcpy_fast (b0->data + offset, src_ip, sizeof (ip6_address_t));
       offset += sizeof (ip6_address_t);
 
-      clib_memcpy (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip));
+      clib_memcpy_fast (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip));
       offset += sizeof (nat_src_ip);
 
-      clib_memcpy (b0->data + offset, &proto, sizeof (proto));
+      clib_memcpy_fast (b0->data + offset, &proto, sizeof (proto));
       offset += sizeof (proto);
 
-      clib_memcpy (b0->data + offset, &src_port, sizeof (src_port));
+      clib_memcpy_fast (b0->data + offset, &src_port, sizeof (src_port));
       offset += sizeof (src_port);
 
-      clib_memcpy (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
+      clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
       offset += sizeof (nat_src_port);
 
-      clib_memcpy (b0->data + offset, &vrf_id, sizeof (vrf_id));
+      clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id));
       offset += sizeof (vrf_id);
 
       b0->current_length += NAT64_BIB_LEN;
@@ -1372,7 +1391,7 @@ nat_ipfix_logging_nat64_ses (u8 nat_event, ip6_address_t * src_ip,
 
       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;
        }
 
@@ -1406,40 +1425,40 @@ nat_ipfix_logging_nat64_ses (u8 nat_event, ip6_address_t * src_ip,
   if (PREDICT_TRUE (do_flush == 0))
     {
       u64 time_stamp = clib_host_to_net_u64 (now);
-      clib_memcpy (b0->data + offset, &time_stamp, sizeof (time_stamp));
+      clib_memcpy_fast (b0->data + offset, &time_stamp, sizeof (time_stamp));
       offset += sizeof (time_stamp);
 
-      clib_memcpy (b0->data + offset, &nat_event, sizeof (nat_event));
+      clib_memcpy_fast (b0->data + offset, &nat_event, sizeof (nat_event));
       offset += sizeof (nat_event);
 
-      clib_memcpy (b0->data + offset, src_ip, sizeof (ip6_address_t));
+      clib_memcpy_fast (b0->data + offset, src_ip, sizeof (ip6_address_t));
       offset += sizeof (ip6_address_t);
 
-      clib_memcpy (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip));
+      clib_memcpy_fast (b0->data + offset, &nat_src_ip, sizeof (nat_src_ip));
       offset += sizeof (nat_src_ip);
 
-      clib_memcpy (b0->data + offset, &proto, sizeof (proto));
+      clib_memcpy_fast (b0->data + offset, &proto, sizeof (proto));
       offset += sizeof (proto);
 
-      clib_memcpy (b0->data + offset, &src_port, sizeof (src_port));
+      clib_memcpy_fast (b0->data + offset, &src_port, sizeof (src_port));
       offset += sizeof (src_port);
 
-      clib_memcpy (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
+      clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
       offset += sizeof (nat_src_port);
 
-      clib_memcpy (b0->data + offset, dst_ip, sizeof (ip6_address_t));
+      clib_memcpy_fast (b0->data + offset, dst_ip, sizeof (ip6_address_t));
       offset += sizeof (ip6_address_t);
 
-      clib_memcpy (b0->data + offset, &nat_dst_ip, sizeof (nat_dst_ip));
+      clib_memcpy_fast (b0->data + offset, &nat_dst_ip, sizeof (nat_dst_ip));
       offset += sizeof (nat_dst_ip);
 
-      clib_memcpy (b0->data + offset, &dst_port, sizeof (dst_port));
+      clib_memcpy_fast (b0->data + offset, &dst_port, sizeof (dst_port));
       offset += sizeof (dst_port);
 
-      clib_memcpy (b0->data + offset, &nat_dst_port, sizeof (nat_dst_port));
+      clib_memcpy_fast (b0->data + offset, &nat_dst_port, sizeof (nat_dst_port));
       offset += sizeof (nat_dst_port);
 
-      clib_memcpy (b0->data + offset, &vrf_id, sizeof (vrf_id));
+      clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id));
       offset += sizeof (vrf_id);
 
       b0->current_length += NAT64_SES_LEN;
@@ -1910,7 +1929,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
 
   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;
@@ -1923,7 +1942,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
     }
@@ -1935,7 +1954,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
 
@@ -1945,7 +1964,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
 
@@ -1955,7 +1974,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
 
@@ -1965,7 +1984,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
 
@@ -1975,7 +1994,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
 
@@ -1985,7 +2004,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
 
@@ -1995,7 +2014,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;
        }
 
@@ -2005,9 +2024,22 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
       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;