X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fout2in_ed.c;h=5b70b0c672aea09a30bc78c07c689671c5e83c8d;hb=ba5f9bc7534bcf58225b0658993728b1f4d47a67;hp=69436145a67a411f4b833e85674a864c92874045;hpb=1c2ac860ed9a80dac539af6408d70f7dfd2c238e;p=vpp.git diff --git a/src/plugins/nat/out2in_ed.c b/src/plugins/nat/out2in_ed.c index 69436145a67..5b70b0c672a 100644 --- a/src/plugins/nat/out2in_ed.c +++ b/src/plugins/nat/out2in_ed.c @@ -131,6 +131,16 @@ nat44_o2i_ed_is_idle_session_cb (clib_bihash_kv_16_8_t * kv, void *arg) if (clib_bihash_add_del_16_8 (&tsm->in2out_ed, &ed_kv, 0)) nat_elog_warn ("in2out_ed key del failed"); + ed_bihash_kv_t bihash_key; + clib_memset (&bihash_key, 0, sizeof (bihash_key)); + bihash_key.k.dst_address = s->ext_host_addr.as_u32; + bihash_key.k.dst_port = s->ext_host_port; + bihash_key.k.src_address = s->out2in.addr.as_u32; + bihash_key.k.src_port = s->out2in.port; + bihash_key.k.protocol = s->out2in.protocol; + clib_bihash_add_del_16_8 (&sm->ed_ext_ports, &bihash_key.kv, + 0 /* is_add */ ); + if (snat_is_unk_proto_session (s)) goto delete; @@ -683,7 +693,6 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm, snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index]; u32 tcp_packets = 0, udp_packets = 0, icmp_packets = 0, other_packets = 0, fragments = 0; - u32 tcp_closed_drops = 0; stats_node_index = sm->ed_out2in_node_index; @@ -779,7 +788,6 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm, { // session in transitory timeout, drop b0->error = node->errors[NAT_OUT2IN_ED_ERROR_TCP_CLOSED]; - ++tcp_closed_drops; next0 = NAT_NEXT_DROP; } goto trace0; @@ -791,12 +799,10 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm, (f64) nat44_session_get_timeout (sm, s0); if (now >= sess_timeout_time) { - // delete session + // session is closed, go slow path nat_free_session_data (sm, s0, thread_index, 0); nat44_delete_session (sm, s0, thread_index); - - b0->error = node->errors[NAT_OUT2IN_ED_ERROR_SESS_EXPIRED]; - next0 = NAT_NEXT_DROP; + next0 = NAT_NEXT_OUT2IN_ED_SLOW_PATH; goto trace0; } // @@ -1026,13 +1032,13 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm, s0 = nat44_ed_out2in_unknown_proto (sm, b0, ip0, rx_fib_index0, thread_index, now, vm, node); - other_packets++; if (!sm->forwarding_enabled) { if (!s0) next0 = NAT_NEXT_DROP; - goto trace0; } + other_packets++; + goto trace0; } if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP))