diff options
author | Klement Sekera <ksekera@cisco.com> | 2020-04-27 08:19:12 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2020-05-06 08:46:14 +0000 |
commit | e4deacc4220511c5ee93eca6b059d2a64ab1d36c (patch) | |
tree | d1aa5fede62fbceeb05f67b016f125ad5cd08552 /src/plugins/nat | |
parent | 9beabd8afd9c9a3f302ebddaae47f7a1275faeca (diff) |
nat: fix coverity warning
Type: fix
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I609fef6f96c6a3fc85a4dc07e75244b0e1ba9239
Diffstat (limited to 'src/plugins/nat')
-rw-r--r-- | src/plugins/nat/in2out_ed.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/plugins/nat/in2out_ed.c b/src/plugins/nat/in2out_ed.c index f0bbe0b656e..21ef75c820c 100644 --- a/src/plugins/nat/in2out_ed.c +++ b/src/plugins/nat/in2out_ed.c @@ -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 |