Nmap Development mailing list archives

Fw: dnet\os.h - new libdnet version


From: Gisle Vanem <gvanem () broadpark no>
Date: Sat, 30 Aug 2008 23:23:43 +0200


----- Original Message ----- From: "David Fifield" <david () bamsoftware com>
To: "Gisle Vanem" <gvanem () broadpark no>
Sent: Saturday, August 30, 2008 10:59 PM
Subject: Re: dnet\os.h - new libdnet version


On Sat, Aug 30, 2008 at 08:44:46PM +0200, Gisle Vanem wrote:
I copied include/dnet/os.h from the newest upstream libdnet, which
deletes the other ssize_t. Please let me know if that works for you.

That works fine, but another patch broke MingW. Patch:

--- SVN-Latest\nbase\nbase_winunix.h    Sat Aug 30 20:06:34 2008
+++ nbase\nbase_winunix.h     Sat Aug 30 20:23:08 2008
@@ -121,7 +121,9 @@
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h> /* IPv6 stuff */
+#ifdef _MSC_VER
#include <wspiapi.h> /* Necessary for getaddrinfo before Windows XP. */
+#endif
#include <time.h>
#include <iptypes.h>
#include <stdlib.h>

(MingW doesn't have <wspiapi.h>).
Another patch I would like to add is:

--- SVN-Latest\TargetGroup.cc   Sat Jul 26 15:27:43 2008
+++ TargetGroup.cc    Sat Aug 30 20:29:37 2008
@@ -299,7 +299,7 @@
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = PF_INET6;
    rc = getaddrinfo(hostexp, NULL, &hints, &result);
-    if (rc != 0) {
+    if (rc != 0 || !result) {
      error("Failed to resolve given IPv6 hostname/IP: %s.  Note that you can't use '/mask' or '
[1-4,7,100-]' style ranges for IPv6.  Error code %d: %s", hostexp, rc, gai_strerror(rc));
      free(hostexp);
      if (result) freeaddrinfo(result);

-------------

On my Win-XP (sp3) box, I don't have IPv6 installed. But IPv6 lookups works just the
same (windns.dll is independant of IPv6 it seems). So, for some strange reason getaddrinfo() returns with 'rc==0', but 'result==NULL'. Better safe that sorry. Hence the extra test.

May I forward this message to the mailing list (or you can)? I'm no
expert on Windows or MinGW so I'd like to have some more people look at
it before committing.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: