Menu

#4 vars registered with RegisterVar() should be unique

open
nobody
None
5
2012-04-18
2012-04-18
No

Normally, RegisterVars() does not just register the supplied value in python-agentx's "cache" (by setting self[oid]), it also maintains pointers "noid" (= "next OID") to support SNMP's GetNext operation correctly.

However in this scenario it fails:
RegisterVar("a", 0)
RegisterVar("b", 1) # up to here snmpwalk shows both variables
RegisterVar("a", 2) # up to here snmpwalk shows a only

This is because RegisterVar() always assumes that a new variable is registered. We don't get duplicate entries because the underlying dictionary data type enforces unique keys, yet the last call to RegisterVar() always sets "noid" to None, even when just updating previously registered values.

Attached patch fixes this by distinguishing whether a key already exists (= variable has been registered before) or not.

Discussion

  • Anonymous

    Anonymous - 2012-04-18

    Patch to make RegisterVars() register vars just once

     
  • Anonymous

    Anonymous - 2012-04-18
    • summary: vars registered with RegisterVars() should be unique --> vars registered with RegisterVar() should be unique
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.