summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-03-08 04:47:49 -0800
committerFlorin Coras <florin.coras@gmail.com>2017-03-08 23:32:13 +0000
commit2ef5d014d6beb45aa5ca4557e1fac6c1b5abfeeb (patch)
tree529dbde3e149dd9782f8189e7a5228209f87c816 /src/plugins
parente5ef1d7a7b63fcbd43529f079137c0c990a8de2f (diff)
SNAT: fix coverity warnings (VPP-608)
Change-Id: Id7879a6a8014fe57c3515a13e7597fb0e3c906ad Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/snat/snat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/snat/snat.c b/src/plugins/snat/snat.c
index fc9f5868..16fbbdf6 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);