We are attempting to migrate our applications from ucd-snmp (4.2.5) to
net-snmp (5.0.6). One of our applications is based on the trap daemon
(snmptrapd). We finally got our application to compile, mainly by
replacing things like:
struct sockaddr_in *pduIp = (struct sockaddr_in *)&(pdu->address);
host = gethostbyaddr ((char *)&pduIp->sin_addr,sizeof (pduIp->sin_addr),
AF_INET);
with:
host = gethostbyaddr((char *) pdu->agent_addr, 4, AF_INET);
And a bunch of
ds_get_boolean(DS_APPLICATION_ID, DS_APP_NUMERIC_IP)
Replaced with:
netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_APP_NUMERIC_IP)
But now it faults during initialization:
(gdb) bt
#0 0x4207492e in _int_free () from /lib/tls/libc.so.6
#1 0x42073908 in free () from /lib/tls/libc.so.6
#2 0x40080a78 in sc_hash () from /usr/lib/libnetsnmp.so.5
#3 0x4007fdc0 in hash_engineID () from /usr/lib/libnetsnmp.so.5
#4 0x4007fc82 in search_enginetime_list () from
/usr/lib/libnetsnmp.so.5
#5 0x4007fa63 in set_enginetime () from /usr/lib/libnetsnmp.so.5
#6 0x4007f1c5 in init_snmpv3_post_config () from
/usr/lib/libnetsnmp.so.5
#7 0x40081a37 in snmp_call_callbacks () from /usr/lib/libnetsnmp.so.5
#8 0x40078b7e in read_configs () from /usr/lib/libnetsnmp.so.5
#9 0x400585fe in init_snmp () from /usr/lib/libnetsnmp.so.5
#10 0x080566d5 in snmp_manager::start(int, char**) (this=0xbfffeb6f,
argc=3, argv=0xbfffec94)
at snmp_manager.cpp:1303
#11 0x0804e191 in main (argc=5, argv=0xbffff554) at traphandler.cpp:215
#12 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
(gdb)
Apparently it is failing during the init_snmp call from our file
snmp_manager.cpp (which originally was snmptrapd.c). I noticed there
was all sorts of other things being initialized in the new snmptrapd.
Apparently the new snmptrapd is structured differently (it can run as an
agnetX subagent, it can manage multiple ports etc).
Is there anything else we need to initialize prior to calling init_snmp?
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders