aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2021-11-08 20:29:36 +0100
committerOle Tr�an <otroan@employees.org>2021-11-17 09:21:01 +0000
commit9a70cfc0b75dc93423a5f40d14ecbfe373146482 (patch)
tree0d94d8c4e2894ac4558fff4ced76824d329ffcc2
parente0d5af7b4dc6346345d8bdfffaaddd6e98b7111a (diff)
nat: det44 plugin session scavenging fix
det44 plugin process node would only run once on the first plugin enable call. this patch ads the required calls into while loop in the process node funciton. Type: fix Change-Id: I38c94b29fd1e2c842a1330e8628e3019f23f2b69 Signed-off-by: Filip Varga <fivarga@cisco.com>
-rw-r--r--src/plugins/nat/det44/det44.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/plugins/nat/det44/det44.c b/src/plugins/nat/det44/det44.c
index 1dbbfdfdebe..a8aea28d948 100644
--- a/src/plugins/nat/det44/det44.c
+++ b/src/plugins/nat/det44/det44.c
@@ -324,19 +324,29 @@ det44_expire_walk_fn (vlib_main_t * vm, vlib_node_runtime_t * rt,
snat_det_session_t *ses;
snat_det_map_t *mp;
- vlib_process_wait_for_event_or_clock (vm, 10.0);
- vlib_process_get_events (vm, NULL);
- u32 now = (u32) vlib_time_now (vm);
- /* *INDENT-OFF* */
- pool_foreach (mp, dm->det_maps) {
- vec_foreach(ses, mp->sessions)
- {
- /* Delete if session expired */
- if (ses->in_port && (ses->expire < now))
- snat_det_ses_close (mp, ses);
- }
- }
- /* *INDENT-ON* */
+ while (1)
+ {
+ vlib_process_wait_for_event_or_clock (vm, 10.0);
+ vlib_process_get_events (vm, NULL);
+ u32 now = (u32) vlib_time_now (vm);
+
+ if (!plugin_enabled ())
+ {
+ continue;
+ }
+
+ pool_foreach (mp, dm->det_maps)
+ {
+ vec_foreach (ses, mp->sessions)
+ {
+ // close expired sessions
+ if (ses->in_port && (ses->expire < now))
+ {
+ snat_det_ses_close (mp, ses);
+ }
+ }
+ }
+ }
return 0;
}
@@ -374,10 +384,11 @@ det44_plugin_enable (det44_config_t c)
c.inside_vrf_id,
dm->fib_src_hi);
- det44_create_expire_walk_process ();
dm->mss_clamping = 0;
dm->config = c;
dm->enabled = 1;
+
+ det44_create_expire_walk_process ();
return 0;
}
@@ -395,6 +406,8 @@ det44_plugin_disable ()
return 1;
}
+ dm->enabled = 0;
+
// DET44 cleanup (order dependent)
// 1) remove interfaces (det44_interface_add_del) removes map ranges from fib
// 2) free sessions
@@ -436,7 +449,6 @@ det44_plugin_disable ()
/* *INDENT-ON* */
det44_reset_timeouts ();
- dm->enabled = 0;
pool_free (dm->interfaces);
pool_free (dm->det_maps);