nat: fix coverity warning

Type: fix
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I609fef6f96c6a3fc85a4dc07e75244b0e1ba9239
This commit is contained in:
Klement Sekera
2020-04-27 08:19:12 +00:00
committed by Ole Trøan
parent 9beabd8afd
commit e4deacc422

View File

@@ -296,7 +296,6 @@ slow_path_ed (snat_main_t * sm,
nat_outside_fib_t *outside_fib;
fib_node_index_t fei = FIB_NODE_INDEX_INVALID;
clib_bihash_kv_16_8_t out2in_ed_kv;
bool out2in_ed_inserted = false;
ip4_address_t allocated_addr;
u16 allocated_port;
u8 identity_nat;
@@ -346,7 +345,7 @@ slow_path_ed (snat_main_t * sm,
{
nat_elog_warn ("create NAT session failed");
b->error = node->errors[NAT_IN2OUT_ED_ERROR_MAX_USER_SESS_EXCEEDED];
goto drop;
return NAT_NEXT_DROP;
}
switch (vec_len (sm->outside_fibs))
{
@@ -384,10 +383,10 @@ slow_path_ed (snat_main_t * sm,
{
nat_elog_notice ("addresses exhausted");
b->error = node->errors[NAT_IN2OUT_ED_ERROR_OUT_OF_PORTS];
goto drop;
nat_free_session_data (sm, s, thread_index, 0);
nat44_ed_delete_session (sm, s, thread_index, 1);
return NAT_NEXT_DROP;
}
out2in_ed_inserted = true;
key1.addr = allocated_addr;
key1.port = allocated_port;
}
@@ -403,7 +402,7 @@ slow_path_ed (snat_main_t * sm,
{
nat_elog_warn ("create NAT session failed");
b->error = node->errors[NAT_IN2OUT_ED_ERROR_MAX_USER_SESS_EXCEEDED];
goto drop;
return NAT_NEXT_DROP;
}
switch (vec_len (sm->outside_fibs))
{
@@ -441,7 +440,6 @@ slow_path_ed (snat_main_t * sm,
(&tsm->out2in_ed, &out2in_ed_kv, nat44_o2i_ed_is_idle_session_cb,
&ctx))
nat_elog_notice ("out2in-ed key add failed");
out2in_ed_inserted = true;
}
if (lb)
@@ -487,18 +485,6 @@ slow_path_ed (snat_main_t * sm,
thread_index, 0);
return next;
drop:
if (out2in_ed_inserted)
{
if (clib_bihash_add_del_16_8 (&tsm->out2in_ed, &out2in_ed_kv, 0))
nat_elog_notice ("out2in-ed key del failed");
}
if (s)
{
nat_free_session_data (sm, s, thread_index, 0);
nat44_ed_delete_session (sm, s, thread_index, 1);
}
return NAT_NEXT_DROP;
}
static_always_inline int