From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyH4z-00054I-Fg for qemu-devel@nongnu.org; Fri, 29 May 2015 05:59:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyH4u-0004JN-7T for qemu-devel@nongnu.org; Fri, 29 May 2015 05:59:53 -0400 Received: from relay.parallels.com ([195.214.232.42]:54617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyH4t-0004HM-RF for qemu-devel@nongnu.org; Fri, 29 May 2015 05:59:48 -0400 Message-ID: <5568387D.4060808@parallels.com> Date: Fri, 29 May 2015 12:59:25 +0300 From: Olga Krishtal MIME-Version: 1.0 References: <1432838461-2637-1-git-send-email-kallan@suse.com> <1432838461-2637-3-git-send-email-kallan@suse.com> <55679D0F.8090804@redhat.com> In-Reply-To: <55679D0F.8090804@redhat.com> Content-Type: multipart/alternative; boundary="------------030306020608090205000304" Subject: Re: [Qemu-devel] [PATCH v3 2/2] qga: win32 implementation of qmp_guest_network_get_interfaces List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Kirk Allan , qemu-devel@nongnu.org Cc: sw@weilnetz.de, mdroth@linux.vnet.ibm.com --------------030306020608090205000304 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit On 29/05/15 01:56, Eric Blake wrote: > On 05/28/2015 12:41 PM, Kirk Allan wrote: >> By default, IP addresses and prefixes will be derived from information >> obtained by various calls and structures. IPv4 prefixes can be found >> by matching the address to those returned by GetAdaptersInfo. IPv6 >> prefixes can not be matched this way due to the unpredictable order of >> entries. >> >> In Windows Visa/2008 guests and newer, it is possible to use inet_ntop() > s/Visa/Vista/ > >> and OnLinkPrefixLength to get IPv4 and IPv6 addresses and prefixes. > Why the double spacing? > >> Setting –extra-cflags in the build configuration to > Again, Unicode mdash looks odd. > >> ”- D_WIN32_WINNT-0x600 -DWINVER=0x600” or greater enables this functionality >> for those guests. Setting –ectra-cflags is not required and if not used, > s/ectra/extra/ > >> the default approach will be taken. >> >> Signed-off-by: Kirk Allan >> --- >> qga/commands-win32.c | 292 ++++++++++++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 290 insertions(+), 2 deletions(-) >> + >> +static char *guest_inet_ntop(int af, void *cp, char *buf, size_t len) >> +{ >> +#if (_WIN32_WINNT >= 0x0600) && defined(ARCH_x86_64) >> + /* If built for 64 bit Windows Vista/2008 or newer, inet_ntop() is >> + * available for use. Otherwise, do our best to derive it. >> + */ >> + return (char *)InetNtop(af, cp, buf, len); >> +#else > Are you sure glib doesn't provide some sort of inet_ntop wrapper that > you could crib, instead of rolling your own? And if you must roll your > own, do it as a separate patch from the rest of this work, possibly by > copying from glibc or other existing implementation (with proper credits > to the upstream source), rather than writing it from scratch. Agree. Moreover, there is separate functions for inet4 and inet6. Pls, look here https://developer.gnome.org/libnm/stable/libnm-nm-utils.html Here you can find nm_utils_inet4/6_ntop() description. >> + u_char *p; > u_char is not a standard typedef; uint8_t is more common. > --------------030306020608090205000304 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit
On 29/05/15 01:56, Eric Blake wrote:
On 05/28/2015 12:41 PM, Kirk Allan wrote:
By default, IP addresses and prefixes will be derived from information
obtained by various calls and structures.  IPv4 prefixes can be found
by matching the address to those returned by GetAdaptersInfo.  IPv6
prefixes can not be matched this way due to the unpredictable order of
entries.

In Windows Visa/2008 guests and newer, it is possible to use inet_ntop()
s/Visa/Vista/

and  OnLinkPrefixLength to get  IPv4 and IPv6 addresses and prefixes.
Why the  double  spacing?

Setting –extra-cflags in the build configuration to
Again, Unicode mdash looks odd.

”- D_WIN32_WINNT-0x600 -DWINVER=0x600” or greater enables this functionality
for those guests.  Setting –ectra-cflags is not required and if not used,
s/ectra/extra/

the default approach will be taken.

Signed-off-by: Kirk Allan <kallan@suse.com>
---
 qga/commands-win32.c | 292 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 290 insertions(+), 2 deletions(-)

      
+
+static char *guest_inet_ntop(int af, void *cp, char *buf, size_t len)
+{
+#if (_WIN32_WINNT >= 0x0600) && defined(ARCH_x86_64)
+    /* If built for 64 bit Windows Vista/2008 or newer, inet_ntop() is
+     * available for use.  Otherwise, do our best to derive it.
+     */
+    return (char *)InetNtop(af, cp, buf, len);
+#else
Are you sure glib doesn't provide some sort of inet_ntop wrapper that
you could crib, instead of rolling your own?  And if you must roll your
own, do it as a separate patch from the rest of this work, possibly by
copying from glibc or other existing implementation (with proper credits
to the upstream source), rather than writing it from scratch.
Agree. Moreover, there is separate functions for inet4 and inet6.
Pls, look here https://developer.gnome.org/libnm/stable/libnm-nm-utils.html
Here you can find nm_utils_inet4/6_ntop() description.


      
+    u_char *p;
u_char is not a standard typedef; uint8_t is more common.


--------------030306020608090205000304--