aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
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
parent1c7104514cd40d2377caca36cf40c13b791bc5aa (diff)
session: fix coverity warnings
Change-Id: Ib87eccb853cafceea5f5513f6bb51c2364449afa Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/ip.c11
-rw-r--r--src/vnet/session/session_rules_table.c8
2 files changed, 12 insertions, 7 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;
}
}
diff --git a/src/vnet/session/session_rules_table.c b/src/vnet/session/session_rules_table.c
index fb433114cf2..685871d46ed 100644
--- a/src/vnet/session/session_rules_table.c
+++ b/src/vnet/session/session_rules_table.c
@@ -298,8 +298,8 @@ session_rules_table_lookup6 (session_rules_table_t * srt, u8 transport_proto,
.lcl_port = lcl_port,
.rmt_port = rmt_port,
};
- clib_memcpy (&key.lcl_ip, &lcl_ip, sizeof (&lcl_ip));
- clib_memcpy (&key.rmt_ip, &rmt_ip, sizeof (&rmt_ip));
+ clib_memcpy (&key.lcl_ip, lcl_ip, sizeof (*lcl_ip));
+ clib_memcpy (&key.rmt_ip, rmt_ip, sizeof (*rmt_ip));
return mma_rules_table_lookup_40 (srt6,
(mma_mask_or_match_40_t *) & key,
srt6->root_index);
@@ -373,8 +373,8 @@ session_rules_table_show_rule (vlib_main_t * vm, session_rules_table_t * srt,
.lcl_port = lcl_port,
.rmt_port = rmt_port,
};
- clib_memcpy (&key.lcl_ip, &lcl_ip->ip6, sizeof (&lcl_ip->ip6));
- clib_memcpy (&key.rmt_ip, &rmt_ip->ip6, sizeof (&rmt_ip->ip6));
+ clib_memcpy (&key.lcl_ip, &lcl_ip->ip6, sizeof (lcl_ip->ip6));
+ clib_memcpy (&key.rmt_ip, &rmt_ip->ip6, sizeof (rmt_ip->ip6));
ri =
mma_rules_table_lookup_rule_40 (srt6,
(mma_mask_or_match_40_t *) &