* limitations under the License.
*/
+#include <vnet/fib/fib_table.h>
#include <vnet/ipfix-export/flow_report.h>
#include <vnet/ip/ip4.h>
#include <vnet/udp/udp_local.h>
ipfix_set_header_t *s = 0;
ip4_header_t *ip;
udp_header_t *udp;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
tp = vlib_buffer_get_current (b0);
ip = (ip4_header_t *) & tp->ip4;
static void
nat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
u32 nat_src_ip, nat_protocol_t nat_proto,
- u16 src_port, u16 nat_src_port, u32 vrf_id,
+ u16 src_port, u16 nat_src_port, u32 fib_index,
int do_flush)
{
nat_ipfix_logging_main_t *silm = &nat_ipfix_logging_main;
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
u64 now;
u8 proto;
u16 template_id;
+ u32 vrf_id;
proto = nat_proto_to_ip_proto (nat_proto);
clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
offset += sizeof (nat_src_port);
+ vrf_id = fib_table_get_table_id (fib_index, FIB_PROTOCOL_IP4);
vrf_id = clib_host_to_net_u32 (vrf_id);
clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id));
offset += sizeof (vrf_id);
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
u64 now;
u8 nat_event = NAT_ADDRESSES_EXHAUTED;
u16 template_id;
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
u64 now;
u8 nat_event = QUOTA_EXCEEDED;
u32 quota_event = MAX_ENTRIES_PER_USER;
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
u64 now;
u8 nat_event = QUOTA_EXCEEDED;
u32 quota_event = MAX_SESSION_ENTRIES;
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
u64 now;
u8 nat_event = QUOTA_EXCEEDED;
u32 quota_event = MAX_BIB_ENTRIES;
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
u64 now;
u16 template_id;
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
u64 now;
u16 template_id;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, do_flush);
}
+int
+nat_ipfix_logging_enabled ()
+{
+ nat_ipfix_logging_main_t *silm = &nat_ipfix_logging_main;
+ return !clib_atomic_fetch_or(&silm->enabled, 0);
+}
+
void
nat_ipfix_flush_from_main (void)
{
u32 nat_src_ip,
nat_protocol_t nat_proto,
u16 src_port,
- u16 nat_src_port, u32 vrf_id)
+ u16 nat_src_port, u32 fib_index)
{
skip_if_disabled ();
nat_ipfix_logging_nat44_ses (thread_index, NAT44_SESSION_CREATE, src_ip,
nat_src_ip, nat_proto, src_port, nat_src_port,
- vrf_id, 0);
+ fib_index, 0);
}
/**
u32 nat_src_ip,
nat_protocol_t nat_proto,
u16 src_port,
- u16 nat_src_port, u32 vrf_id)
+ u16 nat_src_port, u32 fib_index)
{
skip_if_disabled ();
nat_ipfix_logging_nat44_ses (thread_index, NAT44_SESSION_DELETE, src_ip,
nat_src_ip, nat_proto, src_port, nat_src_port,
- vrf_id, 0);
+ fib_index, 0);
}
/**