0

I have read several RFCs about the SNMP protocol, and they are usually written in cryptic and opaque style, so I have probably missed the proper information and I apologize in advance for what is probably a simple question...

I am unclear about what kind of error in a get command for instance would set the error and error index fields in the snmp get-response message. Since I have been using Net-SNMP to send commands (and the snmp simulator at demo.snmplabs.com), I have not been able to send improperly formatted messages to see what kind of response I would get. I have started writing my own SNMP test tool (in Visual Basic) just to be able to send improperly formatted messages but it will be a fair amount of work before I can use it as a validated test tool.

When sending requests for non-existing OIDs or with wrong data type, it appears that Net-SNMP handles the errors without needing error/error-index values.

Any suggestion appreciated

Didier
  • 36
  • 1
  • 7

1 Answers1

0

It should be possible to generate errors for SNMP GETs but perhaps easier to start with generating errors for SETs.

➜  snmpset -v 2c -c private  demohost  sysName.0 s "foo" 
SNMPv2-MIB::sysName.0 = STRING: foo

In version below agent rejects the SET...

➜  snmpset -v 2c -c private  demohost   ucdDemoPublicString.0 s "TEST" 
Error in packet.
Reason: noCreation (That table does not support row creation or that object can not ever be created)
Failed object: UCD-DEMO-MIB::ucdDemoPublicString.0

Use -d to see the packets back and forth.

k1eran
  • 4,492
  • 8
  • 50
  • 73
  • Thanks for the suggestion. I have been creating purposely bad definitions (MIB data type not matching actual message data type for instance), but I have not been able to actually make the agent set the error and error-index fields to something other than 0. I guess that to set these error fields, the snmp message itself should not be properly formatted (something Net-SNMP won't do), so that means I have to create my own "badly formatted" messages (in the sense of "bad ASN.1 encoding" for instance). That is the direction I am taking now so I am writing a tool for that in Visual basic. – Didier Sep 04 '14 at 13:31
  • I could also force my SNMP agent (my own code running on a Cortex-M3) to return badly formatted messages to see how Net-SNMP deals with that. – Didier Sep 04 '14 at 13:34