summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/in2out.c
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-05-14 06:20:28 -0700
committerMatus Fabian <matfabia@cisco.com>2018-05-17 01:06:17 -0700
commit70a26ac05f2ab9d4cc0669599b09f654de580f36 (patch)
tree4fd5d9f4a1db0f56d6300f399ae84bb92748edbc /src/plugins/nat/in2out.c
parentf9d0568344b4766bc1ddc1be9a7e9afd00e2d832 (diff)
NAT44: nat44_del_session and nat44_user_session_details API update (VPP-1271)
Change-Id: I484d79000c1bbd87ff83847cf567bf3414a719d3 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/in2out.c')
-rwxr-xr-xsrc/plugins/nat/in2out.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c
index 4a0d2653a81..1659ed0fec3 100755
--- a/src/plugins/nat/in2out.c
+++ b/src/plugins/nat/in2out.c
@@ -498,6 +498,7 @@ nat_not_translate_output_feature_fwd (snat_main_t * sm, ip4_header_t * ip,
udp_header_t *udp;
snat_session_t *s = 0;
snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
+ f64 now = vlib_time_now (sm->vlib_main);
if (!sm->forwarding_enabled)
return 0;
@@ -535,13 +536,16 @@ nat_not_translate_output_feature_fwd (snat_main_t * sm, ip4_header_t * ip,
if (ip->protocol == IP_PROTOCOL_TCP)
{
tcp_header_t *tcp = ip4_next_header(ip);
- if (nat44_set_tcp_session_state (sm, s, tcp, thread_index))
+ if (nat44_set_tcp_session_state_i2o (sm, s, tcp, thread_index))
return 1;
}
/* Per-user LRU list maintenance */
clib_dlist_remove (tsm->list_pool, s->per_user_index);
clib_dlist_addtail (tsm->list_pool, s->per_user_list_head_index,
s->per_user_index);
+ /* Accounting */
+ s->last_heard = now;
+ s->total_pkts++;
return 1;
}
else
@@ -1378,7 +1382,7 @@ snat_in2out_lb (snat_main_t *sm,
{
if (ip->protocol == IP_PROTOCOL_TCP)
{
- if (nat44_set_tcp_session_state (sm, s, tcp, thread_index))
+ if (nat44_set_tcp_session_state_i2o (sm, s, tcp, thread_index))
return 0;
}
/* Per-user LRU list maintenance */
@@ -1477,7 +1481,7 @@ snat_in2out_lb (snat_main_t *sm,
ip->dst_address.as_u32 = s->ext_host_addr.as_u32;
}
tcp->checksum = ip_csum_fold(sum);
- if (nat44_set_tcp_session_state (sm, s, tcp, thread_index))
+ if (nat44_set_tcp_session_state_i2o (sm, s, tcp, thread_index))
return s;
}
else
@@ -1734,8 +1738,6 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
ip4_header_t /* cheat */,
length /* changed member */);
tcp0->checksum = ip_csum_fold(sum0);
- if (nat44_set_tcp_session_state (sm, s0, tcp0, thread_index))
- goto trace00;
}
else
{
@@ -1928,8 +1930,6 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
ip4_header_t /* cheat */,
length /* changed member */);
tcp1->checksum = ip_csum_fold(sum1);
- if (nat44_set_tcp_session_state (sm, s1, tcp1, thread_index))
- goto trace01;
}
else
{
@@ -2159,8 +2159,6 @@ snat_in2out_node_fn_inline (vlib_main_t * vm,
ip4_header_t /* cheat */,
length /* changed member */);
tcp0->checksum = ip_csum_fold(sum0);
- if (nat44_set_tcp_session_state (sm, s0, tcp0, thread_index))
- goto trace0;
}
else
{
@@ -2677,10 +2675,6 @@ nat44_in2out_reass_node_fn (vlib_main_t * vm,
src_address /* changed member */);
ip0->checksum = ip_csum_fold (sum0);
- /* Hairpinning */
- nat44_reass_hairpinning (sm, b0, ip0, s0->out2in.port,
- s0->ext_host_port, proto0);
-
if (PREDICT_FALSE (ip4_is_first_fragment (ip0)))
{
if (PREDICT_TRUE(proto0 == SNAT_PROTOCOL_TCP))
@@ -2697,8 +2691,6 @@ nat44_in2out_reass_node_fn (vlib_main_t * vm,
ip4_header_t /* cheat */,
length /* changed member */);
tcp0->checksum = ip_csum_fold(sum0);
- if (nat44_set_tcp_session_state (sm, s0, tcp0, thread_index))
- goto trace0;
}
else
{
@@ -2708,6 +2700,10 @@ nat44_in2out_reass_node_fn (vlib_main_t * vm,
}
}
+ /* Hairpinning */
+ nat44_reass_hairpinning (sm, b0, ip0, s0->out2in.port,
+ s0->ext_host_port, proto0);
+
/* Accounting */
s0->last_heard = now;
s0->total_pkts++;