On 17.02.2012 12:35, Michal Privoznik wrote: > This command returns an array of: > > [ifname, ipaddr, ipaddr_family, prefix, hwaddr] > > for each interface in the system that has an IP address. > Currently, only IPv4 and IPv6 are supported. > > Signed-off-by: Michal Privoznik <mpriv...@redhat.com> > --- > diff to v1: > -move from guest-getip to guest-network-info > -replace black boxed algorithm for population count > -several coding styles improvements > > qapi-schema-guest.json | 29 ++++++++ > qga/guest-agent-commands.c | 163 > ++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 192 insertions(+), 0 deletions(-) >
> + } else if (family == AF_INET6) { > + /* interface with IPv6 address */ > + tmp_addr_ptr = &((struct sockaddr_in6 > *)ifa->ifa_addr)->sin6_addr; > + inet_ntop(AF_INET6, tmp_addr_ptr, addr6, sizeof(addr6)); > + > + info = g_malloc0(sizeof(*info)); > + info->value = g_malloc0(sizeof(*info->value)); > + info->value->iface.name = g_strdup(ifa->ifa_name); > + info->value->iface.ipaddr = g_strdup(addr6); In fact, I've forgotten to add: info->value->iface.ipaddrtype = GUEST_IP_ADDR_TYPE_IPV6; So I guess I'll send v3.