X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fin2out.c;h=1659ed0fec3264bbde810d716217d987aeceb91b;hb=70a26ac05f2ab9d4cc0669599b09f654de580f36;hp=4a0d2653a81525ae82a861a37e7d48e8a5ece10a;hpb=f9d0568344b4766bc1ddc1be9a7e9afd00e2d832;p=vpp.git 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++;