From 2ef5d014d6beb45aa5ca4557e1fac6c1b5abfeeb Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Wed, 8 Mar 2017 04:47:49 -0800 Subject: SNAT: fix coverity warnings (VPP-608) Change-Id: Id7879a6a8014fe57c3515a13e7597fb0e3c906ad Signed-off-by: Matus Fabian --- src/plugins/snat/snat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/snat/snat.c b/src/plugins/snat/snat.c index fc9f58687e4..16fbbdf6599 100644 --- a/src/plugins/snat/snat.c +++ b/src/plugins/snat/snat.c @@ -1622,7 +1622,7 @@ vl_api_snat_det_forward_t_handler snat_main_t * sm = &snat_main; vl_api_snat_det_forward_reply_t * rmp; int rv = 0; - u16 lo_port = 0; + u16 lo_port = 0, hi_port = 0; snat_det_map_t * dm; ip4_address_t in_addr, out_addr; @@ -1636,12 +1636,13 @@ vl_api_snat_det_forward_t_handler } snat_det_forward(dm, &in_addr, &out_addr, &lo_port); + hi_port = lo_port + dm->ports_per_host - 1; send_reply: REPLY_MACRO2(VL_API_SNAT_DET_FORWARD_REPLY, ({ rmp->out_port_lo = ntohs(lo_port); - rmp->out_port_hi = ntohs(lo_port + dm->ports_per_host - 1); + rmp->out_port_hi = ntohs(hi_port); rmp->is_ip4 = 1; memset(rmp->out_addr, 0, 16); clib_memcpy(rmp->out_addr, &out_addr, 4); -- cgit 1.2.3-korg