On Sun, Feb 01, 2015 at 07:58:12PM +0530, Ashwini Pagade wrote: > Hi, > > I am using snmpV3 adapter and passing V2 traps to it by using commands as > below. It looks like the range for type *u* (i.e. unsigned) is upto (2^31) > - 1 (i.e. 2147483647). I was expecting it to be (2^32) - 1 (i.e. > 4294967295). > > snmptrap -c public -v 2c clm-pun-009642 '' 1.3.6.1.4.1.20006.1.0.5 > 1.3.6.1.4.1.12345.1 u 2147483647 > > Above command generates following log: > trace: ..\..\snmplib\snmp_api.c, 5293: > dumph_recv: Value > dumpx_recv: 42 04 7F FF FF FF > dumpv_recv: UInteger: 2147483647 (0x7FFFFFFF) > > > snmptrap -c public -v 2c clm-pun-009642 '' 1.3.6.1.4.1.20006.1.0.5 > 1.3.6.1.4.1.12345.1 u 2147483648 > > Above command generates following log: > trace: ..\..\snmplib\snmp_api.c, 5293: > dumph_recv: Value > dumpx_recv: 42 05 00 80 00 00 00 > dumpv_recv: UInteger: -2147483648 (0x80000000) > > Refer to: > http://www.net-snmp.org/docs/man/snmptrap.html > > I am using net-snmp v5.5. > > I think below line in function asn_parse_unsigned_int() in file asn1.c is > printing the incorrect value: > DEBUGMSG(("dumpv_recv", " UInteger:\t%ld (0x%.2lX)\n", value, value)); > > However I think it is not just the dump/log error and incorrect value is > propagated further down the line. I have an snmpV3 adapter which receives > the value. This adapter too gets the incorrect value.
I have now looked at the code and it seems to be a pure log error. In your dumps above you see that the values are 42 04 7F FF FF FF and 42 05 00 80 00 00 00 and those two are correct. > I am not sure how this could be fixed. Data type of 'value' looks correct > which is u_long. > > How could we fix this? Any pointers/help in fixing this? Changing %ld to %lu should do the trick. /MF ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders