Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
nat: use correct per-thread vlib_main
[vpp.git]
/
src
/
plugins
/
nat
/
lib
/
ipfix_logging.c
diff --git
a/src/plugins/nat/lib/ipfix_logging.c
b/src/plugins/nat/lib/ipfix_logging.c
index
60b3c1f
..
2fb8912
100644
(file)
--- a/
src/plugins/nat/lib/ipfix_logging.c
+++ b/
src/plugins/nat/lib/ipfix_logging.c
@@
-15,6
+15,7
@@
* limitations under the License.
*/
* 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>
#include <vnet/ipfix-export/flow_report.h>
#include <vnet/ip/ip4.h>
#include <vnet/udp/udp_local.h>
@@
-543,7
+544,7
@@
nat_ipfix_send (u32 thread_index, flow_report_main_t * frm,
ipfix_set_header_t *s = 0;
ip4_header_t *ip;
udp_header_t *udp;
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;
tp = vlib_buffer_get_current (b0);
ip = (ip4_header_t *) & tp->ip4;
@@
-577,7
+578,7
@@
nat_ipfix_send (u32 thread_index, flow_report_main_t * frm,
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,
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;
int do_flush)
{
nat_ipfix_logging_main_t *silm = &nat_ipfix_logging_main;
@@
-587,10
+588,11
@@
nat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
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;
u64 now;
u8 proto;
u16 template_id;
+ u32 vrf_id;
proto = nat_proto_to_ip_proto (nat_proto);
proto = nat_proto_to_ip_proto (nat_proto);
@@
-658,6
+660,7
@@
nat_ipfix_logging_nat44_ses (u32 thread_index, u8 nat_event, u32 src_ip,
clib_memcpy_fast (b0->data + offset, &nat_src_port, sizeof (nat_src_port));
offset += sizeof (nat_src_port);
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);
vrf_id = clib_host_to_net_u32 (vrf_id);
clib_memcpy_fast (b0->data + offset, &vrf_id, sizeof (vrf_id));
offset += sizeof (vrf_id);
@@
-689,7
+692,7
@@
nat_ipfix_logging_addr_exhausted (u32 thread_index, u32 pool_id, int do_flush)
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
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;
u64 now;
u8 nat_event = NAT_ADDRESSES_EXHAUTED;
u16 template_id;
@@
-774,7
+777,7
@@
nat_ipfix_logging_max_entries_per_usr (u32 thread_index,
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
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;
u64 now;
u8 nat_event = QUOTA_EXCEEDED;
u32 quota_event = MAX_ENTRIES_PER_USER;
@@
-865,7
+868,7
@@
nat_ipfix_logging_max_ses (u32 thread_index, u32 limit, int do_flush)
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
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;
u64 now;
u8 nat_event = QUOTA_EXCEEDED;
u32 quota_event = MAX_SESSION_ENTRIES;
@@
-953,7
+956,7
@@
nat_ipfix_logging_max_bib (u32 thread_index, u32 limit, int do_flush)
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
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;
u64 now;
u8 nat_event = QUOTA_EXCEEDED;
u32 quota_event = MAX_BIB_ENTRIES;
@@
-1044,7
+1047,7
@@
nat_ipfix_logging_nat64_bibe (u32 thread_index, u8 nat_event,
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
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;
u64 now;
u16 template_id;
@@
-1148,7
+1151,7
@@
nat_ipfix_logging_nat64_ses (u32 thread_index, u8 nat_event,
vlib_buffer_t *b0 = 0;
u32 bi0 = ~0;
u32 offset;
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;
u64 now;
u16 template_id;
@@
-1266,6
+1269,13
@@
nat_ipfix_flush (u32 thread_index)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, do_flush);
}
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)
{
void
nat_ipfix_flush_from_main (void)
{
@@
-1316,13
+1326,13
@@
nat_ipfix_logging_nat44_ses_create (u32 thread_index,
u32 nat_src_ip,
nat_protocol_t nat_proto,
u16 src_port,
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,
{
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);
}
/**
}
/**
@@
-1342,13
+1352,13
@@
nat_ipfix_logging_nat44_ses_delete (u32 thread_index,
u32 nat_src_ip,
nat_protocol_t nat_proto,
u16 src_port,
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,
{
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);
}
/**
}
/**