Package: snmpd Version: 5.1.2-6.1 Severity: important Tags: patch
-- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.6-dwm-2004060702 Locale: LANG=C, LC_CTYPE=C Versions of packages snmpd depends on: ii libc6 2.3.2.ds1-21 GNU C Library: Shared libraries an ii libsensors3 1:2.9.1-1 library to read temperature/voltag ii libsnmp5 5.1.2-5 NET SNMP (Simple Network Managemen ii libwrap0 7.6.dbs-6 Wietse Venema's TCP wrappers libra -- no debconf information On an IA-64 (and believed to be other little endian 64 bit boxes), agentx protocol is broken. This was fixed just after 5.1.2 and there is a patch available on net-snmp.sf.net (included here). I'm not sure why this has never been reported against this package. It's fairly easy to reproduce: build net-snmp-5.1.2/agent/mibgroup/example/notification by doing the following: apt-get install snmpd dpkg-source -x net-snmp_5.1.2-6.1.dsc cd net-snmp-5.1.2/agent/mibgroup/examples net-snmp-config --compile-subagent notification notification.c #That will build the subagent sudo ./notification # Will start sending traps to /etc/snmp/snmpd.conf configured trap # destinations. You may want to add: trap2sink localhost public # to your /etc/snmp/snmpd.conf file and enable snmptrapd with TRAPDRUN=yes # in the /etc/default/snmpd configuration file. # Then traps should begin appearing in /var/log/syslog every 30 seconds # without the patch they do not, with the patch they do. # You can also pass the -Dagentx flag in the SNMPDOPTS line of # /etc/default/snmpd
--- agent/mibgroup/agentx/protocol.c.agentx-little64 2004-03-09 20:35:29.000000000 +0100 +++ agent/mibgroup/agentx/protocol.c 2004-07-23 11:41:55.189470590 +0200 @@ -1153,26 +1153,45 @@ } +#ifdef WORDS_BIGENDIAN +# define endianoff 1 +#else +# define endianoff 0 +#endif if (*length < 4 * n_subid) { DEBUGMSGTL(("agentx", "Incomplete Object ID")); return NULL; } if (prefix) { - if (sizeof(oid) == 8) { /* align OID values in 64 bit agent */ - int_ptr[0] = int_ptr[2] = int_ptr[4] = int_ptr[6] = int_ptr[8] = 0; + if (int_offset == 2) { /* align OID values in 64 bit agent */ + memset(int_ptr, 0, 10*sizeof(int_ptr[0])); + int_ptr[0+endianoff] = 1; + int_ptr[2+endianoff] = 3; + int_ptr[4+endianoff] = 6; + int_ptr[6+endianoff] = 1; + int_ptr[8+endianoff] = prefix; + } else { /* assume int_offset == 1 */ + int_ptr[0] = 1; + int_ptr[1] = 3; + int_ptr[2] = 6; + int_ptr[3] = 1; + int_ptr[4] = prefix; } - int_ptr[int_offset - 1] = 1; - int_ptr[(int_offset * 2) - 1] = 3; - int_ptr[(int_offset * 3) - 1] = 6; - int_ptr[(int_offset * 4) - 1] = 1; - int_ptr[(int_offset * 5) - 1] = prefix; int_ptr = int_ptr + (int_offset * 5); } for (i = 0; i < (int) (int_offset * n_subid); i = i + int_offset) { - int_ptr[i] = 0; - int_ptr[i + (int_offset - 1)] = agentx_parse_int(buf_ptr, network_byte_order); + int x; + + x = agentx_parse_int(buf_ptr, network_byte_order); + if (int_offset == 2) { + int_ptr[i+0] = 0; + int_ptr[i+1] = 0; + int_ptr[i+endianoff]=x; + } else { + int_ptr[i] = x; + } buf_ptr += 4; *length -= 4; }