aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat64_out2in.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-08-14 05:14:55 -0700
committerOle Trøan <otroan@employees.org>2018-08-15 07:10:05 +0000
commit8fed4240be68b2b4b4b6c531233044f3f1ac70c4 (patch)
treedc4bd618112f64794c96959e4a351a9e23548477 /src/plugins/nat/nat64_out2in.c
parentb11f903ae8824568c5e1bf8312dcf83c7b58b5ee (diff)
NAT64: fix TCP session expire (VPP-1390)
Add missing call of nat64_tcp_session_set_state to set TCP session state. Change-Id: Ifd297ea3ffe20870e1e34a95449b5c9404ec13eb Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat64_out2in.c')
-rw-r--r--src/plugins/nat/nat64_out2in.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c
index f7d4dd417f5..d4b0c3987f9 100644
--- a/src/plugins/nat/nat64_out2in.c
+++ b/src/plugins/nat/nat64_out2in.c
@@ -160,8 +160,6 @@ nat64_out2in_tcp_udp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
nat64_db_st_entry_create (db, bibe, &ip6_saddr, &saddr.ip4, sport);
}
- nat64_session_reset_timeout (ste, ctx->vm);
-
ip6->src_address.as_u64[0] = ste->in_r_addr.as_u64[0];
ip6->src_address.as_u64[1] = ste->in_r_addr.as_u64[1];
@@ -172,13 +170,19 @@ nat64_out2in_tcp_udp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
if (proto == IP_PROTOCOL_UDP)
checksum = &udp->checksum;
else
- checksum = &tcp->checksum;
+ {
+ checksum = &tcp->checksum;
+ nat64_tcp_session_set_state (ste, tcp, 0);
+ }
+
csum = ip_csum_sub_even (*checksum, dport);
csum = ip_csum_add_even (csum, udp->dst_port);
*checksum = ip_csum_fold (csum);
vnet_buffer (ctx->b)->sw_if_index[VLIB_TX] = bibe->fib_index;
+ nat64_session_reset_timeout (ste, ctx->vm);
+
return 0;
}
@@ -573,8 +577,6 @@ nat64_out2in_frag_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
if (!bibe)
return -1;
- nat64_session_reset_timeout (ste, ctx->vm);
-
if (ctx->first_frag)
{
udp->dst_port = bibe->in_port;
@@ -615,6 +617,7 @@ nat64_out2in_frag_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
else
{
tcp_header_t *tcp = ip4_next_header (ip4);
+ nat64_tcp_session_set_state (ste, tcp, 0);
checksum = &tcp->checksum;
csum = ip_csum_sub_even (*checksum, bibe->out_addr.as_u32);
csum = ip_csum_sub_even (csum, ste->out_r_addr.as_u32);
@@ -637,6 +640,8 @@ nat64_out2in_frag_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
vnet_buffer (ctx->b)->sw_if_index[VLIB_TX] = bibe->fib_index;
+ nat64_session_reset_timeout (ste, ctx->vm);
+
return 0;
}