Agent++ compile fails if snmp++ has --disable-snmpv3

Updating from v4.1.2 to v4.3.0, compiling agent++ fails if snmp++ was compiled with --disable-snmpv3.

The problem is that several definitions are wrapped by “#ifdef _SNMPv3”

SNMP++ Configure

./configure --prefix=/mnt/swdevel/Torque/lib3p$LIBSUFFIX
–libdir=/mnt/swdevel/Torque/lib3p$LIBSUFFIX
–bindir=/mnt/swdevel/Torque/bin$LIBSUFFIX/util
–includedir=/mnt/swdevel/Torque/ext/extinclude/snmp++ --disable-snmpv3

AGENT++ Configure

./configure  --prefix=/mnt/swdevel/Torque/lib3p$LIBSUFFIX \
--libdir=/mnt/swdevel/Torque/lib3p$LIBSUFFIX \
--with-libsnmp-prefix=/mnt/swdevel/Torque/lib3p$LIBSUFFIX \
--bindir=/mnt/swdevel/Torque/bin$LIBSUFFIX/util \
--includedir=/mnt/swdevel/Torque/ext/extinclude/agent++ \
WITH_NAMESPACE=1 STATIC_REQUEST_LIST=1 --enable-static=no \
CPPFLAGS="-I /mnt/swdevel/Torque/ext/extinclude/snmp++" \
snmp_LIBS="-L/mnt/swdevel/Torque/lib3p$LIBSUFFIX"

Error:

libtool: compile: g++ -DHAVE_CONFIG_H -I. -I… -I…/include -pthread -I /mnt/swdevel/Torque/ext/extinclude/snmp++ -D_GNU_SOURCE -D_XOPEN_SOURCE=XPG6 -g -O2 -pthread -MT mib.lo -MD -MP -MF .deps/mib.Tpo -c mib.cpp -fPIC -DPIC -o .libs/mib.o
In file included from mib.cpp:31:
…/include/agent_pp/notification_originator.h:234:39: error: ‘snmpCommunityEntry’ has not been declared
void set_snmp_community_entry(snmpCommunityEntry* communityEntryRef) {
^~~~~~~~~~~~~~~~~~
…/include/agent_pp/notification_originator.h:246:17: error: ‘snmpCommunityEntry’ does not name a type; did you mean ‘oidSnmpCommunityEntry’?
virtual snmpCommunityEntry* get_snmp_community_entry();
^~~~~~~~~~~~~~~~~~
oidSnmpCommunityEntry
…/include/agent_pp/notification_originator.h:298:32: error: ‘nlmLogEntry’ has not been declared
void set_nlm_log_entry(nlmLogEntry* nlmLogEntryRef) {

Also, the call to “SnmpMessage::load(0, pdu, community, version, 0, 0, 0);” fails with "wrong number of arguments, since ‘mpv3’ isn’t declared when _SNMPv3 is not defined.

SnmpMessage() : bufflen(MAX_SNMP_PACKET), valid_flag(false) {};
// load up using a Pdu, community and SNMP version
// performs ASN.1 serialization
// result status returned
private:
int load(
#ifdef _SNMPv3
v3MP* mpv3,
#endif
const Pdu &pdu, // Pdu to serialize
const OctetStr &community, // community name to use
const snmp_version version, // SNMP version, v1 or v2
const OctetStr *engine_id, // optional v3
const OctetStr *security_name, // optional v3
const int security_model); // optional v3
public:
int load( const Pdu &pdu, // Pdu to serialize
const OctetStr &community, // community name to use
const snmp_version version) // SNMP version, v1 or v2
{
return load(0, pdu, community, version, 0, 0, 0);

We will try to fix that with the next AGENT++ release. Nevertheless, I would like to know why you really want to run SNMP++ without SNMPv3?
I am currently thinking about eliminating this compiler switch from the code (including the disabling of multi-threading support) because SNMPv3 is now the only Internet Standard SNMP version for nearly 20 years. It is probably time to switch to something secure :wink:

Hi Frank,

Thanks. Our legacy product originally used a very very old snmp++/agent++ (ca. 2005?). At that time v3 did work in our product, but updating both snmp++ and agent++ broke a lot of things in our code. Since few of our customers use SNMP we delayed updating our code to work in v3 with the new agent++; just disabling v3 worked. Until it didn’t…

I agree about the status of v3 vs v2. Removing the switch is the right thing.

Danny