summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-04-18 01:39:17 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-18 15:12:41 +0000
commit36ed73acb16c54d556ffd2bba10f0be05cc66ffb (patch)
tree784f3b9c1f532fc500129c70587bf18618631cdd /src/plugins/nat/nat.c
parent2629c841c789eb3e23050e35d84a9998afdd91bf (diff)
NAT44: recycle old sessions for forwarding bypass (VPP-1240)
Change-Id: I7e6b0e7e91cc032b1685f35de5d84363a85158a5 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat.c')
-rwxr-xr-xsrc/plugins/nat/nat.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 764bc1db6bb..51fbb1336e1 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -152,6 +152,21 @@ nat_free_session_data (snat_main_t * sm, snat_session_t * s, u32 thread_index)
snat_main_per_thread_data_t *tsm =
vec_elt_at_index (sm->per_thread_data, thread_index);
+ if (is_fwd_bypass_session (s))
+ {
+ ed_key.l_addr = s->in2out.addr;
+ ed_key.r_addr = s->ext_host_addr;
+ ed_key.l_port = s->in2out.port;
+ ed_key.r_port = s->ext_host_port;
+ ed_key.proto = snat_proto_to_ip_proto (s->in2out.protocol);
+ ed_key.fib_index = 0;
+ ed_kv.key[0] = ed_key.as_u64[0];
+ ed_kv.key[1] = ed_key.as_u64[1];
+ if (clib_bihash_add_del_16_8 (&sm->in2out_ed, &ed_kv, 0))
+ clib_warning ("in2out_ed key del failed");
+ return;
+ }
+
/* Endpoint dependent session lookup tables */
if (is_ed_session (s))
{