summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangyoufeng <807896415@qq.com>2021-05-13 04:28:50 -0400
committerOle Tr�an <otroan@employees.org>2021-06-16 07:41:02 +0000
commitd004ecdb5717ffad11c0e0d6ed6c55e3e096416d (patch)
tree48b38519e0443a8b801c769b35d45626bc58af05
parentb12b3c6b031800cb59103a4e6a151ef99e301d77 (diff)
nat : variable 'ctx' MAY not initialized before use
Type: fix Change-Id: Ib22cc8a358d17782a01b7ebeded02d186898bc3a Signed-off-by: zyf <807896415@qq.com>
-rw-r--r--src/plugins/nat/in2out_ed.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/nat/in2out_ed.c b/src/plugins/nat/in2out_ed.c
index 776efdf1395..702a74fc7e5 100644
--- a/src/plugins/nat/in2out_ed.c
+++ b/src/plugins/nat/in2out_ed.c
@@ -366,6 +366,10 @@ slow_path_ed (snat_main_t * sm,
ip4_address_t sm_addr;
u16 sm_port;
u32 sm_fib_index;
+
+ ctx.now = now;
+ ctx.thread_index = thread_index;
+
/* First try to match static mapping by local address and port */
if (snat_static_mapping_match
(sm, l_addr, l_port, rx_fib_index, nat_proto, &sm_addr, &sm_port,
@@ -458,8 +462,6 @@ slow_path_ed (snat_main_t * sm,
clib_bihash_kv_16_8_t in2out_ed_kv;
init_ed_kv (&in2out_ed_kv, l_addr, l_port, r_addr, r_port, rx_fib_index,
proto, thread_index, s - tsm->sessions);
- ctx.now = now;
- ctx.thread_index = thread_index;
if (clib_bihash_add_or_overwrite_stale_16_8 (&tsm->in2out_ed, &in2out_ed_kv,
nat44_i2o_ed_is_idle_session_cb,
&ctx))