tcpdump mailing list archives

Re: AIX BPF driver load


From: Shaun <delius () progsoc uts edu au>
Date: Tue, 11 Feb 2003 15:10:54 +1100 (EST)


I checked your change in, although I put "pcap-bpf.h" in the top-level
include directory rather than a "net" subdirectory (and removed some
stuff for the kernel BPF implementation from it).

One problem I've found - the new "-lpcap" has to be linked with "-lodm".

Yeah, sorry, I should have specified that one I guess. This is only the
case because the new pcap is a static library, there is no way to specify
dependencies for the static object. (Actually, the dependency is on -lodm
and -lcfg)

Unfortunately, that means that all programs using libpcap will, in order
to work on AIX, have to be built with "-lodm", meaning that their
configure scripts, etc. will have to be changed.

Indeed, either that or we can modify pcap to be built as a shared library
and avoid the problem?

Can you, on AIX 5.x, just link a program with "-lpcap" without having to
link it with "-lodm"?

With the native pcap, yes, because it is a shared library. If you want I
can provide the various make targets to build pcap as a shared library on
AIX?

If so, how is that done?

Basically you just create a 'shared library' object file then put it in an
archive. If you want you can add both 32 bit and 64 bit members. It looks
something vaguely like this:

xlc -g -G -o shr.o pcap-bpf.o fad-gifc.o pcap.o inet.o gencode.o
optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o
bpf_dump.o scanner.o grammar.o version.o -lodm -lcfg
ar rc libpcap.a ./shr.o

You can check the dynamic library dependencies of a library using
'dump'...

dump -vn ./libpcap.a  | more
....
./libpcap.a[shr.o]:
....
                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /usr/lpp/xlopt:/usr/lib:/lib
1                                    libodm.a            shr.o
2                                    libcfg.a            shr.o
3                                    libc.a              shr.o

You can also create a straight '.so' file with something like:

xlc -g -G -o libpcap.so pcap-bpf.o fad-gifc.o pcap.o inet.o gencode.o
optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o
bpf_dump.o scanner.o grammar.o version.o -lodm -lcfg

In this case it's necessary to add -brtl to the command line for programs
using the library.

Thoughts?

Cheers,
Shaun





-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: