SNMP version in agent response message
- From: cpietquin@xxxxxxxxxxxxxxxxxxxx
- Date: Fri, 21 Dec 2007 08:55:01 -0800 (PST)
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.
.
- Prev by Date: Finding all ports available in computer including both serial and parallel port in C#
- Next by Date: Re: How to get Cisco Bridge MIB information using snmp v3
- Previous by thread: Finding all ports available in computer including both serial and parallel port in C#
- Next by thread: BER DECODE/ENCODE FUNCTIONS
- Index(es):
Relevant Pages
|