On 22/01/2008, Giuseppe Modugno wrote:
> What should I do if the sub-agent doesn't receive any answer from the
> equipment after the timeout, or it receives a corrupted answer?
> Could SNMP_ERR_NOACCESS be the right choice,

Most of the SNMP error codes have very specific meanings,
and the protocol specs are very definite about exactly when
they should be used.

Both noAccess and resourceUnavailable are only used with
SET requests (RFC 1905, section 4.2.5, steps (1) & (11))

> or a more general error like SNMP_ERR_GENERR?

This is covered explicitly in the same RFC (section 4.2.1)

> Are there any differences between exceptions
> (noSuchObject, noSuchInstance and endOfMib) and error codes?

If you have two varbinds in the request, and one fails with an
exception, then the agent will return the value for the other
varbind as part of the same response.
If one fails with an error, then the response reports that error,
and nothing else.

This can be seen by comparing the following two commands:

snmpget -Cf -v 1 -c public localhost sysName sysName.0
snmpget -Cf -v 2c -c public localhost sysName sysName.0

The first returns an error (since SNMPv1 didn't include the
idea of exceptions), and doesn't process the valid varbind.
The second returns the exception, and the requested value.


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
Net-snmp-coders mailing list