summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);