Discussion:
Support library on two platforms (container_free issue)
luis cork
2017-03-07 15:38:37 UTC
Permalink
Hi All,

I have a snmp library built on (RedHat 6.4) with net-snmp-devel-5.5-50 and integrated with snmpd, works perfectly and by doing snmpwalks I can see my tables and values.

Now I need to support the same library on Centos7 (net-snmp-libs-5.7.2-24) and I just provide the same library to the box and I got a segfault on the container_free internal function.

Here is some output:

On the debug of the snmpd

internal:ratStatusCountersTable:_cache_free: called
trace: _container_free(): ../src/ratStatusCountersTable_interface.c, 750:
internal:ratStatusCountersTable:_container_free: called
trace: ratStatusCountersTable_container_free(): ../src/ratStatusCountersTable_data_access.c, 344:
verbose:ratStatusCountersTable:ratStatusCountersTable_container_free: called

The gdb stack

(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007f7ff2c21a0a in _ba_for_each () from /lib64/libnetsnmp.so.31
#2 0x00007f7fe5a2960a in CONTAINER_CLEAR (f=0x7f7fe5a2a1b0 <_container_item_free>, c=0x0, x=0x7f7ff40af490) at /usr/include/net-snmp/library/container.h:472
#3 _container_free (container=<optimized out>) at ../src/ratPerformanceCountersLastValuesTable_interface.c:762
#4 0x00007f7ff3566aae in release_cached_resources () from /lib64/libnetsnmpagent.so.31
#5 0x00007f7ff2bfac3c in run_alarms () from /lib64/libnetsnmp.so.31


I have checked that the code generated by mib2c is similar on both operating systems.

I built the library on Centos7, and that did worked without problems. Do I really need to recompile the library for each platform? Is there a way to have just one library that works on snmpd for both versions?

Any thoughts?

Thanks and regards,
Luis

Loading...