tcpdump mailing list archives

Re: pcap shared libraries: inconsistencies across


From: Jonathan Gruenhut <jonathan () zetapoint com>
Date: Sun, 17 Jun 2007 15:15:22 +0300

From: Guy Harris [mailto:guy () alum mit edu]
Sent: Thursday, June 14, 2007 1:18 AM

On Jun 13, 2007, at 9:32 AM, Jonathan Gruenhut wrote:

So, if you link with "-lpcap", the executable should be bound to
libpcap.so.0, *NOT* libpcap.so.0.8.3 or libpcap.so.0.9.4 or whatever.

You *did* link with "-lpcap", not "-lpcap.0.8.3" or something such as
that, right?

Yes.  (If you like anecdotes, know that after sending my original message, I went home, finished my day, and got into 
bed, and then the awful thought jolted me awake: I had forgotten to include my compile/link command line in my email!  
It's true that I didn't have too much trouble falling asleep, though.)

Are the versions of libpcap on the system the ones that came with the
system, or did you build and install your own shared libpcap library
in /usr/lib?

They're the ones that came with the system.  It occurs to me that if I had done it myself, there wouldn't be an 
incompatibility, so I guess it's good that I noticed this before I try to use the code in other places.

This is a good a point as any to thank Alex Dupuy for his helpful message.  I ran objdump -p on each of the 2 pcap 
libraries, and got
SONAME      libpcap.so.0.8.3
SONAME      libpcap.so.0.9.4
for them respectively, so it seems that that is the problem (or at least -a- problem).

He also mentioned that libtool can correct the SONAME tag.  However, from my understanding of libtool I would have to 
recompile the libraries to do that.  These machines don't belong to me, so I'm hesitant to make any lasting changes.  
(On the other hand, if it's really necessary, I'm sure I could get either permission or forgiveness.)

The so files:

[jonathan@computer94 ~]$ ls -l /usr/lib/*pcap*
lrwxrwxrwx 1 root root     12 Jun 13 20:27 /usr/lib/libpcap.so ->
libpcap.so.0
lrwxrwxrwx 1 root root     14 Jun 13 21:22 /usr/lib/libpcap.so.0 ->
libpcap.so.0.9
lrwxrwxrwx 1 root root     16 May  3 19:03 /usr/lib/libpcap.so.0.9 -
libpcap.so.0.9.4
-rwxr-xr-x 1 root root 168544 Jul 13  2006 /usr/lib/libpcap.so.0.9.4

What do "ls -l /usr/lib/libc*" and "/usr/lib/libnsl*" print?

For libc, the only relevant .so seems to be
-rw-r--r--  1 root root  204 Mar  8  2006 /usr/lib/libc.so
-rw-r--r-- 1 root root     238 Oct  8  2006 /usr/lib/libc.so
on the two machines.
(I'm ignoring cruft, crypt, curses, etc., of course.)

For libnsl, it seems a bit more interesting:
-rw-r--r-- 1 root root 116158 Oct  8  2006 /usr/lib/libnsl.a
lrwxrwxrwx 1 root root     21 May  3 19:22 /usr/lib/libnsl.so -> ../../lib/libnsl.so.1

-rw-r--r--  1 root root 105K Mar  8  2006 /usr/lib/libnsl.a
lrwxrwxrwx  1 root root   21 Oct 12  2006 /usr/lib/libnsl.so -> ../../lib/libnsl.so.1

Here, objdump shows me that
  SONAME      libnsl.so.1

And there's an additional section, absent from the pcap dump:

Version definitions:
1 0x01 0x09a77941 libnsl.so.1
2 0x00 0x0d696910 GLIBC_2.0
3 0x00 0x0d696911 GLIBC_2.1
        GLIBC_2.0
4 0x00 0x0d696912 GLIBC_2.2
        GLIBC_2.1
5 0x00 0x0963cf85 GLIBC_PRIVATE
        GLIBC_2.2

Or:
Version definitions:
1 0x01 0x09a77941 libnsl.so.1
2 0x00 0x0d696910 GLIBC_2.0
3 0x00 0x0d696911 GLIBC_2.1
        GLIBC_2.0
4 0x00 0x0d696912 GLIBC_2.2
        GLIBC_2.1

I fully realize that this topic is moving farther and farther from packet capture, so I would of course be delighted to 
get a pointer to more information in a more appropriate place.  (If in the libtool manual, please say exactly where, 
because I couldn't find something matching my situation.)

Thanks, all!
Jonathan

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: