X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnat%2Fout2in.c;h=5029300dcdba8fc86c380a49bcb2bea90248e4f4;hb=ea5b5be4eeb0f4cd80cb466bd6e31cad33c57960;hp=156b7283fef3aa2f97d1c6df9f0b1a74904001c3;hpb=c79396e1f8ba395f3d6625f463cd9a6c8d505799;p=vpp.git diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c index 156b7283fef..5029300dcdb 100755 --- a/src/plugins/nat/out2in.c +++ b/src/plugins/nat/out2in.c @@ -140,6 +140,43 @@ typedef enum { SNAT_OUT2IN_N_NEXT, } snat_out2in_next_t; +int +nat44_o2i_is_idle_session_cb (clib_bihash_kv_8_8_t * kv, void * arg) +{ + snat_main_t *sm = &snat_main; + nat44_is_idle_session_ctx_t *ctx = arg; + snat_session_t *s; + u64 sess_timeout_time; + snat_main_per_thread_data_t *tsm = vec_elt_at_index (sm->per_thread_data, + ctx->thread_index); + clib_bihash_kv_8_8_t s_kv; + + s = pool_elt_at_index (tsm->sessions, kv->value); + sess_timeout_time = s->last_heard + (f64)nat44_session_get_timeout(sm, s); + if (ctx->now >= sess_timeout_time) + { + s_kv.key = s->in2out.as_u64; + if (clib_bihash_add_del_8_8 (&tsm->in2out, &s_kv, 0)) + nat_log_warn ("out2in key del failed"); + + snat_ipfix_logging_nat44_ses_delete(s->in2out.addr.as_u32, + s->out2in.addr.as_u32, + s->in2out.protocol, + s->in2out.port, + s->out2in.port, + s->in2out.fib_index); + + if (!snat_is_session_static (s)) + snat_free_outside_address_and_port (sm->addresses, ctx->thread_index, + &s->out2in); + + nat44_delete_session (sm, s, ctx->thread_index); + return 1; + } + + return 0; +} + /** * @brief Create session for static mapping. * @@ -160,13 +197,15 @@ create_session_for_static_mapping (snat_main_t *sm, snat_session_key_t in2out, snat_session_key_t out2in, vlib_node_runtime_t * node, - u32 thread_index) + u32 thread_index, + f64 now) { snat_user_t *u; snat_session_t *s; clib_bihash_kv_8_8_t kv0; ip4_header_t *ip0; udp_header_t *udp0; + nat44_is_idle_session_ctx_t ctx0; if (PREDICT_FALSE (maximum_sessions_exceeded(sm, thread_index))) { @@ -188,6 +227,7 @@ create_session_for_static_mapping (snat_main_t *sm, s = nat_session_alloc_or_recycle (sm, u, thread_index); if (!s) { + nat44_delete_user_with_no_session (sm, u, thread_index); nat_log_warn ("create NAT session failed"); return 0; } @@ -202,16 +242,20 @@ create_session_for_static_mapping (snat_main_t *sm, s->in2out.protocol = out2in.protocol; /* Add to translation hashes */ + ctx0.now = now; + ctx0.thread_index = thread_index; kv0.key = s->in2out.as_u64; kv0.value = s - sm->per_thread_data[thread_index].sessions; - if (clib_bihash_add_del_8_8 (&sm->per_thread_data[thread_index].in2out, &kv0, - 1 /* is_add */)) + if (clib_bihash_add_or_overwrite_stale_8_8 ( + &sm->per_thread_data[thread_index].in2out, &kv0, + nat44_i2o_is_idle_session_cb, &ctx0)) nat_log_notice ("in2out key add failed"); kv0.key = s->out2in.as_u64; - if (clib_bihash_add_del_8_8 (&sm->per_thread_data[thread_index].out2in, &kv0, - 1 /* is_add */)) + if (clib_bihash_add_or_overwrite_stale_8_8 ( + &sm->per_thread_data[thread_index].out2in, &kv0, + nat44_o2i_is_idle_session_cb, &ctx0)) nat_log_notice ("out2in key add failed"); /* log NAT event */ @@ -221,7 +265,7 @@ create_session_for_static_mapping (snat_main_t *sm, s->in2out.port, s->out2in.port, s->in2out.fib_index); - return s; + return s; } static_always_inline @@ -323,7 +367,7 @@ u32 icmp_match_out2in_slow(snat_main_t *sm, vlib_node_runtime_t *node, { /* Try to match static mapping by external address and port, destination address and port in packet */ - if (snat_static_mapping_match(sm, key0, &sm0, 1, &is_addr_only, 0, 0)) + if (snat_static_mapping_match(sm, key0, &sm0, 1, &is_addr_only, 0, 0, 0)) { if (!sm->forwarding_enabled) { @@ -355,7 +399,8 @@ u32 icmp_match_out2in_slow(snat_main_t *sm, vlib_node_runtime_t *node, /* Create session initiated by host from external network */ s0 = create_session_for_static_mapping(sm, b0, sm0, key0, - node, thread_index); + node, thread_index, + vlib_time_now (sm->vlib_main)); if (!s0) { @@ -430,7 +475,7 @@ u32 icmp_match_out2in_fast(snat_main_t *sm, vlib_node_runtime_t *node, } key0.fib_index = rx_fib_index0; - if (snat_static_mapping_match(sm, key0, &sm0, 1, &is_addr_only, 0, 0)) + if (snat_static_mapping_match(sm, key0, &sm0, 1, &is_addr_only, 0, 0, 0)) { /* Don't NAT packet aimed at the intfc address */ if (is_interface_addr(sm, node, sw_if_index0, ip0->dst_address.as_u32)) @@ -776,7 +821,7 @@ snat_out2in_node_fn (vlib_main_t * vm, { /* Try to match static mapping by external address and port, destination address and port in packet */ - if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0)) + if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0, 0)) { /* * Send DHCP packets to the ipv4 stack, or we won't @@ -800,7 +845,7 @@ snat_out2in_node_fn (vlib_main_t * vm, /* Create session initiated by host from external network */ s0 = create_session_for_static_mapping(sm, b0, sm0, key0, node, - thread_index); + thread_index, now); if (!s0) { next0 = SNAT_OUT2IN_NEXT_DROP; @@ -927,7 +972,7 @@ snat_out2in_node_fn (vlib_main_t * vm, { /* Try to match static mapping by external address and port, destination address and port in packet */ - if (snat_static_mapping_match(sm, key1, &sm1, 1, 0, 0, 0)) + if (snat_static_mapping_match(sm, key1, &sm1, 1, 0, 0, 0, 0)) { /* * Send DHCP packets to the ipv4 stack, or we won't @@ -951,7 +996,7 @@ snat_out2in_node_fn (vlib_main_t * vm, /* Create session initiated by host from external network */ s1 = create_session_for_static_mapping(sm, b1, sm1, key1, node, - thread_index); + thread_index, now); if (!s1) { next1 = SNAT_OUT2IN_NEXT_DROP; @@ -1114,7 +1159,7 @@ snat_out2in_node_fn (vlib_main_t * vm, { /* Try to match static mapping by external address and port, destination address and port in packet */ - if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0)) + if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0, 0)) { /* * Send DHCP packets to the ipv4 stack, or we won't @@ -1138,7 +1183,7 @@ snat_out2in_node_fn (vlib_main_t * vm, /* Create session initiated by host from external network */ s0 = create_session_for_static_mapping(sm, b0, sm0, key0, node, - thread_index); + thread_index, now); if (!s0) { next0 = SNAT_OUT2IN_NEXT_DROP; @@ -1339,7 +1384,7 @@ nat44_out2in_reass_node_fn (vlib_main_t * vm, { /* Try to match static mapping by external address and port, destination address and port in packet */ - if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0)) + if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0, 0)) { /* * Send DHCP packets to the ipv4 stack, or we won't @@ -1363,7 +1408,7 @@ nat44_out2in_reass_node_fn (vlib_main_t * vm, /* Create session initiated by host from external network */ s0 = create_session_for_static_mapping(sm, b0, sm0, key0, node, - thread_index); + thread_index, now); if (!s0) { b0->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION]; @@ -1563,6 +1608,109 @@ format_nat44_ed_out2in_trace (u8 * s, va_list * args) return s; } +static inline u32 +icmp_out2in_ed_slow_path (snat_main_t * sm, vlib_buffer_t * b0, + ip4_header_t * ip0, icmp46_header_t * icmp0, + u32 sw_if_index0, u32 rx_fib_index0, + vlib_node_runtime_t * node, u32 next0, f64 now, + u32 thread_index, snat_session_t ** p_s0) +{ + next0 = icmp_out2in(sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node, + next0, thread_index, p_s0, 0); + snat_session_t * s0 = *p_s0; + if (PREDICT_TRUE(next0 != SNAT_OUT2IN_NEXT_DROP && s0)) + { + /* Accounting */ + nat44_session_update_counters (s0, now, + vlib_buffer_length_in_chain (sm->vlib_main, b0)); + } + return next0; +} + +int +nat44_o2i_ed_is_idle_session_cb (clib_bihash_kv_16_8_t * kv, void * arg) +{ + snat_main_t *sm = &snat_main; + nat44_is_idle_session_ctx_t *ctx = arg; + snat_session_t *s; + u64 sess_timeout_time; + nat_ed_ses_key_t ed_key; + clib_bihash_kv_16_8_t ed_kv; + int i; + snat_address_t *a; + snat_session_key_t key; + snat_main_per_thread_data_t *tsm = vec_elt_at_index (sm->per_thread_data, + ctx->thread_index); + + s = pool_elt_at_index (tsm->sessions, kv->value); + sess_timeout_time = s->last_heard + (f64)nat44_session_get_timeout(sm, s); + if (ctx->now >= sess_timeout_time) + { + ed_key.l_addr = s->in2out.addr; + ed_key.r_addr = s->ext_host_addr; + ed_key.fib_index = s->out2in.fib_index; + if (snat_is_unk_proto_session (s)) + { + ed_key.proto = s->in2out.port; + ed_key.r_port = 0; + ed_key.l_port = 0; + } + else + { + ed_key.proto = snat_proto_to_ip_proto (s->in2out.protocol); + ed_key.l_port = s->in2out.port; + ed_key.r_port = s->ext_host_port; + } + if (is_twice_nat_session (s)) + { + ed_key.r_addr = s->ext_host_nat_addr; + ed_key.r_port = s->ext_host_nat_port; + } + 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 (&tsm->in2out_ed, &ed_kv, 0)) + nat_log_warn ("in2out_ed key del failed"); + + if (snat_is_unk_proto_session (s)) + goto delete; + + snat_ipfix_logging_nat44_ses_delete(s->in2out.addr.as_u32, + s->out2in.addr.as_u32, + s->in2out.protocol, + s->in2out.port, + s->out2in.port, + s->in2out.fib_index); + + if (is_twice_nat_session (s)) + { + for (i = 0; i < vec_len (sm->twice_nat_addresses); i++) + { + key.protocol = s->in2out.protocol; + key.port = s->ext_host_nat_port; + a = sm->twice_nat_addresses + i; + if (a->addr.as_u32 == s->ext_host_nat_addr.as_u32) + { + snat_free_outside_address_and_port (sm->twice_nat_addresses, + ctx->thread_index, &key); + break; + } + } + } + + if (snat_is_session_static (s)) + goto delete; + + if (s->outside_address_index != ~0) + snat_free_outside_address_and_port (sm->addresses, ctx->thread_index, + &s->out2in); + delete: + nat44_delete_session (sm, s, ctx->thread_index); + return 1; + } + + return 0; +} + static snat_session_t * create_session_for_static_mapping_ed (snat_main_t * sm, vlib_buffer_t *b, @@ -1571,7 +1719,8 @@ create_session_for_static_mapping_ed (snat_main_t * sm, vlib_node_runtime_t * node, u32 thread_index, twice_nat_type_t twice_nat, - u8 is_lb) + lb_nat_type_t lb_nat, + f64 now) { snat_session_t *s; snat_user_t *u; @@ -1581,6 +1730,7 @@ create_session_for_static_mapping_ed (snat_main_t * sm, clib_bihash_kv_16_8_t kv; snat_session_key_t eh_key; u32 address_index; + nat44_is_idle_session_ctx_t ctx; if (PREDICT_FALSE (maximum_sessions_exceeded(sm, thread_index))) { @@ -1596,9 +1746,10 @@ create_session_for_static_mapping_ed (snat_main_t * sm, return 0; } - s = nat_session_alloc_or_recycle (sm, u, thread_index); + s = nat_ed_session_alloc (sm, u, thread_index); if (!s) { + nat44_delete_user_with_no_session (sm, u, thread_index); nat_log_warn ("create NAT session failed"); return 0; } @@ -1609,8 +1760,10 @@ create_session_for_static_mapping_ed (snat_main_t * sm, s->ext_host_addr.as_u32 = ip->src_address.as_u32; s->ext_host_port = e_key.protocol == SNAT_PROTOCOL_ICMP ? 0 : udp->src_port; s->flags |= SNAT_SESSION_FLAG_STATIC_MAPPING; - if (is_lb) + if (lb_nat) s->flags |= SNAT_SESSION_FLAG_LOAD_BALANCING; + if (lb_nat == AFFINITY_LB_NAT) + s->flags |= SNAT_SESSION_FLAG_AFFINITY; s->flags |= SNAT_SESSION_FLAG_ENDPOINT_DEPENDENT; s->outside_address_index = ~0; s->out2in = e_key; @@ -1622,7 +1775,11 @@ create_session_for_static_mapping_ed (snat_main_t * sm, make_ed_kv (&kv, &e_key.addr, &s->ext_host_addr, ip->protocol, e_key.fib_index, e_key.port, s->ext_host_port); kv.value = s - tsm->sessions; - if (clib_bihash_add_del_16_8 (&tsm->out2in_ed, &kv, 1)) + ctx.now = now; + ctx.thread_index = thread_index; + if (clib_bihash_add_or_overwrite_stale_16_8 (&tsm->out2in_ed, &kv, + nat44_o2i_ed_is_idle_session_cb, + &ctx)) nat_log_notice ("out2in-ed key add failed"); if (twice_nat == TWICE_NAT || (twice_nat == TWICE_NAT_SELF && @@ -1653,7 +1810,9 @@ create_session_for_static_mapping_ed (snat_main_t * sm, l_key.fib_index, l_key.port, s->ext_host_port); } kv.value = s - tsm->sessions; - if (clib_bihash_add_del_16_8 (&tsm->in2out_ed, &kv, 1)) + if (clib_bihash_add_or_overwrite_stale_16_8 (&tsm->in2out_ed, &kv, + nat44_i2o_ed_is_idle_session_cb, + &ctx)) nat_log_notice ("in2out-ed key add failed"); return s; @@ -1710,13 +1869,13 @@ icmp_get_ed_key(ip4_header_t *ip0, nat_ed_ses_key_t *p_key0) static int next_src_nat (snat_main_t * sm, ip4_header_t * ip, u8 proto, u16 src_port, - u16 dst_port, u32 thread_index) + u16 dst_port, u32 thread_index, u32 rx_fib_index) { clib_bihash_kv_16_8_t kv, value; snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index]; make_ed_kv (&kv, &ip->src_address, &ip->dst_address, proto, - sm->inside_fib_index, src_port, dst_port); + rx_fib_index, src_port, dst_port); if (!clib_bihash_search_16_8 (&tsm->in2out_ed, &kv, &value)) return 1; @@ -1777,9 +1936,10 @@ create_bypass_for_fwd(snat_main_t * sm, ip4_header_t * ip, u32 rx_fib_index, return; } - s = nat_session_alloc_or_recycle (sm, u, thread_index); + s = nat_ed_session_alloc (sm, u, thread_index); if (!s) { + nat44_delete_user_with_no_session (sm, u, thread_index); nat_log_warn ("create NAT session failed"); return; } @@ -1807,8 +1967,6 @@ create_bypass_for_fwd(snat_main_t * sm, ip4_header_t * ip, u32 rx_fib_index, return; } - /* Per-user LRU list maintenance */ - nat44_session_update_lru (sm, s, thread_index); /* Accounting */ nat44_session_update_counters (s, now, 0); } @@ -1849,7 +2007,7 @@ icmp_match_out2in_ed (snat_main_t * sm, vlib_node_runtime_t * node, e_key.port = key.l_port; e_key.protocol = ip_proto_to_snat_proto (key.proto); e_key.fib_index = rx_fib_index; - if (snat_static_mapping_match(sm, e_key, &l_key, 1, &is_addr_only, 0, 0)) + if (snat_static_mapping_match(sm, e_key, &l_key, 1, &is_addr_only, 0, 0, 0)) { if (!sm->forwarding_enabled) { @@ -1867,7 +2025,8 @@ icmp_match_out2in_ed (snat_main_t * sm, vlib_node_runtime_t * node, else { dont_translate = 1; - if (next_src_nat(sm, ip, key.proto, key.l_port, key.r_port, thread_index)) + if (next_src_nat(sm, ip, key.proto, key.l_port, key.r_port, + thread_index, rx_fib_index)) { next = NAT44_ED_OUT2IN_NEXT_IN2OUT; goto out; @@ -1887,7 +2046,8 @@ icmp_match_out2in_ed (snat_main_t * sm, vlib_node_runtime_t * node, /* Create session initiated by host from external network */ s = create_session_for_static_mapping_ed(sm, b, l_key, e_key, node, - thread_index, 0, 0); + thread_index, 0, 0, + vlib_time_now (sm->vlib_main)); if (!s) { @@ -1968,7 +2128,7 @@ nat44_ed_out2in_unknown_proto (snat_main_t *sm, new_addr = ip->dst_address.as_u32 = m->local_addr.as_u32; - u = nat_user_get_or_create (sm, &ip->src_address, m->fib_index, + u = nat_user_get_or_create (sm, &m->local_addr, m->fib_index, thread_index); if (!u) { @@ -1977,9 +2137,10 @@ nat44_ed_out2in_unknown_proto (snat_main_t *sm, } /* Create a new session */ - s = nat_session_alloc_or_recycle (sm, u, thread_index); + s = nat_ed_session_alloc (sm, u, thread_index); if (!s) { + nat44_delete_user_with_no_session (sm, u, thread_index); nat_log_warn ("create NAT session failed"); return 0; } @@ -2018,8 +2179,6 @@ nat44_ed_out2in_unknown_proto (snat_main_t *sm, /* Accounting */ nat44_session_update_counters (s, now, vlib_buffer_length_in_chain (vm, b)); - /* Per-user LRU list maintenance */ - nat44_session_update_lru (sm, s, thread_index); return s; } @@ -2064,7 +2223,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, clib_bihash_kv_16_8_t kv0, value0, kv1, value1; ip_csum_t sum0, sum1; snat_session_key_t e_key0, l_key0, e_key1, l_key1; - u8 is_lb0, is_lb1; + lb_nat_type_t lb_nat0, lb_nat1; twice_nat_type_t twice_nat0, twice_nat1; /* Prefetch next iteration. */ @@ -2131,7 +2290,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP)) { - next0 = icmp_out2in_slow_path + next0 = icmp_out2in_ed_slow_path (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node, next0, now, thread_index, &s0); goto trace00; @@ -2167,7 +2326,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, e_key0.protocol = proto0; e_key0.fib_index = rx_fib_index0; if (snat_static_mapping_match(sm, e_key0, &l_key0, 1, 0, - &twice_nat0, &is_lb0)) + &twice_nat0, &lb_nat0, &ip0->src_address)) { /* * Send DHCP packets to the ipv4 stack, or we won't @@ -2190,7 +2349,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, { if (next_src_nat(sm, ip0, ip0->protocol, udp0->src_port, udp0->dst_port, - thread_index)) + thread_index, rx_fib_index0)) { next0 = NAT44_ED_OUT2IN_NEXT_IN2OUT; goto trace00; @@ -2205,7 +2364,9 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, s0 = create_session_for_static_mapping_ed(sm, b0, l_key0, e_key0, node, thread_index, - twice_nat0, is_lb0); + twice_nat0, + lb_nat0, + now); if (!s0) { @@ -2276,8 +2437,6 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, /* Accounting */ nat44_session_update_counters (s0, now, vlib_buffer_length_in_chain (vm, b0)); - /* Per-user LRU list maintenance */ - nat44_session_update_lru (sm, s0, thread_index); trace00: if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) @@ -2334,7 +2493,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, if (PREDICT_FALSE (proto1 == SNAT_PROTOCOL_ICMP)) { - next1 = icmp_out2in_slow_path + next1 = icmp_out2in_ed_slow_path (sm, b1, ip1, icmp1, sw_if_index1, rx_fib_index1, node, next1, now, thread_index, &s1); goto trace01; @@ -2370,7 +2529,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, e_key1.protocol = proto1; e_key1.fib_index = rx_fib_index1; if (snat_static_mapping_match(sm, e_key1, &l_key1, 1, 0, - &twice_nat1, &is_lb1)) + &twice_nat1, &lb_nat1, &ip1->src_address)) { /* * Send DHCP packets to the ipv4 stack, or we won't @@ -2393,7 +2552,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, { if (next_src_nat(sm, ip1, ip1->protocol, udp1->src_port, udp1->dst_port, - thread_index)) + thread_index, rx_fib_index1)) { next1 = NAT44_ED_OUT2IN_NEXT_IN2OUT; goto trace01; @@ -2408,7 +2567,9 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, s1 = create_session_for_static_mapping_ed(sm, b1, l_key1, e_key1, node, thread_index, - twice_nat1, is_lb1); + twice_nat1, + lb_nat1, + now); if (!s1) { @@ -2479,8 +2640,6 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, /* Accounting */ nat44_session_update_counters (s1, now, vlib_buffer_length_in_chain (vm, b1)); - /* Per-user LRU list maintenance */ - nat44_session_update_lru (sm, s1, thread_index); trace01: if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) @@ -2518,7 +2677,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, clib_bihash_kv_16_8_t kv0, value0; ip_csum_t sum0; snat_session_key_t e_key0, l_key0; - u8 is_lb0; + lb_nat_type_t lb_nat0; twice_nat_type_t twice_nat0; /* speculatively enqueue b0 to the current next frame */ @@ -2569,7 +2728,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, if (PREDICT_FALSE (proto0 == SNAT_PROTOCOL_ICMP)) { - next0 = icmp_out2in_slow_path + next0 = icmp_out2in_ed_slow_path (sm, b0, ip0, icmp0, sw_if_index0, rx_fib_index0, node, next0, now, thread_index, &s0); goto trace0; @@ -2605,7 +2764,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, e_key0.protocol = proto0; e_key0.fib_index = rx_fib_index0; if (snat_static_mapping_match(sm, e_key0, &l_key0, 1, 0, - &twice_nat0, &is_lb0)) + &twice_nat0, &lb_nat0, &ip0->src_address)) { /* * Send DHCP packets to the ipv4 stack, or we won't @@ -2628,7 +2787,7 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, { if (next_src_nat(sm, ip0, ip0->protocol, udp0->src_port, udp0->dst_port, - thread_index)) + thread_index, rx_fib_index0)) { next0 = NAT44_ED_OUT2IN_NEXT_IN2OUT; goto trace0; @@ -2643,7 +2802,9 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, s0 = create_session_for_static_mapping_ed(sm, b0, l_key0, e_key0, node, thread_index, - twice_nat0, is_lb0); + twice_nat0, + lb_nat0, + now); if (!s0) { @@ -2714,8 +2875,6 @@ nat44_ed_out2in_node_fn_inline (vlib_main_t * vm, /* Accounting */ nat44_session_update_counters (s0, now, vlib_buffer_length_in_chain (vm, b0)); - /* Per-user LRU list maintenance */ - nat44_session_update_lru (sm, s0, thread_index); trace0: if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) @@ -3720,7 +3879,7 @@ snat_out2in_fast_node_fn (vlib_main_t * vm, key0.port = udp0->dst_port; key0.fib_index = rx_fib_index0; - if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0)) + if (snat_static_mapping_match(sm, key0, &sm0, 1, 0, 0, 0, 0)) { b0->error = node->errors[SNAT_OUT2IN_ERROR_NO_TRANSLATION]; goto trace00;