Nmap Development mailing list archives

Re: fix to build nmap on some OpenBSD archs


From: David Fifield <david () bamsoftware com>
Date: Wed, 28 Jul 2010 21:38:12 -0600

On Thu, Jul 08, 2010 at 12:58:57PM +0200, Sebastian Reitenbach wrote:
OpenBSD sparc and some others have gcc-2.95 as default compiler. Appended
patch against nmap 5.21 fixes compilation, so that I can actually use it on
my sparc. 

Thanks. I see that this patch is mostly about not mixing code and
declarations in C code (not C++, where it is allowed). I have committed
that.

the patch regarding nsock/src/nsock_pcap.c was already in the OpenBSD ports
tree, only parts of it are responsible to fix the build with gcc2. The part
where I am not responsible and not sure what it fixes is the following:

@@ -325,11 +323,14 @@ int do_actual_pcap_read(msevent *nse)
 void nse_readpcap(nsock_event nsee,
        const unsigned char **l2_data, size_t *l2_len,
        const unsigned char **l3_data, size_t *l3_len,
-       size_t *packet_len, struct timeval *ts)
+       size_t *packet_len, struct bpf_timeval *ts)
 {
        msevent *nse = (msevent *)nsee;

I guess the timeval is not existing.

I'm not sure about this either. You say it is necessary for you to build
on OpenBSD? What if you use the --with-libpcap=included configure
option? I tried applying this part of the patch on x86_64 GNU/Linux, and
got the error

make[1]: Entering directory `/home/david/nmap/nsock/src'
gcc -c -I../../nbase -DHAVE_CONFIG_H -DNSOCK_VERSION=\"0.02\" -D_FORTIFY_SOURCE=2 -I../include -I../../libpcap -g -O2 
-Wall   -Wall   nsock_pcap.c -o nsock_pcap.o
nsock_pcap.c:323: warning: ‘struct bpf_timeval’ declared inside parameter list
nsock_pcap.c:323: warning: its scope is only this definition or declaration, which is probably not what you want
nsock_pcap.c:320: error: conflicting types for ‘nse_readpcap’
../include/nsock.h:575: error: previous declaration of ‘nse_readpcap’ was here
nsock_pcap.c: In function ‘nse_readpcap’:
nsock_pcap.c:350: error: dereferencing pointer to incomplete type
make[1]: *** [nsock_pcap.o] Error 1
make[1]: Leaving directory `/home/david/nmap/nsock/src'
make: *** [nsock_build] Error 2

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

Current thread: