Nmap Development mailing list archives
Re: Your (?) Nmap patch
From: Gioacchino Mazzurco <gmazzurco89 () gmail com>
Date: Tue, 18 Aug 2015 18:21:56 +0200
Fix committed in r35137 Cheers! On Monday, August 17, 2015 03:33:12 PM Gioacchino Mazzurco wrote:
Ok it seems have a very simple fix just by moving struct sockaddr_in * addrv4p = (struct sockaddr_in *) addr; as first line of the function, if there is no negative feedback to this I'll commit it in the following days ;) Cheers! On Monday, August 17, 2015 12:20:23 PM Gisle Vanem wrote:Gioacchino Mazzurco <gmazzurco89 () gmail com> wrote:This doesn't work with a non-C99 compiler:Does nmap supports older compilers?Define "older". Microsoft Visual-C 2013 isn't that old. It has worked fine for the .c code since it was released (except the nsock/tests/*.c code with *require* gcc).+int sockaddr_storage_inet_pton(const char * ip_str, struct sockaddr_storage * addr) +{ +#if HAVE_IPV6 + struct sockaddr_in6 * addrv6p = (struct sockaddr_in6 *) addr; + if ( 1 == inet_pton(AF_INET6, ip_str, &(addrv6p->sin6_addr)) ) + { + addr->ss_family = AF_INET6; + return 1; + } +#endif // HAVE_IPV6 + + struct sockaddr_in * addrv4p = (struct sockaddr_in *) addr; + if ( 1 == inet_pton(AF_INET, ip_str, &(addrv4p->sin_addr)) ) I.e. potentially declarations after code.The problem is tha ti don't see the declarations after code, some suggestion on how to fix that ?With 'HAVE_IPV6 == 1', you'll get: struct sockaddr_in6 * addrv6p = ... if (xxx) ... struct sockaddr_in * addrv4p = ... which needs a C99 compiler AFAICS. Since compiling nbase/*.c as C++ is impossible, you could change sockaddr_storage_inet_pton() and into legal C-89. Try with 'gcc -ansi' or something.P.S. maybe better to talk this on the devel list it is ok for you if i forward it ?CC'ed.
_______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: Your (?) Nmap patch Gisle Vanem (Aug 17)
- Re: Your (?) Nmap patch Gioacchino Mazzurco (Aug 17)
- Re: Your (?) Nmap patch Gioacchino Mazzurco (Aug 18)
- Re: Your (?) Nmap patch Gioacchino Mazzurco (Aug 17)