3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 13:59:24 +01:00

monitor: Also print IPv6 addresses

This commit is contained in:
Denis Kenzior 2020-11-04 14:29:21 -06:00
parent d3a57d47f3
commit 609f9c8f43

View File

@ -6687,13 +6687,18 @@ static void print_ifa_flags(unsigned int indent, const char *str,
static void print_inet_addr(unsigned int indent, const char *str, static void print_inet_addr(unsigned int indent, const char *str,
const void *buf, uint16_t size) const void *buf, uint16_t size)
{ {
struct in_addr addr; int family;
char ip[INET6_ADDRSTRLEN];
if (size != sizeof(struct in_addr)) if (size == sizeof(struct in_addr))
family = AF_INET;
else if (size == sizeof(struct in6_addr))
family = AF_INET6;
else
return; return;
addr = *((struct in_addr *) buf); inet_ntop(family, buf, ip, sizeof(ip));
print_attr(indent, "%s: %s", str, inet_ntoa(addr)); print_attr(indent, "%s: %s", str, ip);
} }
static struct attr_entry addr_entry[] = { static struct attr_entry addr_entry[] = {