3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +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,
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;
addr = *((struct in_addr *) buf);
print_attr(indent, "%s: %s", str, inet_ntoa(addr));
inet_ntop(family, buf, ip, sizeof(ip));
print_attr(indent, "%s: %s", str, ip);
}
static struct attr_entry addr_entry[] = {