aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat.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/nat.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/nat.c')
-rwxr-xr-xsrc/plugins/nat/nat.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index a1d1f853651..cc0789d1194 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -2549,20 +2549,9 @@ test_ed_make_split ()
ASSERT (value == value2);
}
-always_inline vlib_main_t *
-nat_get_vlib_main (u32 thread_index)
-{
- vlib_main_t *vm;
- vm = vlib_mains[thread_index];
- ASSERT (vm);
- return vm;
-}
-
static clib_error_t *
snat_init (vlib_main_t * vm)
{
- snat_main_per_thread_data_t *tsm;
-
snat_main_t *sm = &snat_main;
clib_error_t *error = 0;
ip4_main_t *im = &ip4_main;
@@ -2680,11 +2669,6 @@ snat_init (vlib_main_t * vm)
sm->per_thread_data[0].snat_thread_index = 0;
}
- vec_foreach (tsm, sm->per_thread_data)
- {
- tsm->vlib_main = nat_get_vlib_main (tsm->thread_index);
- }
-
error = snat_api_init (vm, sm);
if (error)
return error;
@@ -3642,7 +3626,8 @@ nat_ha_sadd_cb (ip4_address_t * in_addr, u16 in_port,
snat_user_t *u;
snat_session_t *s;
clib_bihash_kv_8_8_t kv;
- f64 now = vlib_time_now (tsm->vlib_main);
+ vlib_main_t *vm = vlib_get_main ();
+ f64 now = vlib_time_now (vm);
nat_outside_fib_t *outside_fib;
fib_node_index_t fei = FIB_NODE_INDEX_INVALID;
fib_prefix_t pfx = {
@@ -3789,7 +3774,8 @@ nat_ha_sadd_ed_cb (ip4_address_t * in_addr, u16 in_port,
snat_session_key_t key;
snat_session_t *s;
clib_bihash_kv_16_8_t kv;
- f64 now = vlib_time_now (tsm->vlib_main);
+ vlib_main_t *vm = vlib_get_main ();
+ f64 now = vlib_time_now (vm);
nat_outside_fib_t *outside_fib;
fib_node_index_t fei = FIB_NODE_INDEX_INVALID;
fib_prefix_t pfx = {