summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/in2out_ed.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2020-05-08 10:02:18 +0200
committerDave Barach <openvpp@barachs.net>2020-05-08 11:23:18 +0000
commit71f62a52a2abaeb8b4fc8c70fde501fa7400417c (patch)
treea7029fc7fe7659d3b5a6d990bb1b83b997b47002 /src/plugins/nat/in2out_ed.c
parent88d6ce2bee53b7c9f876aa78c5db8ab1ea75c08a (diff)
nat: fix per thread data vlib_main_t usage take 2
The original fix access vlib_main before these was initialized. Removed cached vlib_mains structure. Type: fix Fixes: 9bb09afb56b1aa787ca574cc732085272059fd5f Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I686bab9220e27891f66bf60489c1602855786aa8 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/nat/in2out_ed.c')
-rw-r--r--src/plugins/nat/in2out_ed.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/nat/in2out_ed.c b/src/plugins/nat/in2out_ed.c
index 6e44ddb6f76..f96f6367781 100644
--- a/src/plugins/nat/in2out_ed.c
+++ b/src/plugins/nat/in2out_ed.c
@@ -170,7 +170,8 @@ icmp_in2out_ed_slow_path (snat_main_t * sm, vlib_buffer_t * b0,
vlib_node_runtime_t * node, u32 next0, f64 now,
u32 thread_index, snat_session_t ** p_s0)
{
- snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
+
next0 = icmp_in2out (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node,
next0, thread_index, p_s0, 0);
snat_session_t *s0 = *p_s0;
@@ -179,7 +180,7 @@ icmp_in2out_ed_slow_path (snat_main_t * sm, vlib_buffer_t * b0,
/* Accounting */
nat44_session_update_counters (s0, now,
vlib_buffer_length_in_chain
- (tsm->vlib_main, b0), thread_index);
+ (vm, b0), thread_index);
/* Per-user LRU list maintenance */
nat44_session_update_lru (sm, s0, thread_index);
}
@@ -645,6 +646,7 @@ icmp_match_in2out_ed (snat_main_t * sm, vlib_node_runtime_t * node,
u32 next = ~0;
int err;
u16 l_port = 0, r_port = 0; // initialize to workaround gcc warning
+ vlib_main_t *vm = vlib_get_main ();
snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
@@ -697,7 +699,7 @@ icmp_match_in2out_ed (snat_main_t * sm, vlib_node_runtime_t * node,
next =
slow_path_ed (sm, b, ip->src_address, ip->dst_address, l_port, r_port,
ip->protocol, rx_fib_index, &s, node, next,
- thread_index, vlib_time_now (tsm->vlib_main));
+ thread_index, vlib_time_now (vm));
if (PREDICT_FALSE (next == NAT_NEXT_DROP))
goto out;