On Tue, Jan 16, 2001 at 11:04:53AM -0800, Guy Harris wrote:
> On Tue, Jan 16, 2001 at 04:28:57PM +0100, Denis Ducamp wrote:
> > ~/libpcap-0.6.1$ make
> > gcc -O2 -I.  -DHAVE_CONFIG_H -c ./pcap-linux.c
> > ./pcap-linux.c:75: netinet/if_ether.h: No such file or directory
> 
> What happens if you put
> 
>       #if 0
> 
>               ...
> 
>       #endif
> 
> around the "#include <netinet/if_ether.h>" line?

This isn't enought for pcap-linux.c and I had to include another header :

@@ -72,7 +72,11 @@
 #include <net/if.h>
 #include <netinet/in.h>
 #include <linux/if_ether.h>
+#if 0
 #include <netinet/if_ether.h>
+#else
+#include <net/if_arp.h>
+#endif

 #ifdef HAVE_NETPACKET_PACKET_H
 #include <netpacket/packet.h>


And in the same file another modification is needed to define fix_program :


@@ -1196,7 +1200,7 @@
        return ifr.ifr_hwaddr.sa_family;
 }

-#ifdef HAVE_NETPACKET_PACKET_H
+#if defined(HAVE_NETPACKET_PACKET_H) || defined (SO_ATTACH_FILTER)
 static int
 fix_program(pcap_t *handle, struct sock_fprog *fcode)
 {


else no program could link to the library, fix_program being missing.

> and do the same in "nametoaddr.c, and tcpdump should do the same with
> "addrtoname.c".

For both, removing #include <netinet/if_ether.h> is enough and tcpdump
compiles, but it doesn't works fully :

# ./tcpdump -ln -vvv -i any
tcpdump: pcap_open_live: The "any" device isn't supported on 2.0[.x]-kernel systems

But I don't have a 2.0.x kernel, I have a 2.4.0-test4 kernel.

Compiling snort 1.7 with the new version of libpcap works, except -i any of
course... but that is the only reason why I want to upgrade libpcap !!!

I'll try tomorrow on a libc5 + 2.2.1x kernel system.

> > Please repair and put back the linux-include directory
> 
> That's entirely the *wrong* solution to this problem; most of those
> include files are only used to get packet layout definitions and the
> like, and tcpdump/libpcap should be supplying *all* of those by itself,
> and if the OS isn't supplying "if_ether.h" and that's used to declare a
> function, libpcap and tcpdump should simply avoid including the header,
> and declare the function elsewhere, e.g. in the "lbl/os-XXX.h" files,
> where other missing declarations are supplied.

Effectively, that is the good way. Like that a new port may be straight
forward and programmation abstracts as much as possible the system.

Denis Ducamp.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe

Reply via email to