[tkined] decoding Object Ids

From: Pete Flugstad (pete_flugstad@icon-labs.com)
Date: Thu Nov 15 2001 - 19:30:04 MET


I've got an agent that is sending out a trap with an
object identifier in it that like (among other things)
{ 6, 0 } or { 4, 0 }. I'm the developer so I can change
this (although the EMS people will yell at me :-/).

Now, the SNMP library (Envoy) I'm working with does not
seem to have any problem encoding or decoding this correctly.
And NET-SNMP seems to decode it OK as well.

However, scotty stumbles on it. I see it get decoded
like { 3, 9, 112 } and other garbage deocodings.

In looking at this, the raw PDU seems to encode this as

   0x6 0x2 0x81 0x70

Where 0x6 is the OBJECT ID tag, 0x2 is the length,
and 0x81 0x70 is the encoded value. Because the
high-bit is on here, this means the value get's
extended, and it get's combined with the next octet,
so you end up with 0xF0. Which is decimal 240, which
is (6 * 40) + 0, which is correct I think.

scotty's problem is in TnmBerDecOID. Before I spend
time trying to fix this (not terribly hard I think), I
expect that the { 6, 0 } or { 4, 0 } is not valid, since
only 0, 1, 2 are valid values from the root. I expect
because of the "special" way the first two OIDs get
encoded, there can be ambiguity in how to decode it.

However, this is a convienient way to encode an array
of integers (I could use OCTET STRING, but that brings
up endian issues), so I'd like to keep it. Any other
good way to encode a variable length array of integers?
I guess I would switch this to { 0, 6 } or some such,
but that doesn't solve the general problem.

Any suggestions/comments?

Thanks,
Pete

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.



This archive was generated by hypermail 2b29 : Thu Jan 03 2002 - 14:56:28 MET