aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-10-29 10:56:15 -0700
committerFlorin Coras <fcoras@cisco.com>2017-10-29 10:56:15 -0700
commita2e244c92c13e931b9a11d2cb9c67bc5eebc5904 (patch)
tree5e2d266e21f45fc420c552d0c754382e22fe8569 /src/vnet/ip/ip.c
parent1c7104514cd40d2377caca36cf40c13b791bc5aa (diff)
session: fix coverity warnings
Change-Id: Ib87eccb853cafceea5f5513f6bb51c2364449afa Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/ip/ip.c')
-rw-r--r--src/vnet/ip/ip.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vnet/ip/ip.c b/src/vnet/ip/ip.c
index e6d99347dc0..ac7727a8b41 100644
--- a/src/vnet/ip/ip.c
+++ b/src/vnet/ip/ip.c
@@ -228,15 +228,20 @@ ip6_prefix_max_address_host_order (ip6_address_t * ip, u8 plen,
ip6_address_t * res)
{
u64 not_mask;
- if (plen <= 64)
+ if (plen == 0)
{
- not_mask = (1 << (64 - plen)) - 1;
+ res->as_u64[0] = 0xffffffffffffffffL;
+ res->as_u64[1] = 0xffffffffffffffffL;
+ }
+ else if (plen <= 64)
+ {
+ not_mask = ((u64) 1 << (64 - plen)) - 1;
res->as_u64[0] = clib_net_to_host_u64 (ip->as_u64[0]) + not_mask;
res->as_u64[1] = 0xffffffffffffffffL;
}
else
{
- not_mask = (1 << (128 - plen)) - 1;
+ not_mask = ((u64) 1 << (128 - plen)) - 1;
res->as_u64[1] = clib_net_to_host_u64 (ip->as_u64[1]) + not_mask;
}
}