summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44/inlines.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat/nat44/inlines.h')
-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)