From: SourceForge.net <no...@so...> - 2005-12-06 16:54:06
|
Bugs item #1370856, was opened at 2005-12-01 08:19 Message generated for change (Comment added) made by rstory You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1370856&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: agent >Group: 64-bit >Status: Closed Resolution: Fixed >Priority: 5 Submitted By: c_gebauer (c_gebauer) >Assigned to: Robert Story (rstory) Summary: ip address encoding is broken 64Bit Initial Comment: Hi, I have problems using net-snmp 5.2.1.2 on HP-UX 11.0/11i in 64 Bit mode. (I need to link libnetsnmp with my 64 Bit applications. We currently have development environments for HP-UX 11.0 and 11i) Because I found no 64 Bit binaries for net-snmp I tried to compile net-snmp using aCC (version A.03.55 on HP-UX 11.0 and version A.03.65 on HP-UX 11i). I used the following configure options: --------------------------------------------------------------------------------------------------- ./configure --prefix=/home/gebauer/snmp/install64 --with-cc=aCC --with-ar=ar --with-cflags="-D_THREAD_SAFE -D_REENTRANT -DSS_64BIT_SERVER -DRW_MULTI_THREAD +DA2.0w +DChpux -D_LARGEFILE64_SOURCE" --with-ldflags="+DA2.0w" --with-sys-location=Unknown --disable-developer --with-libs=-lnm --with-sys-contact="System Administrator" --with-defaults --with-mib-modules="host disman/event-mib smux" --------------------------------------------------------------------------------------------------- Both configure and make report some warnings, but all seems to build well. But when I try to run my applications or use the command line utilities of net-snmp I run into some trouble. I have to update the ipRouteTable in an bintec X8500 router. snmpwalk/snmpget works on this table, but it's impossible to add a new entry with snmpset: --------------------------------------------------------------------------------------------------- [gebauer@elfi][/home/gebauer/snmp/install64/bin]>./snmpset -v 1 -c bintec 172.16.0.2 .1.3.6.1.2.1.4.21.1.1 a 172.16.0.0 .1.3.6.1.2.1.4.21.1.2 i 100 .1.3.6.1.2.1.4.21.1.7 a 172.16.1.1 .1.3.6.1.2.1.4.21.1.8 i 3 .1.3.6.1.2.1.4.21.1.11 a 255.255.0.0 Error in packet. Reason: (badValue) The value given has the wrong type or length. Failed object: RFC1213-MIB::ipRouteDest --------------------------------------------------------------------------------------------------- The badValue error is reported by the router, as it is also logged in the router console. If I remove the "+DA2.0w" flag from the configure options and build a 32-Bit version of the libraries and utilities, the same snmpset commando works fine. In order to analyse the problem I dumped the snmp-PDUs sent by snmpset via the "-d" option and analysed them with ethereal. Analysis of the package sent by the 32-Bit version: --------------------------------------------------------------------------------------------------- Simple Network Management Protocol Version: 1 (0) Community: bintec PDU type: SET (3) Request Id: 0x12d2a9ea Error Status: NO ERROR (0) Error Index: 0 Object identifier 1: 1.3.6.1.2.1.4.21.1.1 (iso.3.6.1.2.1.4.21.1.1) Value: IpAddress: 172.16.0.0 Object identifier 2: 1.3.6.1.2.1.4.21.1.2 (iso.3.6.1.2.1.4.21.1.2) Value: INTEGER: 100 Object identifier 3: 1.3.6.1.2.1.4.21.1.7 (iso.3.6.1.2.1.4.21.1.7) Value: IpAddress: 172.16.1.1 Object identifier 4: 1.3.6.1.2.1.4.21.1.8 (iso.3.6.1.2.1.4.21.1.8) Value: INTEGER: 3 Object identifier 5: 1.3.6.1.2.1.4.21.1.11 (iso.3.6.1.2.1.4.21.1.11) Value: IpAddress: 255.255.0.0 0000 02 02 02 02 02 02 01 01 01 01 01 01 08 00 45 00 ..............E. 0010 00 9e 12 34 00 00 ff 06 a3 20 01 01 01 01 02 02 ...4..... ...... 0020 02 02 00 64 00 c8 00 00 00 00 00 00 00 00 50 00 ...d..........P. 0030 20 00 d4 c2 00 00 30 74 02 01 00 04 06 62 69 6e .....0t.....bin 0040 74 65 63 a3 67 02 04 12 d2 a9 ea 02 01 00 02 01 tec.g........... 0050 00 30 59 30 11 06 09 2b 06 01 02 01 04 15 01 01 .0Y0...+........ 0060 40 04 ac 10 00 00 30 0e 06 09 2b 06 01 02 01 04 @.....0...+..... 0070 15 01 02 02 01 64 30 11 06 09 2b 06 01 02 01 04 .....d0...+..... 0080 15 01 07 40 04 ac 10 01 01 30 0e 06 09 2b 06 01 ...@.....0...+.. 0090 02 01 04 15 01 08 02 01 03 30 11 06 09 2b 06 01 .........0...+.. 00a0 02 01 04 15 01 0b 40 04 ff ff 00 00 ......@..... --------------------------------------------------------------------------------------------------- Analysis of the package sent by the 64-Bit version: --------------------------------------------------------------------------------------------------- Simple Network Management Protocol Version: 1 (0) Community: bintec PDU type: SET (3) Request Id: 0x416d81db Error Status: NO ERROR (0) Error Index: 0 Object identifier 1: 1.3.6.1.2.1.4.21.1.1 (iso.3.6.1.2.1.4.21.1.1) Value: Length is 8, should be 4 Object identifier 2: 1.3.6.1.2.1.4.21.1.2 (iso.3.6.1.2.1.4.21.1.2) Value: INTEGER: 100 Object identifier 3: 1.3.6.1.2.1.4.21.1.7 (iso.3.6.1.2.1.4.21.1.7) Value: Length is 8, should be 4 Object identifier 4: 1.3.6.1.2.1.4.21.1.8 (iso.3.6.1.2.1.4.21.1.8) Value: INTEGER: 3 Object identifier 5: 1.3.6.1.2.1.4.21.1.11 (iso.3.6.1.2.1.4.21.1.11) Value: Length is 8, should be 4 0000 02 02 02 02 02 02 01 01 01 01 01 01 08 00 45 00 ..............E. 0010 00 ab 12 34 00 00 ff 06 a3 13 01 01 01 01 02 02 ...4............ 0020 02 02 00 64 00 c8 00 00 00 00 00 00 00 00 50 00 ...d..........P. 0030 20 00 be 7b 00 00 30 81 80 02 01 00 04 06 62 69 ..{..0.......bi 0040 6e 74 65 63 a3 73 02 04 41 6d 81 db 02 01 00 02 ntec.s..Am...... 0050 01 00 30 65 30 15 06 09 2b 06 01 02 01 04 15 01 ..0e0...+....... 0060 01 40 08 00 00 00 00 ac 10 00 00 30 0e 06 09 2b .@.........0...+ 0070 06 01 02 01 04 15 01 02 02 01 64 30 15 06 09 2b ..........d0...+ 0080 06 01 02 01 04 15 01 07 40 08 00 00 00 00 ac 10 ........@....... 0090 01 01 30 0e 06 09 2b 06 01 02 01 04 15 01 08 02 ..0...+......... 00a0 01 03 30 15 06 09 2b 06 01 02 01 04 15 01 0b 40 ..0...+........@ 00b0 08 00 00 00 00 ff ff 00 00 ......... --------------------------------------------------------------------------------------------------- Judging from the ethereal output I think that the 64-Bit build doesn't encode the ip-address values correctly (it sends a 64-Bit value, the router and ethereal expects 32-Bit). I get the same behaviour with the versions 5.2.2.rc6 and 5.3.pre4 of net-snmp. Thanks, Christian ---------------------------------------------------------------------- >Comment By: Robert Story (rstory) Date: 2005-12-06 11:54 Message: Logged In: YES user_id=76148 checked in to 5-2-patches (for 5.2.3), which fixes the snmpset. But there are still lots of places that the agent returns 8 byte ip addresses in 5.1.x... I'm willing to say that 5.2.x is recommended for 64bit, so I'm closing this.. ---------------------------------------------------------------------- Comment By: c_gebauer (c_gebauer) Date: 2005-12-05 02:18 Message: Logged In: YES user_id=1394134 Hi, I have one comment regarding your patch: - ltmp = inet_addr(value); + atmp = inet_addr(value); if (ltmp != (long) -1 || !strcmp(value, "255.255.255.255")) snmp_pdu_add_variable(pdu, name, name_length, ASN_IPADDRESS, - (u_char *) & ltmp, sizeof(long)); + (u_char *) & atmp, sizeof(atmp)); You should replace ltmp with atmp in the if-condition because it contains the return value of inet_addr. Thanks, Christian ---------------------------------------------------------------------- Comment By: Robert Story (rstory) Date: 2005-12-02 17:10 Message: Logged In: YES user_id=76148 Thanks for the bug report and patch. I fixed it a slightly different way; see attached patch. This has been applied for 5.3.pre5, and I will check it in to 5-2-patches for 5.2.3 as soon as the code freeze is lifted. ---------------------------------------------------------------------- Comment By: c_gebauer (c_gebauer) Date: 2005-12-01 13:41 Message: Logged In: YES user_id=1394134 Hi, I prepared and attached a patch that solves the problem for my environment (both for 32- and 64-Build). A short explanation: snmp_api.c, snmp_add_var(): according to http://devresource.hp.com/drc/STK/docs/archive/relnotes_1100.jsp inet_addr always returns a 32-Bit value on HP-UX, so its probably not a good idea to treat the return value as long, because sizeof(long)==8 for HP-UX/64-Bit snmp_client.c, snmp_set_var_value(): here the length is always set to sizeof(long), which is to wrong, at least in my case (ASN_IPADDRESS, 64-Bit) Please review/evaluate the patch! Thanks, Christian ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1370856&group_id=12694 |