[quagga-dev 4414] Re: more 64 bit issues in smux

Andrew J. Schorr aschorr at telemetry-investments.com
Wed Sep 27 17:37:37 BST 2006

On Wed, Sep 27, 2006 at 04:53:43PM +0200, Pierre-Yves Ritschard wrote:
> Ok the problem comes from libsnmp as it would seem, the function
> smux_parse which is called through the FindVarMethod function pointer in
> smux_get (which is itself called from smux_trap).
> Anyhow sometimes this functions which is supposed to return a value, a
> type and a length for this value returns a length of 4 for ASN_INTEGERS
> (which as they are longs in the snmp sense should be 8).

Hmmm, I think the FindVarMethod functions are defined inside quagga.
For example, in lib/smux.c:smux_get, we have:

                  *val = (*v->findVar) (v, suffix, &suffix_len, exact,
                                        val_len, &write_method);

But what is "v"?  It is defined above:

                 v = &subtree->variables[j];

And what is subtree?  It comes from walking the treelist:

  struct subtree *subtree;
  for (ALL_LIST_ELEMENTS (treelist, node, nnode,subtree))

And where does the treelist come from?  It is populated with calls
to lib/smux.c:smux_register_mib (through the REGISTER_MIB macro
in lib/smux.h).  So if you now search for REGISTER_MIB in the
codebase, you'll see:

./bgpd/bgp_snmp.c:873:  REGISTER_MIB("mibII/bgp", bgp_variables, variable, bgp_oid);
./ospf6d/ospf6_snmp.c:526:  REGISTER_MIB ("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid);
./ospfd/ospf_snmp.c:2635:  REGISTER_MIB("mibII/ospf", ospf_variables, variable, ospf_oid);
./ripd/rip_snmp.c:579:  REGISTER_MIB("mibII/rip", rip_variables, variable, rip_oid);
./zebra/zebra_snmp.c:566:  REGISTER_MIB("mibII/ipforward", zebra_variables, variable, ipfw_oid);

And if you look at that source code, you will see where the findVar
functions are defined (4th field of struct variable).  And if you look
in those functions, it seems (based on your bug report) that you may
find bugs that need to be fixed...


More information about the Quagga-dev mailing list