Giter VIP home page Giter VIP logo

pynetsnmp's People

Contributors

achow-zenoss avatar cluther avatar epowell avatar iancmcc avatar isphost avatar itshane avatar jameshilliard avatar jhuie-zenoss avatar jpeacock-zenoss avatar jplouis avatar jscausey avatar kalombos avatar lunkwill42 avatar romanbakaleyko avatar sigmunau avatar sockterrier avatar white-hat avatar wwwtyro avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

sigmunau

pynetsnmp's Issues

IPv6 support is broken

IPv6 support was broken in 4372e67 by bypassing most of the _getCmdLineArgs(), which would properly format an agent address regardless of IP version.

When supplying an address like fe80:1::42 to an AgentProxy, the resulting destination address becomes fe80:1::42:161, because of the way peername is naively constructed by this line of code:

peername= '%s:%d' % (self.ip, self.port),

Incidentally, it appears that NET-SNMP 5.7 (and potentially 5.8) are correctly able to figure out that the :161 in the peername is actually a port number, and not a part of the address. But under NET-SNMP 5.9 it definitely breaks down into sending packets to incorrect destination addresses (as verified using WireShark).

The already existing function _get_agent_spec() does the proper formatting of the agent address here, and was utilized by the part of _getCmdLineArgs() that has now been disabled:

def _get_agent_spec(ipobj, interface, port):
"""take a google ipaddr object and port number and produce a net-snmp
agent specification (see the snmpcmd manpage)"""
if ipobj.version == 4:
agent = "udp:%s:%s" % (ipobj.compressed, port)
elif ipobj.version == 6:
if ipobj.is_link_local:
if interface is None:
raise RuntimeError("Cannot create agent specification from link local IPv6 address without an interface")
else:
agent = "udp6:[%s%%%s]:%s" % (ipobj.compressed, interface, port)
else:
agent = "udp6:[%s]:%s" % (ipobj.compressed, port)
else:
raise RuntimeError("Cannot create agent specification for IP address version: %s" % ipobj.version)
return agent

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.