summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-03-02 10:42:17 -0500
committerNeale Ranns <nranns@cisco.com>2020-03-03 07:41:29 +0000
commit297d288ed653abac9d719013c4ead5215230e7da (patch)
treec3b14afecddeefd653eff17ecd8543a83e29e6d0 /src
parentb9250a9eee1dc259f11bdb9bb8c881da56b52895 (diff)
ip: fix coverity warning
Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ifb310d6378c77ed9d3aae994897ca71ba8c44fa2
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/ip_types.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/vnet/ip/ip_types.c b/src/vnet/ip/ip_types.c
index 83228da3330..9659ca503b4 100644
--- a/src/vnet/ip/ip_types.c
+++ b/src/vnet/ip/ip_types.c
@@ -173,21 +173,17 @@ ip_address_set (ip_address_t * dst, const void *src, u8 version)
fib_protocol_t
ip_address_to_46 (const ip_address_t * addr, ip46_address_t * a)
{
- fib_protocol_t proto;
+ fib_protocol_t proto = FIB_PROTOCOL_IP4;
- proto = (AF_IP4 == ip_addr_version (addr) ?
- FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
- switch (proto)
+ switch (ip_addr_version (addr))
{
- case FIB_PROTOCOL_IP4:
+ case AF_IP4:
ip46_address_set_ip4 (a, &addr->ip.v4);
break;
- case FIB_PROTOCOL_IP6:
+ case AF_IP6:
+ proto = FIB_PROTOCOL_IP6;
a->ip6 = addr->ip.v6;
break;
- default:
- ASSERT (0);
- break;
}
return (proto);