aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-09-22 02:43:05 -0700
committerOle Trøan <otroan@employees.org>2017-09-25 07:01:57 +0000
commit41fef50d5db5e7deb3cfd901c3108abbc4406813 (patch)
tree3618d4a8ce87f9b89cedff3624d28b1118a1c218 /src/plugins/nat/nat.c
parentba3c4e88c102afd601fbac0e02de73a28a279a73 (diff)
NAT: session number limitation to avoid running out of memory crash (VPP-984)
Change-Id: I7f18f8c4ba609d96950dc1f833feb967d4a099b7 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat.c')
-rw-r--r--src/plugins/nat/nat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 5f3b006efda..612085fc132 100644
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -2216,6 +2216,8 @@ snat_config (vlib_main_t * vm, unformat_input_t * input)
/* for show commands, etc. */
sm->translation_buckets = translation_buckets;
sm->translation_memory_size = translation_memory_size;
+ /* do not exceed load factor 10 */
+ sm->max_translations = 10 * translation_buckets;
sm->user_buckets = user_buckets;
sm->user_memory_size = user_memory_size;
sm->max_translations_per_user = max_translations_per_user;