aboutsummaryrefslogtreecommitdiffstats
path: root/packet-snmp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-09-08 07:14:01 +0000
committerGuy Harris <guy@alum.mit.edu>2000-09-08 07:14:01 +0000
commit0653c5b18bce4d9fc3c7cd2eddc84c2cd666247b (patch)
tree488c6a2f5ed5067d562a5801ca03b23740f5d16f /packet-snmp.c
parentf0e7e261197321a58677b03dd526a79f9cb4eedc (diff)
Load "libsnmp.so.0", not "libsnmp.so":
on the systems that have the problem we're working around, the SNMP shared library is "libsnmp.so.0"; on those systems, there's also no "libsnmp.so" unless the user has installed the UCD SNMP development package or has made a symlink from "libsnmp.so" to "libsnmp.so.0" by hand, and we don't want to force users to do that (some of them may be sufficiently new to UNIX that they don't know how to do that); the run-time linker, if told to load "libsnmp.so", won't necessarily realize that it's the same object as "libsnmp.so.0", and may load it again rather than using the already-loaded object, which might not be a good idea. svn path=/trunk/; revision=2398
Diffstat (limited to 'packet-snmp.c')
-rw-r--r--packet-snmp.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/packet-snmp.c b/packet-snmp.c
index 8cf23aebe8..d908fe6f7b 100644
--- a/packet-snmp.c
+++ b/packet-snmp.c
@@ -2,7 +2,7 @@
* Routines for SNMP (simple network management protocol)
* D.Jorand (c) 1998
*
- * $Id: packet-snmp.c,v 1.47 2000/08/13 14:09:00 deniel Exp $
+ * $Id: packet-snmp.c,v 1.48 2000/09/08 07:14:01 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -1971,10 +1971,15 @@ proto_register_snmp(void)
when run on older versions, routines not present on those
older versions.
- I.e., we load "libsnmp.so" with "dlopen()", and call
+ I.e., we load "libsnmp.so.0" with "dlopen()", and call
"dlsym()" to try to find "snmp_set_suffix_only()"; if we
don't find it, we make the appropriate call to
- "ds_set_int()" instead.
+ "ds_set_int()" instead. (We load "libsnmp.so.0" rather
+ than "libsnmp.so" because, at least on RH 6.2, "libsnmp.so"
+ exists only if you've loaded the libsnmp development package,
+ which makes "libsnmp.so" a symlink to "libsnmp.so.0"; we
+ don't want to force users to install it or to make said
+ symlink by hand.)
We do this only on Linux, for now, as we've only seen the
problem on Red Hat; it may show up on other OSes that bundle
@@ -1989,12 +1994,26 @@ proto_register_snmp(void)
*if* they're thin enough; however, as this code is currently
used only on Linux, we don't worry about that for now.) */
- libsnmp_handle = dlopen("libsnmp.so", RTLD_LAZY|RTLD_GLOBAL);
+ libsnmp_handle = dlopen("libsnmp.so.0", RTLD_LAZY|RTLD_GLOBAL);
if (libsnmp_handle == NULL) {
- /* We didn't find "libsnmp.so"; we may be linked
- statically, in which case whatever call the following
- line of code makes will presumably work, as
- we have the routine it calls wired into our binary. */
+ /* We didn't find "libsnmp.so.0".
+
+ This could mean that there is no SNMP shared library
+ on this system, in which case we were linked statically,
+ in which case whatever call the following line of code
+ makes will presumably work, as we have the routine it
+ calls wired into our binary. (If we were linked
+ dynamically with "-lsnmp", we would have failed to
+ start.)
+
+ It could also mean that there is an SNMP shared library
+ on this system, but it's called something other than
+ "libsnmp.so.0"; so far, we've seen the problem we're
+ working around only on systems where the SNMP shared
+ library is called "libsnmp.so.0", so we assume for now
+ that systems with shared SNMP libraries named something
+ other than "libsnmp.so.0" have an SNMP library that's
+ not 4.1.1. */
snmp_set_suffix_only(2);
} else {
/* OK, we have it loaded. Do we have