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

Jochen Katz katz at agentpp.com
Sun Sep 2 20:58:43 CEST 2007


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