[AGENT++] Why is it possible to destroy an non existing row?
Claus Klein
claus.klein at arcormail.de
Tue Jun 18 23:10:08 CEST 2013
Hi,
I can't understand why it should possible to delete a non existing row?
I have added this code to prevent this strange behavior:
int netSnmpHostsEntry::is_transition_ok(MibTable* table, MibTableRow* row, const Oidx& index,
int currentStatus, int requestedStatus) {
// The row 'row' with 'index' from 'table' (which will be 0 for local table)
// is requested to change status. Accept or deny this state change here.
//--AgentGen BEGIN=netSnmpHostsEntry::is_transition_ok
if ((currentStatus == rowEmpty) && (requestedStatus == rowDestroy)) {
std::cerr << BOOST_CURRENT_FUNCTION << "(" << currentStatus << " -> "
<< requestedStatus << ") This is not allowed!" << std::endl;
return SNMP_ERROR_INCONSIST_VAL;
}
...
}
Without this check the following happens:
Claus-Kleins-MacBook-Pro:agentproI12 clausklein$ snmptable -Cib -r0 -t10 localhost hoststable
SNMP table: NET-SNMP-EXAMPLES-MIB::netSnmpHostsTable
index AddressType Address Storage RowStatus
\"loopback\" ipv6 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 " nonVolatile active
\"localhost\" ipv4 "7F 00 00 01 " nonVolatile active
\"broadcasthost\" ipv4 "FF FF FF FF " nonVolatile active
Claus-Kleins-MacBook-Pro:agentproI12 clausklein$ snmpset localhost netSnmpHostRowStatus.\"test\" = destroy
NET-SNMP-EXAMPLES-MIB::netSnmpHostRowStatus.\"test\" = INTEGER: destroy(6)
Claus-Kleins-MacBook-Pro:agentproI12 clausklein$ snmptable -Cib -r0 -t10 localhost hoststable
SNMP table: NET-SNMP-EXAMPLES-MIB::netSnmpHostsTable
index AddressType Address Storage RowStatus
\"loopback\" ipv6 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 " nonVolatile active
\"localhost\" ipv4 "7F 00 00 01 " nonVolatile active
\"broadcasthost\" ipv4 "FF FF FF FF " nonVolatile active
\"test\" ? ? nonVolatile destroy
Claus-Kleins-MacBook-Pro:agentproI12 clausklein$ snmpset localhost netSnmpHostRowStatus.\"test\" = destroy
Error in packet.
Reason: inconsistentValue (The set value is illegal or unsupported in some way)
Failed object: NET-SNMP-EXAMPLES-MIB::netSnmpHostRowStatus.\"test\"
Claus-Kleins-MacBook-Pro:agentproI12 clausklein$
... and the index is blocked with RowStatus "destroy" forever.
Tested with shared and non shared Tables; current net-snmp as agentX master and
agent++v3.5.31
agentX++v1.4.18a
libdes-l-4.01a
snmp++v3.2.25
as agentX subagent.
//Regards
Claus
More information about the AGENTPP
mailing list