Please help me track down a problem I am having with snmpd and subagent 
using ASN_OPAQUE_U64.  I am using net-snmp 5.7.2 on x86_64 Linux, Ubuntu 
12.04 LTS.  I know the OPAQUE types are not standard, but my application 
requires the use of both ASN_OPAQUE_U64 as well as ASN_OPAQUE_I64. 

I can see the problem by dumping packets from snmpd. 

Here is the case showing the problem with U64: 

snmpset -v2c -c public -- 192.168.8.120 1.3.6.1.4.1.99999.7.0 U 
1234736971425640191 

snmpd dump (note: 1234736971425640191 = 0x1122AABBCCDDEEFF): 

Received 56 byte packet from UDP: [192.168.8.121]:48828->[192.168.8.120]:161
0000: 30 36 02 01  01 04 06 70  75 62 6C 69  63 A3 29 02    06.....public.).
0016: 04 1F 1A D2  B8 02 01 00  02 01 00 30  1B 30 19 06    ...........0.0..
0032: 0A 2B 06 01  04 01 86 8D  1F 07 00 44  0B 9F 7B 08    .+.........D..{.
0048: 11 22 AA BB  CC DD EE FF                              ."...... 


Sending 64 bytes to Local IPC: abstract
0000: 01 08 00 00  05 00 00 00  01 00 00 00  02 00 00 00    ................
0016: 2C 00 00 00  44 00 00 00  04 04 00 00  01 00 00 00    ,...D...........
0032: 9F 86 01 00  07 00 00 00  00 00 00 00  10 00 00 00    ................
0048: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00    ................ 


Notice that the data sent on to the subagent over IPC is zeroed out.  I am 
not positive, but I believe the UDP data received as a result of the snmpset 
call looks correct, so it would appear snmpd has a problem forming the IPC 
packet for U64? 

I64 appears to be working properly, here is the same example but for I64: 

snmpset -v2c -c public -- 192.168.8.120 1.3.6.1.4.1.99999.7.0 I 
1234736971425640191 

snmpd dump: 

Received 56 byte packet from UDP: [192.168.8.121]:38133->[192.168.8.120]:161
0000: 30 36 02 01  01 04 06 70  75 62 6C 69  63 A3 29 02    06.....public.).
0016: 04 37 36 17  83 02 01 00  02 01 00 30  1B 30 19 06    .76........0.0..
0032: 0A 2B 06 01  04 01 86 8D  1F 07 00 44  0B 9F 7A 08    .+.........D..z.
0048: 11 22 AA BB  CC DD EE FF                              ."...... 


Sending 64 bytes to Local IPC: abstract
0000: 01 08 00 00  05 00 00 00  01 00 00 00  02 00 00 00    ................
0016: 2C 00 00 00  44 00 00 00  04 04 00 00  01 00 00 00    ,...D...........
0032: 9F 86 01 00  07 00 00 00  00 00 00 00  10 00 00 00    ................
0048: BB AA 22 11  00 00 00 00  FF EE DD CC  00 00 00 00    .."............. 

Here you see the data in the last line for I64 but it was zeroed out for 
U64. 

Any clues where to look to try to fix this problem in snmpd would be greatly 
appreciated. 

Also, I initially had a problem with I64 in that negative numbers appeared 
to cause things to lock up.  I was able to resolve this problem by changing 
one line of code in snmplib/asn1.c: 

# diff -uN asn1.c.orig asn1.c
 --- asn1.c.orig 2013-09-24 16:29:11.952183597 +0000
+++ asn1.c      2013-09-24 16:29:18.424037373 +0000
@@ -3499,7 +3499,7 @@
    /*
     * Then the high byte if present.
     */
 -    if (high != testvalue) {
+    if ((int)high != testvalue) {
        /*
         * Do the rest of the low byte.
         */ 

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to