summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-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;
}
}