Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: nmap 5 + 64-bit Solaris x86
From: David Fifield <david () bamsoftware com>
Date: Sat, 5 Mar 2011 00:44:09 -0800

On Thu, Dec 02, 2010 at 12:38:11AM -0500, John Cecere wrote:
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.

Thanks for reporting this and for doing the research. Can you send me
your config.log file? I'm interested in seeing these output lines:

checking for inet_ntop... yes
checking for inet_pton... yes

On my GNU/Linux system, inet_pton.c never even gets built because it's
not necessary. Possibly inet_ntop is defined but not inet_pton.

David Fifield
Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
  • Re: nmap 5 + 64-bit Solaris x86 David Fifield (Mar 05)
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]