aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/out2in.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/out2in.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/out2in.c')
-rwxr-xr-xsrc/plugins/nat/out2in.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c
index 411f193ab23..61719c73081 100755
--- a/src/plugins/nat/out2in.c
+++ b/src/plugins/nat/out2in.c
@@ -341,6 +341,7 @@ icmp_match_out2in_slow (snat_main_t * sm, vlib_node_runtime_t * node,
u32 next0 = ~0;
int err;
u8 identity_nat;
+ 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);
@@ -404,7 +405,7 @@ icmp_match_out2in_slow (snat_main_t * sm, vlib_node_runtime_t * node,
/* Create session initiated by host from external network */
s0 = create_session_for_static_mapping (sm, b0, sm0, key0,
node, thread_index,
- vlib_time_now (tsm->vlib_main));
+ vlib_time_now (vm));
if (!s0)
{
@@ -530,7 +531,6 @@ icmp_out2in (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];
snat_session_key_t sm0;
u8 protocol;
icmp_echo_header_t *echo0, *inner_echo0 = 0;
@@ -543,6 +543,7 @@ icmp_out2in (snat_main_t * sm,
ip_csum_t sum0;
u16 checksum0;
u32 next0_tmp;
+ vlib_main_t *vm = vlib_get_main ();
echo0 = (icmp_echo_header_t *) (icmp0 + 1);
@@ -557,7 +558,7 @@ icmp_out2in (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) -
@@ -670,7 +671,8 @@ icmp_out2in_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_out2in (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node,
next0, thread_index, p_s0, 0);
snat_session_t *s0 = *p_s0;
@@ -679,7 +681,7 @@ icmp_out2in_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);
}