[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] qemu-ga: Add guest-network-info command
From: |
Michal Privoznik |
Subject: |
Re: [Qemu-devel] [PATCH v2] qemu-ga: Add guest-network-info command |
Date: |
Fri, 17 Feb 2012 13:04:53 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120213 Thunderbird/10.0.1 |
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 <address@hidden>
> ---
> 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.