From 6ceb5644083bee2f26c87634dfc3ba86e771a01e Mon Sep 17 00:00:00 2001 From: Vitaly Lipatov Date: Mon, 18 Nov 2013 19:00:10 +0400 Subject: [PATCH] ipconfig: Distinguish between IPv4 and IPv6 addresses in normal mode. --- programs/ipconfig/ipconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/ipconfig/ipconfig.c b/programs/ipconfig/ipconfig.c index 30e50fd0f5a..11ff56b9bd3 100644 --- a/programs/ipconfig/ipconfig.c +++ b/programs/ipconfig/ipconfig.c @@ -186,8 +186,12 @@ static void print_basic_information(void) for (addr = p->FirstUnicastAddress; addr; addr = addr->Next) { - if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address)) + if (addr->Address.lpSockaddr->sa_family == AF_INET && + socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address)) print_field(STRING_IP_ADDRESS, addr_buf); + else if (addr->Address.lpSockaddr->sa_family == AF_INET6 && + socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address)) + print_field(STRING_IP6_ADDRESS, addr_buf); /* FIXME: Output corresponding subnet mask. */ } -- 2.11.4.GIT