[AGENT++] error on manage when receiving atrap notfication withafinite number of variable bindings

Karthik Venkataraman karthikv at netnumber.com
Mon Sep 10 19:13:50 CEST 2007


Hi Jochen,

Sorry for the late reply. I just came back from a week-long vacation. I
added the debugging statements that you've mentioned in the email below, and
this is what I see in the manager console now:

20070910.13:08:12: 24797: (1)DEBUG  : ++ SNMP++: data received from
10.100.100.9
4/1071.
20070910.13:08:12: 24797: (3)DEBUG  : 30 81 EA 02  01 01 04 06  70 75 62 6C
69
63 A7 81
20070910.13:08:12: 24797: (3)DEBUG  : DC 02 02 11  36 02 01 00  02 01 00 30
81
CF 30 0D
20070910.13:08:12: 24797: (3)DEBUG  : 06 08 2B 06  01 02 01 01  03 00 43 01
69
30 1D 06
20070910.13:08:12: 24797: (3)DEBUG  : 0A 2B 06 01  06 03 01 01  04 01 00 06
0F
2B 06 01
20070910.13:08:12: 24797: (3)DEBUG  : 04 01 81 8B  40 01 01 04  01 04 05 00
30
14 06 0E
20070910.13:08:12: 24797: (3)DEBUG  : 2B 06 01 04  01 81 8B 40  01 01 04 01
03
14 02 02
20070910.13:08:12: 24797: (3)DEBUG  : 17 74 30 29  06 0E 2B 06  01 04 01 81
8B
40 01 01
20070910.13:08:12: 24797: (3)DEBUG  : 04 01 03 15  04 17 32 30  30 37 3A 30
38
3A 32 39
20070910.13:08:12: 24797: (3)DEBUG  : 3A 31 32 3A  32 38 3A 31  30 3A 45 44
54
30 3F 06
20070910.13:08:12: 24797: (3)DEBUG  : 0E 2B 06 01  04 01 81 8B  40 01 01 04
01
03 16 04
20070910.13:08:12: 24797: (3)DEBUG  : 2D 4E 75 6D  62 65 72 20  6F 66 20 4C
69
73 74 65
20070910.13:08:12: 24797: (3)DEBUG  : 6E 65 72 20  74 68 72 65  61 64 73 20
3E
20 74 68
20070910.13:08:12: 24797: (3)DEBUG  : 72 65 61 64  20 74 68 72  65 73 68 6F
6C
64 30 1D
20070910.13:08:12: 24797: (3)DEBUG  : 06 0E 2B 06  01 04 01 81  8B 40 01 01
04
01 03 17
20070910.13:08:12: 24797: (3)DEBUG  : 04 0B 52 65  70 6C 69 63  61 74 69 6F
6E

20070910.13:08:12: 24797: (1)DEBUG  : parse length network ea lb 1
20070910.13:08:12: 24797: (1)DEBUG  : parse length host ea000000
20070910.13:08:12: 24797: (1)DEBUG  : sizeof(long) 8
20070910.13:08:12: 24797: (1)DEBUG  : parse length shifted 0
asn_length = 1
bufp - data = 2
*datalength = 0
20070910.13:08:12: 24797: (1)DEBUG  : ASN parse error (overflow of message)

20070910.13:08:12: 24797: (1)WARNING: Testing for v3 message: Bad parse of
version

Please let me know how this can be fixed so that I can print the received
trap on my snmp manager in a human-readable form. Thanks a lot for your
time.

Regards,
Karthik

-----Original Message-----
From: Jochen Katz [mailto:katz at agentpp.com] 
Sent: Sunday, September 02, 2007 2:59 PM
To: Karthik Venkataraman
Cc: agentpp at agentpp.org
Subject: Re: [AGENT++] error on manage when receiving atrap notfication
withafinite number of variable bindings

Hi Karthik,

> I am using RedHat ES 4 Update 4/ AMD64 system. I am building only a 32-bit
> library.

I would have thought, that snmp++ does not have any problems on such a
system...

> *datalength = 0

This is the cause of the problem. Within v3MP::is_v3_msg() the call to
asn_parse_header() sets the length to 0, and this triggers the error
messages you see.

Within asn_parse_header() nothing related to 32/64 bit happens, but it
calls asn_parse_length() and there is a 64 bit #ifdef for Alpha platform.

If you change the function like shown below, and send me the output I
might see what's going wrong.

Regards,
  Jochen

@@ -544,14 +544,20 @@
     }
     // fixed
     memcpy((char *)length, (char *)data + 1, (int)lengthbyte);
+    debugprintf(0, "parse length network %lx lb %d",
+               *length,(int)lengthbyte );
     *length = ntohl(*length);
+    debugprintf(0, "parse length host %lx", *length);
     // ntohl even on ALPHA (DEC/COMPAQ) 64bit platforms works on 32bit int,
     // whereas long is 64bit - therefore:
 #ifdef __osf__
+    debugprintf(0, "sizeof(int) %d", sizeof(int));
     *length >>= (8 * ((sizeof(int)) - lengthbyte));
 #else
+    debugprintf(0, "sizeof(long) %d", sizeof(long));
     *length >>= (8 * ((sizeof(long)) - lengthbyte));
 #endif
+    debugprintf(0, "parse length shifted %ld", *length);
     // check for length greater than 2^31
     if (*length > 0x80000000ul) {
       ASNERROR("SNMP does not support data lengths > 2^31");





More information about the AGENTPP mailing list