[AGENT++] illegal value at RowStatus after commitFailed

Frank Fock fock at agentpp.com
Sat Apr 11 16:26:10 CEST 2015


Hi Claus,

The code of snmpRowStatus::unset() is correct as it is. If there is no 
undo value (undo == NULL)
the undo cannot fail because there is nothing to undo.
The problem with the row creation is caused something else. If the row 
creation fails, the new
(intermediate) row has to be deleted (not added) to the table, but that 
works only if an
undo value had been set.

In your cause this seems not to be happened. Why?
A possible cause could be an overwriting of the snmpRowStatus::set 
method in a snmpRowStatus
sub-class.
Other causes have to be found or sorted out by debugging the code.

Best regards,
Frank


Am 08.04.2015 um 23:20 schrieb Claus Klein:
> Hi all,
>
> I found a problem with the table RowStatus and snmpRowStatus::unset():
>
> Claus-MBP:AgentPro clausklein$ snmpset -r0 -t10 -v3 -u unsecureUser -n subagent localhost:4700 'netSnmpHostRowStatus."test2"' = createAndGo \
>      'netSnmpHostAddressType."test2"' = ipv4 'netSnmpHostAddress."test2"' x 7F000002  netSnmpExampleInteger.0 = 1
> Error in packet.
> Reason: commitFailed
> Failed object: NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger.0
>
> Claus-MBP:AgentPro clausklein$ snmptable -Cib -r0 -t10 -v3 -u unsecureUser -n subagent localhost:4700 netSnmpHostsTable
> SNMP table: NET-SNMP-EXAMPLES-MIB::netSnmpHostsTable
>
>              index AddressType                                            Address     Storage RowStatus
>          \"nmsv6\"        ipv6 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 " nonVolatile    active
>          \"test2\"     unknown                                                 "" nonVolatile         0
>      \"localhost\"        ipv6 "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 " nonVolatile    active
> \"broadcasthost\"        ipv4                                     "FF FF FF FF " nonVolatile    active
> Claus-MBP:AgentPro clausklein$
>
> The undo ptr is NULL in this case and the row left in an illegal state?
> By the way, older versions of agent++ lib use this NULL pointer and crash!
>
> Is this a BUG or a feature?
>
> Should the code be like this:
> diff --git a/agent++/src/mib.cpp b/agent++/src/mib.cpp
> index 5d41353..64b57be 100644
> --- a/agent++/src/mib.cpp
> +++ b/agent++/src/mib.cpp
> @@ -668,8 +668,9 @@ int snmpRowStatus::unset()
>                  value = undo;
>                  undo = 0;
>          }
> +       return SNMP_ERROR_SUCCESS;
>     }
> -  return SNMP_ERROR_SUCCESS;
> +  return SNMP_ERROR_UNDO_FAIL;
>   }
>   
>   /**
>
> Best regards
> Claus
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> https://oosnmp.net/mailman/listinfo/agentpp

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231



More information about the AGENTPP mailing list