strange dlopen() problem with ucd-snmp RPM

Tomasz Kłoczko kloczek at rudy.mif.pg.gda.pl
Thu Apr 4 13:46:54 CEST 2002


On Thu, 4 Apr 2002, John P. Looney wrote:

>  This is a strange one.
> 
>  I use ucd-snmp a lot here in work. I added three of my own patches to the
> RPM (one fixes a simple problem with snmptable, the others are to add some
> ID fields so we can tell that it's running our version of ucd-snmp).
> 
>  I rebuilt it, and it would not load snmpd extensions - I usually have
> something like:
> 
> dlmod antefacto /usr/share/snmp/modules/antefacto.so
> 
>  in my snmpd config file. This failed with;
> 
> Apr  3 12:19:02 bartender ucd-snmp[492]: /etc/snmp/snmpd.conf: line 24: Warning: Unknown token: dlmod. 

IIRC ucd-snmp ver 4.2.3 still does not support dynamicaly loadable
modules (IIRC finish this is listed in TODO file).
I dont remember anything from ucd-snmp dok about how to enable using
dynamically loadable modules. Do you know where it is described ?

>  So, I investigated, and found that although this was printed by
> configure:
> 
> ....
> checking for shl_load... no
> checking for shl_load in -ldld... no
> checking for dlopen... no
> checking for dlopen in -ldl... yes
> checking whether a program can dlopen itself... yes
> checking whether a statically linked program can dlopen itself... yes
> checking whether -lc should be explicitly linked in... no
> ....
> 
>  config.h did not have DLOPEN defined;

config.h is generated from config.h.in which is generated by autoheader.
You must regenerate config.h.in by run autoheader or if DLOPEN isnt't
defined in configure.in you must add this to acconfih.h and after this 
run autoheader.

> [root at bartender ucd-snmp-4.2.3]# grep DL config.h |grep -v MIBS
> #define HAVE_DLFCN_H 1
> /* #undef HAVE_DLOPEN */

As you see in HAVE_DLOPEN symbol comes with libtool.m4 .. so probaly
proper solution it will be patch this for change s/DLOPEN/HAVE_DLOPEN/.

> #define HAVE_LIBDL 1
> /* #undef HAVE_NET_IF_DL_H */
> #define HAVE_STDLIB_H 1  
> 
>  I was able to fix this by changing the SPEC file of ucd-snmp from;
> 
>     --with-ldflags="%{rpmldflags}" \
>  to
>     --with-ldflags="-ldl %{rpmldflags}" \

This probablu icorrect solution. Proper seems will be fix around
HAVE_DLOPEN.

>  Does anyone know why this could happen ? This change is not required on
> RedHat at all. The configure script notes that dlopen does work, and needs
> -ldl - but it does not show this in config.log.

Can you pack all files by "rpm -bs ucd-snmp.spec" and put generated 
src.rpm somewhere on ftp/http ? (send me on priv URL if it is possible).

BTW. Do you know anything about other usefull modules for ucd-snmp ?
In current dist ucd-snmp is included ipfwchains/ipfwchains but as 
statically linked module and source code seems not so freshen and not 
functional [1]. If I will have woking example dynamically loaded modul 
probably it will be possible modyfi this as dlopen() module.

[1] - I still cant use this for setup FW rules but partial view is 
possible. Probaly it will need more work on extendig MIB file and rewrite 
module code.

BTW2. Today I'm prepare mbrowse (simple MIB browser). It is now avalaible 
on ftp. Also continue in SNMP subject also on ftp is avalaible gxsnmp
(partialy works) and SMI tools. Do you know anything about other SNMP 
tools ? (except scotty)

kloczek
-- 
-----------------------------------------------------------
*Ludzie nie mają problemów, tylko sobie sami je stwarzają*
-----------------------------------------------------------
Tomasz Kłoczko, sys adm @zie.pg.gda.pl|*e-mail: kloczek at rudy.mif.pg.gda.pl*



More information about the pld-users-en mailing list