diff options
author | ahdj007 <dong.juan1@zte.com.cn> | 2018-03-07 11:05:35 +0800 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-04-10 10:35:15 +0000 |
commit | 28c2631c3c396da1e2fc62260838f8ce9810d5b5 (patch) | |
tree | b88b3aa5a5d63b5656a3f94be6ce6457a8604291 | |
parent | 5aaea1186e4464c0bcbd165ead4b1782a35bb056 (diff) |
when deleting l3 static mapping with addr_only,
lb session with the same user maybe deleted.
Change-Id: Ie58579cf4f8babb594f3c44aa185720134c58c3d
Signed-off-by: ahdj007 <dong.juan1@zte.com.cn>
-rwxr-xr-x[-rw-r--r--] | src/plugins/nat/nat.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c index b4e5c799ac6..48535d9be0a 100644..100755 --- a/src/plugins/nat/nat.c +++ b/src/plugins/nat/nat.c @@ -1063,6 +1063,9 @@ int snat_add_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, (clib_net_to_host_u16 (s->out2in.port) != e_port)) continue; } + + if (s->flags & SNAT_SESSION_FLAG_LOAD_BALANCING) + continue; nat_free_session_data (sm, s, tsm - sm->per_thread_data); clib_dlist_remove (tsm->list_pool, s->per_user_index); @@ -1073,7 +1076,7 @@ int snat_add_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr, if (!addr_only) break; } - if (addr_only) + if (addr_only && (u->nstaticsessions == 0)) { pool_put (tsm->users, u); clib_bihash_add_del_8_8 (&tsm->user_hash, &kv, 0); |