aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorflyingeagle23 <wang.hui56@zte.com.cn>2017-09-12 15:10:46 +0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-09-12 11:36:05 +0000
commit6a58f4a89660b1b8ce37139ec1b65acaad8795ed (patch)
tree46d13df9ee88daf081d21c5dab8b2d88d33968c0 /src
parentcada5a92faaf1dd2887df5ca200195011d2a0b8d (diff)
Fix issue in nat Bisearch algorithm (VPP-980)
Change-Id: I39b1d1ec6fb9a10e2a0e67d36b01c0bf2522d07f Signed-off-by: flyingeagle23 <wang.hui56@zte.com.cn>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/nat/nat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index b13c8571020..faf75fcb618 100644
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -1323,7 +1323,7 @@ int snat_static_mapping_match (snat_main_t * sm,
rand = 1 + (random_u32 (&sm->random_seed) % m->locals[hi].prefix);
while (lo < hi)
{
- mid = ((hi - 1) >> 1) + lo;
+ mid = ((hi - lo) >> 1) + lo;
(rand > m->locals[mid].prefix) ? (lo = mid + 1) : (hi = mid);
}
if (!(m->locals[lo].prefix >= rand))