aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-04-19 19:44:49 +0200
committerOle Trøan <otroan@employees.org>2020-05-06 08:46:45 +0000
commitc611f36bbc75a7157bbec26a78178872ddc5441f (patch)
treed1ad9d56d69f7e8b6284ab5d8d25c0671cdd5f59 /src/plugins/nat/nat44
parente4deacc4220511c5ee93eca6b059d2a64ab1d36c (diff)
nat: enable force session cleanup
Force session cleanup drops NAT db. Also fixing user specific cli/api calls. Type: improvement Change-Id: Ia3e25fcf07fe5fb9a83d55c03fe90aca727b41ac Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44')
-rw-r--r--src/plugins/nat/nat44/inlines.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/nat/nat44/inlines.h b/src/plugins/nat/nat44/inlines.h
index 229daa2425e..a5118ea2fa6 100644
--- a/src/plugins/nat/nat44/inlines.h
+++ b/src/plugins/nat/nat44/inlines.h
@@ -78,6 +78,28 @@ nat44_global_lru_insert (snat_main_per_thread_data_t * tsm,
}
static_always_inline void
+nat44_sessions_clear ()
+{
+ snat_main_t *sm = &snat_main;
+ snat_main_per_thread_data_t *tsm;
+
+ /* *INDENT-OFF* */
+ vec_foreach (tsm, sm->per_thread_data)
+ {
+ u32 ti;
+
+ nat44_db_free (tsm);
+ nat44_db_init (tsm);
+
+ ti = tsm->snat_thread_index;
+ // clear per thread session counters
+ vlib_set_simple_counter (&sm->total_users, ti, 0, 0);
+ vlib_set_simple_counter (&sm->total_sessions, ti, 0, 0);
+ }
+ /* *INDENT-ON* */
+}
+
+static_always_inline void
nat44_user_del_sessions (snat_user_t * u, u32 thread_index)
{
dlist_elt_t *elt;
@@ -113,6 +135,9 @@ nat44_user_del (ip4_address_t * addr, u32 fib_index)
snat_user_key_t user_key;
clib_bihash_kv_8_8_t kv, value;
+ if (sm->deterministic || sm->endpoint_dependent)
+ return rv;
+
user_key.addr.as_u32 = addr->as_u32;
user_key.fib_index = fib_index;
kv.key = user_key.as_u64;