SNMP version in agent response message



I devellop a SNMP agent with Win SNMP API 2.0.

The following list contains a summary of my agent inbitialization
steps:
1. SnmpStartup
2. SnmpSetTranslateMode (SNMPAPI_UNTRANSLATED_V2)
3. SnmpCreateSession, using a call back function in stead of window
handle an massage identifier.
4. SnmpStrToEntity, to create a local identity based on local ip
address (not 127.0.0.1 but the real ip address).
5. SnmpListen, using previously created entity to declare the
application as an agent.

At this point agent waits messages to enter the application through
the call back function.
I test the agent with two well known SNMP managers whiches provide
free evaluation version. PRTG and OpManager.
Using OpManager, every things works well but PRTG cannot discover my
agent.

The following list contains a summary of my agent response function:
1. Callback function is called by WinSNMP implementation.
2. SnmpRecvMsg, using requestId.
3. SnmpGetPduData
4. SnmpCountVbl
5. SnmpGetVb and SnmpSetVb, called for each variable in variable
bindings list.
6. SnmpSetPduData, to set pdu type to SNMP_PDU_RESPONSE and associated
modified variable bindings list.
7. SnmpSendMsg, inverting source and destination entity regarding what
has been received with SnmpRecvMsg.

Tracing snmp messages with ethereal I observed:
Management entity request is received with the following aspect:
User Datagram Protocol, Src Port: 1371 (1371), Dst Port: snmp
(161)
Source port: 1371 (1371)
Destination port: snmp (161)
Length: 49
Checksum: 0xd882 [correct]
Simple Network Management Protocol
Version: 2C (1)
Community: public
PDU type: GET (0)
Request Id: 0x0000283c
Error Status: NO ERROR (0)
Error Index: 0
Object identifier 1: 1.3.6.1.2.1.1.1.0 (SNMPv2-MIB::sysDescr.
0)
Value: NULL

My agent entity requesponse is sent with the following aspect:
User Datagram Protocol, Src Port: 1323 (1323), Dst Port: 1371
(1371)
Source port: 1323 (1323)
Destination port: 1371 (1371)
Length: 183
Checksum: 0x9d3d [correct]
Simple Network Management Protocol
Version: 1 (0)
Community: public
PDU type: RESPONSE (2)
Request Id: 0x0000283c
Error Status: NO ERROR (0)
Error Index: 0
Object identifier 1: 1.3.6.1.2.1.1.1.0 (SNMPv2-MIB::sysDescr.
0)
Value: STRING: Hardware: x86 Family 15 Model 6 Stepping 4 AT/
AT COMPATIBLE - Software: Windows 2000 Version 5.1 (Build 2600
Multiprocessor Free)

After investigation I've found what is the problem with PRTG. It
expects to receive a response containing a version set to "2C (1)" in
stead of that, my agent response contain a version set to "1 (0)".

I've tested the same procedure on the same computers with Windows SNMP
service started in stead of my own agent. Windows SNMP service resonse
contains the correct SNMP version (2C).

Every things in the above summarized code description is executed
without any error.
The translate mode is correctly set to SNMPAPI_UNTRANSLATED_V2. That
should ensure message to be sent with the version (2C).

So, what am I doing wrong ?
What's the solution to set SNMP response message version to "2C (1)"?

Thanks for reading,

Christophe Pietquin.
.



Relevant Pages

  • Re: Emulating a network elements SNMP activity
    ... To simulate a single SNMP entity you can use the SNMP Agent Simulator. ... It runs on Java 1.4 or later versions to simulate SNMP agents. ... You can load any SMI standard MIB files and simulate default values ...
    (comp.protocols.snmp)
  • Re: How to develop an SNMP agent from scratch?
    ... How to inform a new MIBto NMS? ... that comes with its own private mib and has a built-in SNMP agent ... What i mean is that a separate process is needed in all agent ...
    (comp.protocols.snmp)
  • Re: Snmp extension agent dll for generating v2c traps
    ... What i understood is these API's are used to interface to a 3rd party snmp ... My requirement is to use the Microsoft snmp.exe (snmp master agent) to ... will be sending the traps to the third party manager. ... extension agent Api's) to plug into this master agent. ...
    (microsoft.public.win32.programmer.networks)
  • Re: [Full-Disclosure] SNMP Broadcasts
    ... The portscans will continue for as long as the ... It's just running on a different port. ... are SNMP enabled. ... System Edge is an extensible SNMP agent similar in many ways to ...
    (Full-Disclosure)
  • Re: Snmp
    ... Paul T. ... which has a SNMP Agent. ... an SNMP manager, processes them and returns a result. ... support SNMP, although I'm not aware of any which support *only* SNMP. ...
    (microsoft.public.windowsce.app.development)