From 132dc49ee847a3e3b644de8b36499d73e8a8d37e Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Wed, 9 May 2018 04:51:03 -0700 Subject: NAT44: sessions counters per user fix (VPP-1270) Change-Id: I6306b81e0e1c3e1c591f929a76bb265c1c1d0859 Signed-off-by: Matus Fabian --- src/plugins/nat/nat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c index 68b43c05ea1..4f9b04ad4b0 100755 --- a/src/plugins/nat/nat.c +++ b/src/plugins/nat/nat.c @@ -334,6 +334,10 @@ nat_session_alloc_or_recycle (snat_main_t *sm, snat_user_t *u, u32 thread_index) /* Get the session */ s = pool_elt_at_index (tsm->sessions, session_index); nat_free_session_data (sm, s, thread_index); + if (snat_is_session_static(s)) + u->nstaticsessions--; + else + u->nsessions--; s->outside_address_index = ~0; s->flags = 0; s->total_bytes = 0; @@ -975,12 +979,8 @@ int snat_add_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, if (snat_is_session_static (s)) continue; - if (!addr_only) - { - if ((s->out2in.addr.as_u32 != e_addr.as_u32) && - (clib_net_to_host_u16 (s->out2in.port) != e_port)) - continue; - } + if (!addr_only && (clib_net_to_host_u16 (s->out2in.port) != m->local_port)) + continue; nat_free_session_data (sm, s, tsm - sm->per_thread_data); clib_dlist_remove (tsm->list_pool, s->per_user_index); -- cgit 1.2.3-korg