diff options
author | Klement Sekera <ksekera@cisco.com> | 2021-03-25 15:39:15 +0100 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-05-26 07:38:01 +0000 |
commit | 2de7e96e6f1d657c124f55a75c8d63d6f05803a7 (patch) | |
tree | 45e0326d1213801396e579e88bcb7ae35fee9ace /src/plugins/nat/nat44-ed/nat44_ed_inlines.h | |
parent | 5fe9457fa2ac49ca7134b09c6886192c7001335c (diff) |
nat: add thread index assertions
Add extra assertions to debug build.
Type: improvement
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: Ib20130365e8f9dbb556fcbb4321dd184c7eff603
Diffstat (limited to 'src/plugins/nat/nat44-ed/nat44_ed_inlines.h')
-rw-r--r-- | src/plugins/nat/nat44-ed/nat44_ed_inlines.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/nat/nat44-ed/nat44_ed_inlines.h b/src/plugins/nat/nat44-ed/nat44_ed_inlines.h index d1cd85e2418..b2b578a5a8b 100644 --- a/src/plugins/nat/nat44-ed/nat44_ed_inlines.h +++ b/src/plugins/nat/nat44-ed/nat44_ed_inlines.h @@ -329,6 +329,8 @@ nat_ed_ses_i2o_flow_hash_add_del (snat_main_t *sm, u32 thread_idx, nat_6t_flow_to_ed_kv (&kv, &s->i2o, thread_idx, s - tsm->sessions); nat_6t_l3_l4_csum_calc (&s->i2o); } + + ASSERT (thread_idx == s->thread_index); return clib_bihash_add_del_16_8 (&sm->flow_hash, &kv, is_add); } @@ -348,6 +350,7 @@ nat_ed_ses_o2i_flow_hash_add_del (snat_main_t *sm, u32 thread_idx, nat_6t_flow_to_ed_kv (&kv, &s->o2i, thread_idx, s - tsm->sessions); nat_6t_l3_l4_csum_calc (&s->o2i); } + ASSERT (thread_idx == s->thread_index); return clib_bihash_add_del_16_8 (&sm->flow_hash, &kv, is_add); } @@ -441,6 +444,9 @@ nat_ed_session_alloc (snat_main_t *sm, u32 thread_index, f64 now, u8 proto) s->ha_last_refreshed = now; vlib_set_simple_counter (&sm->total_sessions, thread_index, 0, pool_elts (tsm->sessions)); +#if CLIB_ASSERT_ENABLE + s->thread_index = thread_index; +#endif return s; } |