On 03/02/2008, Chun Tian (binghe) <[EMAIL PROTECTED]> wrote:
> It seems that Net-SNMP has a fixed msgMaxSize in SNMPv3 message, which is
> 65507. I found this value is BER-encoded to:
>
>  0x02 (type: integer), 0x03 (length: 3), 0x00, 0xff, 0xe3 (0xffe3 = 65507)

Nope.    BER encoding doesn't work like that.
The value being encoded is actually 16355
(assuming I've done the calculations correctly).


> What I don't know is why this value must be encoded to a 3-bytes integer,
> not 2-bytes, just like this:
>
>  0x02, 0x02, 0xff, 0xe3

Because the BER encoding does *not* use 8-bit values.
It uses 7-bit values plus a continuation bit.
The top-most bit of the first octet of an integer value must
*ALWAYS* be 0.



> I'm writing a pure Common Lisp SNMP client package [1], when I encode
> msgMaxSize to 3 bytes, as Net-SNMP's own client does, it's all right; When I
> encode msgMaxSize to 2 bytes, SNMPd will not response.
>
> Why?

Because you are encoding it wrong.
Please re-read the BER encoding specs.
You cannot assume that this encoding works in the "obvious" way.
You *MUST* read the specs before starting work on something like this.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to