From d004ecdb5717ffad11c0e0d6ed6c55e3e096416d Mon Sep 17 00:00:00 2001 From: zhangyoufeng <807896415@qq.com> Date: Thu, 13 May 2021 04:28:50 -0400 Subject: nat : variable 'ctx' MAY not initialized before use Type: fix Change-Id: Ib22cc8a358d17782a01b7ebeded02d186898bc3a Signed-off-by: zyf <807896415@qq.com> --- src/plugins/nat/in2out_ed.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins') 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)) -- cgit 1.2.3-korg