[quagga-dev 10942] ripd zebrad causes "truncating integer value > 32 bits" snmp error on 64-bit systems

Ilja Ryndin ilja.ryndin at gmail.com
Wed Dec 4 07:44:11 GMT 2013


Hello,

Some time ago I found the following messages in syslog:
Dec  3 17:27:26 host zebra[4622]: snmp[err]: truncating integer value > 32
bits
Dec  3 17:27:26 host ripd[4626]: snmp[err]: truncating integer value > 32
bits

After that I explored quagga source code and found out the possible reason.
I guess the
problem is similar to
http://lists.quagga.net/pipermail/quagga-dev/2006-September/004415.html.

In file ./quagga/ripd/ripd_snmp.c used type 'long' which size is 8 bytes on
64-bit systems. But these values are described as ASN_INTEGER (snmp expects
4 bytes). On 32-bit systems everything works fine, but on 64-bit snmp
generates errors described above.

snippet:

static u_char *
rip2IfConfAddress (struct variable *v, oid name[], size_t *length,
           int exact, size_t *val_len, WriteMethod **write_method)
{
...

    case RIP2IFCONFSEND:
      config = rip2IfConfSend (ri);
      *val_len = sizeof (long); // *** should be int32_t
      v->type = ASN_INTEGER;
      return (u_char *) &config;
    case RIP2IFCONFRECEIVE:
      config = rip2IfConfReceive (ri);
      *val_len = sizeof (long); // *** should be int32_t
      v->type = ASN_INTEGER;
      return (u_char *) &config;
...
}

Another possible mistake found in ./quagga/ripd/zebra_snmp.c in functions:
static u_char *
ipCidrNumber (struct variable *v, oid objid[], size_t *objid_len,
      int exact, size_t *val_len, WriteMethod **write_method)

and

static u_char *
ipFwNumber (struct variable *v, oid objid[], size_t *objid_len,
    int exact, size_t *val_len, WriteMethod **write_method)

I guess that here is missing the value size assignment:
*val_len = sizeof (int32_t);

Without this fix it looks like snmp generates fuzzy errors.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20131204/8e2c5ad9/attachment-0001.html>


More information about the Quagga-dev mailing list