Quantcast
Channel: C# Based Open Source SNMP Library for .NET and Mono
Viewing all articles
Browse latest Browse all 576

Commented Issue: Messenger.[Get] return incorrect value [7256]

$
0
0
Using sample application "snmpget" to retrieve the cdpCacheAddress (1.3.6.1.4.1.9.9.23.1.2.1.1.4), the return result is not correct. The return type is CiscoNetworkAddress which is OctetString and in my test case it is 4 octets IP address. The test on two Cisco devices always returned the same results in the first three octets. The last octets appears to match the 4th octet of the device's IP address.

For example:
using the snmpget sample application with the following command line argument:
-v=2 -c=public 192.168.254.11 .1.3.6.1.4.1.9.9.23.1.2.1.1.4.10003.1
The output received was as follow:
Variable: Id: .1.3.6.1.4.1.9.9.23.1.2.1.1.4.10003.1; Data: ???
convert the Data to string: 63.63.63.11

using the snmpget sample application with the following command line argument:
-v=2 -c=public 192.168.254.12 .1.3.6.1.4.1.9.9.23.1.2.1.1.4.8.2
The output received was as follow:
Variable: Id: .1.3.6.1.4.1.9.9.23.1.2.1.1.4.8.2; Data: ???
convert the Data to string: 63.63.63.12

The code snippet from sample application snmpget:
For Each variable As Variable In Messenger.[Get](version, receiver, New OctetString(community), vList, timeout)
Console.WriteLine(variable)
Next

I tried converting the returned result in different way, but I suspect the result from the call to Messenger.[Get] was wrong to begin with.

Information on cdpCacheAddress:
http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?objectInput=.1.3.6.1.4.1.9.9.23.1.2.1.1.4.&translate=Translate&submitValue=SUBMIT&submitClicked=true
Comments: I have attached two captures, one from each devices. The data returned from the devices are as follow OctetString: c0a8fe0c from 192.168.254.11 (which corresponds to the correct cdp neighbor) OctetString: c0a8fe0b from 192.168.254.12 The data returned from the devices as seen on the wire are correct. However, I could not get the same value from teh Messenger.[Get] The code I used for converting the retrieved "variable" iss follow: Dim memStream As New MemoryStream(4) 'memStream.Write(Encoding.Default.GetBytes(variable.Data.ToString), 0, 4) memStream.Write(Encoding.ASCII.GetBytes(variable.Data.ToString), 0, 4) memStream.Seek(0, SeekOrigin.Begin) Dim binReader As New BinaryReader(memStream) Dim testArray As Byte() = {0, 0, 0, 0} Dim count As Integer = binReader.Read(testArray, 0, 4) Console.WriteLine(testArray(0).ToString & _ "." & testArray(1).ToString & _ "." & testArray(2).ToString & _ "." & testArray(3).ToString) I have tried diferent encoding scheme including ASCII, Unicode, UTF7, UTF8. The converted value does not corresponding to the captured result. Thanks for looking into this matter.

Viewing all articles
Browse latest Browse all 576

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>