Row creation in snmpTargetAddrTable fails in 64-bit version

Bug #587828 reported by Ulrik Forsgren
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Net-SNMP
Unknown
Unknown
net-snmp (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

When trying to create a row in the snmpTargetAddrTable in a 64-bit system the attempt fails with this error:

ddskufo@ddskufo-laptop:~/Skrivbord/SNMP RFC'er/snmpV2$ snmptable localhost snmpTargetAddrTable
SNMP-TARGET-MIB::snmpTargetAddrTable: No entries
ddskufo@ddskufo-laptop:~/Skrivbord/SNMP RFC'er/snmpV2$ snmpset localhost snmpTargetAddrRowStatus."'ulrik'" i 5
Error in packet.
Reason: wrongLength (The set value has an illegal length from what the agent expects)
Failed object: SNMP-TARGET-MIB::snmpTargetAddrRowStatus.'ulrik'

The error is located to this piece of code on row 1504 in net-snmp/agent/mibgroup/target/snmpTargetAddrEntry.c:

        if (var_val_len != sizeof(int)) {
            DEBUGMSGTL(("snmpTargetAddrEntry",
                        "write to snmpTargetAddrRowStatus: bad length\n"));
            char s[128];
            sprintf(&s, "int length %d != %d\n", sizeof(int), var_val_len);
            DEBUGMSGTL(("snmpTargetAddrEntry", s));
            return SNMP_ERR_WRONGLENGTH;
        }

var_val_len is reported as 4
sizeof(int) in a 64-bit system

And 4 != 8, which means SNMP_ERR_WRONGLENGTH will be returned.

In the case sizeof(int) should be replaced with 4 and the if statement should look like:
if (var_val_len != 4) {

It would be suitable for both 32-bit and 64-bit systems.

Package information:

Package: snmpd
Priority: optional
Section: net
Installed-Size: 1228
Maintainer: Ubuntu Core Developers <email address hidden>
Original-Maintainer: Net-SNMP Packaging Team <email address hidden>
Architecture: amd64
Source: net-snmp
Version: 5.4.2.1~dfsg0ubuntu1-0ubuntu2
Replaces: snmptraplogd
Depends: libc6 (>= 2.4), libsnmp15 (>= 5.4.2.1~dfsg), libwrap0 (>= 7.6-4~), debconf (>= 0.5) | debconf-2.0, adduser, debconf, lsb-base (>= 3.2-13)
Conflicts: snmp (<< 3.6-3), snmptraplogd
Filename: pool/main/n/net-snmp/snmpd_5.4.2.1~dfsg0ubuntu1-0ubuntu2_amd64.deb
Size: 953054
MD5sum: 003d4e890109109fe632e31545ca6a9c
SHA1: 67805e1406c9ce59922c573e8dab15128a21172a
SHA256: 1b923d0809e7b1c85a67226afcb38f53972eb8d3ec5310755179f5ef6688ef54
Description: SNMP (Simple Network Management Protocol) agents
 The Simple Network Management Protocol (SNMP) provides a framework
 for the exchange of management information between agents (servers)
 and clients.
 .
 The Net-SNMP agent is a daemon which listens for incoming SNMP
 requests from clients and provides responses.
Homepage: http://net-snmp.sourceforge.net/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y

Revision history for this message
Ulrik Forsgren (ulrik-forsgren) wrote :

A corretion to data sizes above, the should be the otherway around.

var_val_len is reported as 8
sizeof(int) is 4 in a 64-bit system

And 8 != 4, which means SNMP_ERR_WRONGLENGTH will be returned.

In the case sizeof(int) should be replaced with 4 and the if statement should look like:
if (var_val_len != 8) {

or possibly

if (var_val_len != sizeof(long)) {

This has been reported earlier for net-snmp:
http://sourceforge.net/tracker/index.php?func=detail&aid=2972579&group_id=12694&atid=112694

Chuck Short (zulcss)
Changed in net-snmp (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package net-snmp - 5.4.3~dfsg-1ubuntu3

---------------
net-snmp (5.4.3~dfsg-1ubuntu3) maverick; urgency=low

  * debian/patches/ubuntu-fix-lp-587828.patch: Fix row creation for 64bit arches.
    (LP: #587828)
 -- Chuck Short <email address hidden> Wed, 25 Aug 2010 10:18:45 -0400

Changed in net-snmp (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.