aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-04-16 13:20:25 +0200
committerFilip Varga <fivarga@cisco.com>2020-05-04 12:15:02 +0200
commit6bb080f1e54391b161cf211a9cfa3f488f2fd331 (patch)
tree8af5f6df9baaacb2a6f10af8ff51e48f7de0846a /src/plugins/nat/nat44
parent2f1563129ad8d34d365f5ef8620ff76ff7b08e70 (diff)
nat: per vrf session limits
Type: improvement Change-Id: I170256ab47978db34fb0ff6808d9cd54ab872410 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44')
-rw-r--r--src/plugins/nat/nat44/inlines.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/nat/nat44/inlines.h b/src/plugins/nat/nat44/inlines.h
index 3c88e15c05e..5cd4164acc8 100644
--- a/src/plugins/nat/nat44/inlines.h
+++ b/src/plugins/nat/nat44/inlines.h
@@ -31,6 +31,17 @@ nat44_maximum_sessions_exceeded (snat_main_t * sm, u32 thread_index)
return 0;
}
+static_always_inline u8
+nat44_ed_maximum_sessions_exceeded (snat_main_t * sm,
+ u32 fib_index, u32 thread_index)
+{
+ u32 translations;
+ translations = pool_elts (sm->per_thread_data[thread_index].sessions);
+ if (vec_len (sm->max_translations_per_fib) <= fib_index)
+ fib_index = 0;
+ return translations >= sm->max_translations_per_fib[fib_index];
+}
+
static_always_inline snat_session_t *
nat44_session_reuse_old (snat_main_t * sm, snat_user_t * u,
snat_session_t * s, u32 thread_index, f64 now)