From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyMYg-0002Ut-1K for qemu-devel@nongnu.org; Fri, 17 Feb 2012 07:05:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyMYa-0005Vf-9p for qemu-devel@nongnu.org; Fri, 17 Feb 2012 07:05:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyMYa-0005Vb-1U for qemu-devel@nongnu.org; Fri, 17 Feb 2012 07:04:56 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1HC4t6G023695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Feb 2012 07:04:55 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q1HC4sNM010000 for ; Fri, 17 Feb 2012 07:04:55 -0500 Received: from [10.34.27.226] (dhcp-27-226.brq.redhat.com [10.34.27.226]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q1HC4rhu027314 for ; Fri, 17 Feb 2012 07:04:54 -0500 Message-ID: <4F3E4265.6070700@redhat.com> Date: Fri, 17 Feb 2012 13:04:53 +0100 From: Michal Privoznik MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] qemu-ga: Add guest-network-info command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 > --- > 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.