Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash on ipv6 adresses #5

Open
olanystrom opened this issue Mar 9, 2020 · 1 comment
Open

crash on ipv6 adresses #5

olanystrom opened this issue Mar 9, 2020 · 1 comment

Comments

@olanystrom
Copy link

I dont know if the error is in netcrawl or ruby-snmp.
But if you get a CDP Neigbour with ipv6 adress you get an error.

# netcrawl -d -a 10.123.3.1
Expected four octets separated by dots, not "\xFE\x80\x00\x00\x00\x00\x00\x00\x06\xEB@\xFF\xFE\xD9\xDC\x05"
/usr/local/share/gems/gems/snmp-1.3.2/lib/snmp/varbind.rb:345:in `parse_string': Expected four octets separated by dots, not "\xFE\x80\x00\x00\x00\x00\x00\x00\x06\xEB@\xFF\xFE\xD9\xDC\x05" (SNMP::InvalidIpAddress)
        from /usr/local/share/gems/gems/snmp-1.3.2/lib/snmp/varbind.rb:291:in `initialize'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `new'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `as_ip'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:21:in `block in make_peers'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `each'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `make_peers'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:15:in `poll'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:10:in `peers'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:19:in `block in get'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `each'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `get'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:28:in `recurse'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/cli.rb:10:in `run'
        from /usr/local/share/gems/gems/netcrawl-0.1.0/bin/netcrawl:5:in `<top (required)>'
        from /usr/local/bin/netcrawl:23:in `load'
        from /usr/local/bin/netcrawl:23:in `<main>'

The SNMP output from snmpwalk of the relevant part is

SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10101.2 = Hex-STRING: 0A 7B 03 02
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10102.3 = Hex-STRING: AC 1A 19 22
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10110.1 = Hex-STRING: FE 80 00 00 00 00 00 00 06 EB 40 FF FE D9 DC 05
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10117.4 = Hex-STRING: 0A 7B 03 06
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10121.5 = Hex-STRING: 0A 7B 03 04

@ytti
Copy link
Owner

ytti commented Mar 9, 2020

https://github.com/ytti/netcrawl/blob/master/lib/netcrawl/snmp.rb#L131-L133

This would have to detect if value is v4 or v6 and return correct object. Detection could be simple as value.size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants