[AGENT++] MibTable Problem: Destroy a non-existing Row
Jens Engel
Jens.Engel at marconi.com
Mon Feb 20 11:59:41 CET 2006
Hello,
the MibTable implementation has a problem when a SNMP client tries to
destroy a non-existing row, ala:
snmpset myRowStatus.123 = destroy
The row is marked as destroyed but will never be removed.
In addition, it is not possible to destroy anymore by trying it a second
time (causes a SNMP response error).
PATCH: file:agent_pp/mib.cpp
int MibTable::set_value(Request* req, int reqind)
{
int status = SNMP_ERROR_SUCCESS;
Oidx tmpoid(req->get_oid(reqind));
MibLeaf* o;
if ((o = find(tmpoid)) != 0) {
// -- ROW-EXISTS:
...
}
else {
// -- UNKNOWN-ROW: Row does not exist yet.
...
if (row_status) {
Oidx ind(index(tmpoid));
MibTableRow* row = find_index(ind);
// check for status upgrade only if it is nessesary
if (get_row_status(row) == rowNotReady) {
... // Do propagation to notInService if
possible.
}
#if JE_AGENTPP_USE_DESTROY_DEAD_NEWBORN_ROW
else if (get_row_status(row) == rowDestroy) {
// -- CHECK: New-born row should be destroyed
again.
remove_row(ind);
notify_change(ind, REMOVE);
}
#endif
}
}
return status;
}
NOTES:
The patch is simplistic.
This means for the syndrome described above, a row is created and then
destroyed again.
In general, I would assume that you would want to omit the row creation in
this case.
But at least the row is not kept DEAD and hanging around in the MIbTable.
Ciao,
Jens Engel
More information about the AGENTPP
mailing list