RHEL/RH90 potential problem (pcap_freecode)

Hi,

I'm compiling Bro on a RHEL host (2.4.21-9.0.3.EL). From
google, it seems the problem happens also in RH 9.0. I'm
documenting it in the mailing list in case somebody else
falls in it. I could also add it to the bug list, though I don't
know how.

-Chema

1. Symptoms:

uname -a

Linux NA 2.4.21-9.0.3.EL #1 Tue Apr 20 19:54:32 EDT 2004 i686 i686 i386 GNU/Linux

./configure

[...]
checking for local pcap library... ../libpcap-0.7.2/libpcap.a
checking for pcap_freecode in -lpcap... no
checking for pcap headers... checking for bpf_set_bufsize... no
[...]

./make

[...]
g++ -I. -Ilibedit -O -I../libpcap-0.7.2 -I/usr/kerberos/include -Ilinux-include -c main.cc
In file included from Net.h:27,
                 from main.cc:47:
PktSrc.h:200: declaration of C function `int pcap_freecode(pcap_t*,
   bpf_program*)' conflicts with
../libpcap-0.7.2/pcap.h:182: previous declaration `void
   pcap_freecode(bpf_program*)' here

2. Explanation:

nm'ing ../libpcap-0.7.2/libpcap.a reveals it indeed has
pcap_freecode, so the problem is in the configure script.

After recreating the conftest.c script, I get:

gcc -o conftest -g -O2 conftest.c -L../libpcap-0.7.2 -lpcap -lssl -lcrypto

../libpcap-0.7.2/libpcap.a(nametoaddr.o)(.text+0x351): In function `pcap_ether_aton':
/n/buffet/home6/aciri/chema/projects/prps/src/libpcap-0.7.2/./nametoaddr.c:314: undefined reference to `__ctype_b'
../libpcap-0.7.2/libpcap.a(nametoaddr.o)(.text+0x411): In function `xdtoi':
/n/buffet/home6/aciri/chema/projects/prps/src/libpcap-0.7.2/./nametoaddr.c:250: undefined reference to `__ctype_b'
../libpcap-0.7.2/libpcap.a(nametoaddr.o)(.text+0x436):/n/buffet/home6/aciri/chema/projects/prps/src/libpcap-0.7.2/./nametoaddr.c:252: undefined reference to `__ctype_b'
../libpcap-0.7.2/libpcap.a(scanner.o)(.text+0x165d): In function `xdtoi':
/n/buffet/home6/aciri/chema/projects/prps/src/libpcap-0.7.2/scanner.l:348: undefined reference to `__ctype_b'
../libpcap-0.7.2/libpcap.a(scanner.o)(.text+0x1682):/n/buffet/home6/aciri/chema/projects/prps/src/libpcap-0.7.2/scanner.l:350: undefined reference to `__ctype_b'
collect2: ld returned 1 exit status

So, conftest failing on an undefined reference to __ctype_b is
interpreted as libpcap not having pcap_freecode.

As for the __ctype_b problem, check what RH has to say:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=91290#c6

3. Solution:

Recompile your libpcap.a