summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/in2out.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.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.c')
-rwxr-xr-xsrc/plugins/nat/in2out.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c
index d5bd9f5c851..936cd59e1d1 100755
--- a/src/plugins/nat/in2out.c
+++ b/src/plugins/nat/in2out.c
@@ -469,6 +469,7 @@ icmp_match_in2out_slow (snat_main_t * sm, vlib_node_runtime_t * node,
clib_bihash_kv_8_8_t kv0, value0;
u32 next0 = ~0;
int err;
+ vlib_main_t *vm = vlib_get_main ();
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
rx_fib_index0 = ip4_fib_table_get_index_for_sw_if_index (sw_if_index0);
@@ -521,7 +522,7 @@ icmp_match_in2out_slow (snat_main_t * sm, vlib_node_runtime_t * node,
}
next0 = slow_path (sm, b0, ip0, rx_fib_index0, &key0, &s0, node, next0,
- thread_index, vlib_time_now (tsm->vlib_main));
+ thread_index, vlib_time_now (vm));
if (PREDICT_FALSE (next0 == SNAT_IN2OUT_NEXT_DROP))
goto out;
@@ -659,7 +660,7 @@ icmp_in2out (snat_main_t * sm,
vlib_node_runtime_t * node,
u32 next0, u32 thread_index, void *d, void *e)
{
- snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
+ vlib_main_t *vm = vlib_get_main ();
snat_session_key_t sm0;
u8 protocol;
icmp_echo_header_t *echo0, *inner_echo0 = 0;
@@ -687,7 +688,7 @@ icmp_in2out (snat_main_t * sm,
if (PREDICT_TRUE (!ip4_is_fragment (ip0)))
{
sum0 =
- ip_incremental_checksum_buffer (tsm->vlib_main, b0,
+ ip_incremental_checksum_buffer (vm, b0,
(u8 *) icmp0 -
(u8 *) vlib_buffer_get_current (b0),
ntohs (ip0->length) -
@@ -819,7 +820,8 @@ icmp_in2out_slow_path (snat_main_t * sm,
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;
@@ -828,7 +830,7 @@ icmp_in2out_slow_path (snat_main_t * sm,
/* 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);
}