aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44-ei/nat44_ei_out2in.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat/nat44-ei/nat44_ei_out2in.c')
-rw-r--r--src/plugins/nat/nat44-ei/nat44_ei_out2in.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/plugins/nat/nat44-ei/nat44_ei_out2in.c b/src/plugins/nat/nat44-ei/nat44_ei_out2in.c
index b677e9bde89..f0b6427613a 100644
--- a/src/plugins/nat/nat44-ei/nat44_ei_out2in.c
+++ b/src/plugins/nat/nat44-ei/nat44_ei_out2in.c
@@ -116,7 +116,7 @@ nat44_o2i_is_idle_session_cb (clib_bihash_kv_8_8_t * kv, void *arg)
if (ctx->now >= sess_timeout_time)
{
init_nat_i2o_k (&s_kv, s);
- if (clib_bihash_add_del_8_8 (&tsm->in2out, &s_kv, 0))
+ if (clib_bihash_add_del_8_8 (&sm->in2out, &s_kv, 0))
nat_elog_warn ("out2in key del failed");
nat_ipfix_logging_nat44_ses_delete (ctx->thread_index,
@@ -222,16 +222,16 @@ create_session_for_static_mapping (snat_main_t * sm,
/* Add to translation hashes */
ctx0.now = now;
ctx0.thread_index = thread_index;
- init_nat_i2o_kv (&kv0, s, s - sm->per_thread_data[thread_index].sessions);
- if (clib_bihash_add_or_overwrite_stale_8_8
- (&sm->per_thread_data[thread_index].in2out, &kv0,
- nat44_i2o_is_idle_session_cb, &ctx0))
+ init_nat_i2o_kv (&kv0, s, thread_index,
+ s - sm->per_thread_data[thread_index].sessions);
+ if (clib_bihash_add_or_overwrite_stale_8_8 (
+ &sm->in2out, &kv0, nat44_i2o_is_idle_session_cb, &ctx0))
nat_elog_notice ("in2out key add failed");
- init_nat_o2i_kv (&kv0, s, s - sm->per_thread_data[thread_index].sessions);
- if (clib_bihash_add_or_overwrite_stale_8_8
- (&sm->per_thread_data[thread_index].out2in, &kv0,
- nat44_o2i_is_idle_session_cb, &ctx0))
+ init_nat_o2i_kv (&kv0, s, thread_index,
+ s - sm->per_thread_data[thread_index].sessions);
+ if (clib_bihash_add_or_overwrite_stale_8_8 (
+ &sm->out2in, &kv0, nat44_o2i_is_idle_session_cb, &ctx0))
nat_elog_notice ("out2in key add failed");
/* log NAT event */
@@ -351,7 +351,7 @@ icmp_match_out2in_slow (snat_main_t * sm, vlib_node_runtime_t * node,
u32 mapping_fib_index;
init_nat_k (&kv0, *addr, *port, *fib_index, *proto);
- if (clib_bihash_search_8_8 (&tsm->out2in, &kv0, &value0))
+ if (clib_bihash_search_8_8 (&sm->out2in, &kv0, &value0))
{
/* Try to match static mapping by external address and port,
destination address and port in packet */
@@ -423,7 +423,8 @@ icmp_match_out2in_slow (snat_main_t * sm, vlib_node_runtime_t * node,
goto out;
}
- s0 = pool_elt_at_index (tsm->sessions, value0.value);
+ s0 = pool_elt_at_index (tsm->sessions,
+ nat_value_get_session_index (&value0));
}
out:
@@ -823,8 +824,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm,
init_nat_k (&kv0, ip0->dst_address,
vnet_buffer (b0)->ip.reass.l4_dst_port, rx_fib_index0,
proto0);
- if (clib_bihash_search_8_8
- (&sm->per_thread_data[thread_index].out2in, &kv0, &value0))
+ if (clib_bihash_search_8_8 (&sm->out2in, &kv0, &value0))
{
/* Try to match static mapping by external address and port,
destination address and port in packet */
@@ -873,7 +873,8 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm,
}
}
else
- s0 = pool_elt_at_index (tsm->sessions, value0.value);
+ s0 = pool_elt_at_index (tsm->sessions,
+ nat_value_get_session_index (&value0));
old_addr0 = ip0->dst_address.as_u32;
ip0->dst_address = s0->in2out.addr;
@@ -1002,8 +1003,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm,
init_nat_k (&kv1, ip1->dst_address,
vnet_buffer (b1)->ip.reass.l4_dst_port, rx_fib_index1,
proto1);
- if (clib_bihash_search_8_8
- (&sm->per_thread_data[thread_index].out2in, &kv1, &value1))
+ if (clib_bihash_search_8_8 (&sm->out2in, &kv1, &value1))
{
/* Try to match static mapping by external address and port,
destination address and port in packet */
@@ -1052,9 +1052,8 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm,
}
}
else
- s1 =
- pool_elt_at_index (sm->per_thread_data[thread_index].sessions,
- value1.value);
+ s1 = pool_elt_at_index (sm->per_thread_data[thread_index].sessions,
+ nat_value_get_session_index (&value1));
old_addr1 = ip1->dst_address.as_u32;
ip1->dst_address = s1->in2out.addr;
@@ -1219,8 +1218,7 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm,
vnet_buffer (b0)->ip.reass.l4_dst_port, rx_fib_index0,
proto0);
- if (clib_bihash_search_8_8
- (&sm->per_thread_data[thread_index].out2in, &kv0, &value0))
+ if (clib_bihash_search_8_8 (&sm->out2in, &kv0, &value0))
{
/* Try to match static mapping by external address and port,
destination address and port in packet */
@@ -1269,9 +1267,8 @@ VLIB_NODE_FN (snat_out2in_node) (vlib_main_t * vm,
}
}
else
- s0 =
- pool_elt_at_index (sm->per_thread_data[thread_index].sessions,
- value0.value);
+ s0 = pool_elt_at_index (sm->per_thread_data[thread_index].sessions,
+ nat_value_get_session_index (&value0));
old_addr0 = ip0->dst_address.as_u32;
ip0->dst_address = s0->in2out.addr;