Nmap Development mailing list archives

Re: Compile error on netbsd


From: Jay Fink <jay.fink () gmail com>
Date: Mon, 31 Aug 2009 09:13:15 -0400

I tried a few different approaches this morning and of course - the
simplest one worked :-)
I want to test this in a few places first but this gets nmap-current
to work on netbsd 5.99.X.
So far I have tested on osX (darwin 9.7.0) - this evening I will test
on freebsd 7, 8 and debian-current.

I will look into the sed issue afterward.

thanks,
  j

--- tcpip.cc.orig       2009-08-31 08:59:30.000000000 -0400
+++ tcpip.cc    2009-08-31 09:10:28.000000000 -0400
@@ -3037,7 +3037,7 @@
   ifr = ifc.ifc_req;

   for (ifr = ifc.ifc_req;
-       ifr && ifr->ifr_name[0] && (void *) ifr < ifc.ifc_buf + ifc.ifc_len;
+       ifr && ifr->ifr_name[0] && (void *) ifr < (caddr_t)
ifc.ifc_buf + ifc.ifc_len;
        ifr = (struct ifreq *) ((char *) ifr + len)) {
     struct sockaddr_in *sin;
     struct ifreq tmpifr;


On Fri, Aug 28, 2009 at 12:52 PM, Jay Fink<jay.fink () gmail com> wrote:
On Fri, Aug 28, 2009 at 12:38 PM, David Fifield<david () bamsoftware com> wrote:
On Fri, Aug 28, 2009 at 11:27:04AM -0400, Jay Fink wrote:
Finally had a chance to look into this some more; David was dead on;
the ifconf struct is different on NetBSD;  ifcu_buf  was changed to
void * during a core address type cull:

struct  ifconf {
        int     ifc_len;                /* size of associated buffer */
        union {
                void *  ifcu_buf;
                struct  ifreq *ifcu_req;
        } ifc_ifcu;

As a dirty trick I changed it back and it compiles but still does not
send back an iflist, I will work on a macro or something to replace it
but I'm not sure why it kicks back it can't find the information yet.

Note FreeBSD8 and Linux use the core address pointer.

I don't know what you mean by "core address." Does the attached patch

on freebsd and glibc ifcu_buf is type caddr_t (or core address). On
NetBSD it is type void *
sorry for the confusion, core address is the long name for caddr_t.

work? It just casts ifc_buf to a char pointer when we want to do
byte-level arithmetic. You should try it with unmodified header files.

the patch doesn't work right; I thought it would but it does not.  I
got it to compile by changing the header files but I know that is not
a real solution. What I meant was I am going to keep working on a real
solution;  perhaps redefining ifconf  for NetBSD and OpenBSD.


David Fifield



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


Current thread: