Nmap Development mailing list archives

nmap 5 + 64-bit Solaris x86


From: John Cecere <john.cecere () oracle com>
Date: Thu, 02 Dec 2010 00:38:11 -0500

I found a bug in compiling nmap 5.21 on Solaris x86. I'm not sure if it affects SPARC as well.

In file included from nbase.h:452,
                 from snprintf.c:66:
nbase_ipv6.h:143: error: conflicting types for 'inet_ntop'
/usr/include/arpa/inet.h:69: error: previous declaration of 'inet_ntop' was here

The reason for the conflict seems to be that the last arg to inet_ntop is defined as a size_t in nbase_ipv6.h whereas Solaris has it defined as a socklen_t in arpa/inet.h. In 32-bit mode, these data types are compatible, but in 64-bit mode they're not:

# gcc -o tst tst.c
# ./tst
sizeof socklen_t = 4
sizeof size_t    = 4

# gcc -m64 -o tst tst.c
# ./tst
sizeof socklen_t = 4
sizeof size_t    = 8

Defining HAVE_INET_NTOP doesn't fix this as this only affects the prototype definition.

Hacking the last arg as a socklen_t in both the prototype and function almost allowed me to get it to build a 64-bit binary, but the final linking appeared to ignore my setting for CXXFLAGS and barfed on an "invalid ELF class" error. I had to set

CXX="g++ -m64"

to force it to do the final linking as 64-bit.

BTW, I've been a fan of nmap for many years. Thanks for a great piece of software.

Regards,
John

--
John Cecere
Principal Engineer - Oracle Corporation
732-987-4317 / john.cecere () oracle com
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: