aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat')
-rw-r--r--src/plugins/nat/lib/ipfix_logging.c12
-rw-r--r--src/plugins/nat/nat44-ei/nat44_ei_ha.c8
-rw-r--r--src/plugins/nat/nat64/nat64.c8
-rw-r--r--src/plugins/nat/pnat/tests/pnat_test.c8
4 files changed, 18 insertions, 18 deletions
diff --git a/src/plugins/nat/lib/ipfix_logging.c b/src/plugins/nat/lib/ipfix_logging.c
index d4ede6bdd95..38a2cc9931b 100644
--- a/src/plugins/nat/lib/ipfix_logging.c
+++ b/src/plugins/nat/lib/ipfix_logging.c
@@ -1288,12 +1288,12 @@ nat_ipfix_flush_from_main (void)
if (PREDICT_FALSE (!silm->worker_vms))
{
- for (i = 1; i < vec_len (vlib_mains); i++)
- {
- worker_vm = vlib_mains[i];
- if (worker_vm)
- vec_add1 (silm->worker_vms, worker_vm);
- }
+ for (i = 1; i < vlib_get_n_threads (); i++)
+ {
+ worker_vm = vlib_get_main_by_index (i);
+ if (worker_vm)
+ vec_add1 (silm->worker_vms, worker_vm);
+ }
}
/* Trigger flush for each worker thread */
diff --git a/src/plugins/nat/nat44-ei/nat44_ei_ha.c b/src/plugins/nat/nat44-ei/nat44_ei_ha.c
index ca99efcf8ca..3d634dc61f2 100644
--- a/src/plugins/nat/nat44-ei/nat44_ei_ha.c
+++ b/src/plugins/nat/nat44-ei/nat44_ei_ha.c
@@ -711,7 +711,7 @@ nat_ha_send (vlib_frame_t * f, vlib_buffer_t * b, u8 is_resync,
nat_ha_message_header_t *h;
ip4_header_t *ip;
udp_header_t *udp;
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main_by_index (thread_index);
ip = vlib_buffer_get_current (b);
udp = ip4_next_header (ip);
@@ -737,7 +737,7 @@ nat_ha_event_add (nat_ha_event_t * event, u8 do_flush, u32 thread_index,
nat44_ei_main_t *nm = &nat44_ei_main;
nat_ha_main_t *ha = &nat_ha_main;
nat_ha_per_thread_data_t *td = &ha->per_thread_data[thread_index];
- vlib_main_t *vm = vlib_mains[thread_index];
+ vlib_main_t *vm = vlib_get_main_by_index (thread_index);
vlib_buffer_t *b = 0;
vlib_frame_t *f;
u32 bi = ~0, offset;
@@ -967,12 +967,12 @@ nat_ha_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
vlib_process_wait_for_event_or_clock (vm, 1.0);
event_type = vlib_process_get_events (vm, &event_data);
vec_reset_length (event_data);
- for (ti = 0; ti < vec_len (vlib_mains); ti++)
+ for (ti = 0; ti < vlib_get_n_threads (); ti++)
{
if (ti >= vec_len (ha->per_thread_data))
continue;
- vlib_node_set_interrupt_pending (vlib_mains[ti],
+ vlib_node_set_interrupt_pending (vlib_get_main_by_index (ti),
nat_ha_worker_node.index);
}
}
diff --git a/src/plugins/nat/nat64/nat64.c b/src/plugins/nat/nat64/nat64.c
index 6e5ceecb76f..1c1cdfba3fb 100644
--- a/src/plugins/nat/nat64/nat64.c
+++ b/src/plugins/nat/nat64/nat64.c
@@ -998,7 +998,7 @@ nat64_add_del_static_bib_entry (ip6_address_t * in_addr,
static_bib->is_add = is_add;
static_bib->thread_index = thread_index;
static_bib->done = 0;
- worker_vm = vlib_mains[thread_index];
+ worker_vm = vlib_get_main_by_index (thread_index);
if (worker_vm)
vlib_node_set_interrupt_pending (worker_vm,
nat64_static_bib_worker_node.index);
@@ -1452,13 +1452,13 @@ nat64_expire_walk_fn (vlib_main_t * vm, vlib_node_runtime_t * rt,
int i;
uword event_type, *event_data = 0;
- if (vec_len (vlib_mains) == 0)
+ if (vlib_get_n_threads () == 0)
vec_add1 (worker_vms, vm);
else
{
- for (i = 0; i < vec_len (vlib_mains); i++)
+ for (i = 0; i < vlib_get_n_threads (); i++)
{
- worker_vm = vlib_mains[i];
+ worker_vm = vlib_get_main_by_index (i);
if (worker_vm)
vec_add1 (worker_vms, worker_vm);
}
diff --git a/src/plugins/nat/pnat/tests/pnat_test.c b/src/plugins/nat/pnat/tests/pnat_test.c
index ab55e7ef49d..fd91ab2f88a 100644
--- a/src/plugins/nat/pnat/tests/pnat_test.c
+++ b/src/plugins/nat/pnat/tests/pnat_test.c
@@ -347,7 +347,7 @@ extern vlib_node_registration_t pnat_input_node;
static void test_table(test_t *t, int no_tests) {
// walk through table of tests
int i;
- vlib_main_t *vm = &vlib_global_main;
+ vlib_main_t *vm = vlib_get_first_main();
/* Generate packet data */
for (i = 0; i < no_tests; i++) {
@@ -376,7 +376,7 @@ static void test_table(test_t *t, int no_tests) {
void test_performance(void) {
pnat_main_t *pm = &pnat_main;
int i;
- vlib_main_t *vm = &vlib_global_main;
+ vlib_main_t *vm = vlib_get_first_main();
for (i = 0; i < sizeof(rules) / sizeof(rules[0]); i++) {
add_translation(&rules[i]);
@@ -505,7 +505,7 @@ void test_api(void) {
void test_checksum(void) {
int i;
- vlib_main_t *vm = &vlib_global_main;
+ vlib_main_t *vm = vlib_get_first_main();
pnat_main_t *pm = &pnat_main;
test_t test = {
@@ -559,7 +559,7 @@ int main(int argc, char **argv) {
clib_mem_init(0, 3ULL << 30);
- vlib_main_t *vm = &vlib_global_main;
+ vlib_main_t *vm = vlib_get_first_main();
buffers_vector = buffer_init(buffers_vector, 256);