summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/ip/ip6_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'vnet/vnet/ip/ip6_format.c')
-rw-r--r--vnet/vnet/ip/ip6_format.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/vnet/vnet/ip/ip6_format.c b/vnet/vnet/ip/ip6_format.c
index ad834f4db8a..5d32189478b 100644
--- a/vnet/vnet/ip/ip6_format.c
+++ b/vnet/vnet/ip/ip6_format.c
@@ -341,7 +341,23 @@ uword unformat_ip46_address (unformat_input_t * input, va_list * args)
u8 * format_ip46_address (u8 * s, va_list * args)
{
ip46_address_t *ip46 = va_arg (*args, ip46_address_t *);
- return ip46_address_is_ip4(ip46)?
+ ip46_type_t type = va_arg (*args, ip46_type_t);
+ int is_ip4 = 1;
+
+ switch (type)
+ {
+ case IP46_TYPE_ANY:
+ is_ip4 = ip46_address_is_ip4(ip46);
+ break;
+ case IP46_TYPE_IP4:
+ is_ip4 = 1;
+ break;
+ case IP46_TYPE_IP6:
+ is_ip4 = 0;
+ break;
+ }
+
+ return is_ip4 ?
format(s, "%U", format_ip4_address, &ip46->ip4):
format(s, "%U", format_ip6_address, &ip46->ip6);
}