bpf.h version skew (was Re: [ARGUS] Peculiar cross platform argus/ra non-interoperability)

Michael J. Slifcak slif at bellsouth.net
Mon Aug 9 21:43:19 EDT 2004


Hi, Joe.

I believe that including bpf.h is not correct.

I believe that the sources should include pcap.h instead
(On Fedora, pcap.h includes pcap-bpf.h )

The attached script and patches are what I use on
RedHat Linux 9 and Fedora.  Except for the rpm bits of the script,
I believe (not tested) that the patches would work well
on FreeBSD, or any build platform that has a recent version
of libpcap library headers installed.

I hope this helps.
-Mike Slifcak



Joe Christy wrote:
>   Vis-a-vis my note of 08/09/2004 04:21 PM:
> 
>> ...
>> Could the problem I'm having now be another pcap version skew / header 
>> (re-)name situation? When I dig around I find that there some other 
>> source files that #include <bpf.h> besides gencode.c.  ...
> 
> 
> Make that #include <net/bpf.h>. I notice that in argus-2.0.6.fixes.1, 
> gencode.c gets compiled out of the box as:
> gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -I. 
> -I../include -I/usr/include  -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" 
> -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" 
> -DARGUSDEBUG=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 
> -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 
> -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 
> -D_FILE_OFFSET_BITS=64 -DHAVE_TCP_WRAPPER=1 -DHAVE_STRING_H=1 
> -DHAVE_FCNTL_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_SYSLOG_H=1 
> -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DCONFIG_X86_BSWAP=1 
> -DSTDC_HEADERS=1  -DARGUS_SYSLOG=1 -c ./gencode.c
> gencode.c:62:21: net/bpf.h: No such file or directory
> In file included from ../include/argus_filter.h:71,
>                  from gencode.c:65:
> ../include/gencode.h:194: error: `BPF_MEMWORDS' undeclared here (not in 
> a function)
> ../include/gencode.h:258: warning: `struct bpf_program' declared inside 
> parameter list
> ../include/gencode.h:258: warning: its scope is only this definition or 
> declaration, which is probably not what you want
> In file included from gencode.c:65:
> ../include/argus_filter.h:228: warning: `struct bpf_program' declared 
> inside parameter list
> On the other hand, in argus-clients-2.0.6.fixes.1, argus_filter.c (which 
> also #include's <net/bpf.h> gets compiled as:
> gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -I. 
> -I../include  -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" 
> -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" 
> -DARGUSDEBUG=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 
> -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 
> -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DARGUS_SASL=1 
> -D_FILE_OFFSET_BITS=64 -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 
> -DHAVE_SYS_FILE_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_ETHER_HOSTTON=1 
> -DHAVE_STRERROR=1 -DSTDC_HEADERS=1  -c ./argus_filter.c
> 
> One uses the -I../include -I/usr/include flags inside 
> argus-2.0.6.fixes.1 and gets errors, while the other substitutes -I. 
> (inside argus-clients-2.0.6.fixes.1) for -I/usr/include and doesn't get 
> errors.
> 
> Patching gencode.c in argus-2.0.6.fixes.1 to #include <pcap-bpf.h> 
> instead of <net/bpf.> allows it to compile, which make me think that the 
> -I../include in its compile line is shadowed by the -I/usr/include, so 
> when I upgraded to FreeBSD-4.10 I may have started getting a newer 
> libpcap (to judge by the differences in 
> argus-2.0.6.fixes.1/include/net/bpf.h and FreeBSD-4.10's 
> /usr/include/net/bpf.h) so on Fedora Core 2, ra, using only the 
> argus-clients-2.0.6.fixes.1/net/bpf.h when compiling argus_filter.c, is 
> getting a bunch of declarations for libpcap which no longer have much to 
> do with either the libpcap that argus is using over on FreeBSD-4.10 or 
> ra is using on FC2.
> 
>     Joe
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: build4.tar.gz
Type: application/x-gzip
Size: 12121 bytes
Desc: not available
URL: <https://pairlist1.pair.net/pipermail/argus/attachments/20040809/3f1db39e/attachment.bin>


More information about the argus mailing list