Invalid IP Address Issue
Opened this issue · 1 comments
Hey all, I am pretty much useless in Ruby, but got this issue when running this on a pretty large Cisco network:
Traceback (most recent call last):
24: from /usr/local/bin/netcrawl:23:in `<main>'
23: from /usr/local/bin/netcrawl:23:in `load'
22: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/bin/netcrawl:5:in `<top (required)>'
21: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/cli.rb:10:in `run'
20: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
19: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `recurse'
18: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `each'
17: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:33:in `block in recurse'
16: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
15: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `recurse'
14: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `each'
13: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:33:in `block in recurse'
12: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
11: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:28:in `recurse'
10: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `get'
9: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `each'
8: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:19:in `block in get'
7: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:10:in `peers'
6: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:15:in `poll'
5: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `make_peers'
4: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `each'
3: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:21:in `block in make_peers'
2: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `as_ip'
1: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `new'
/Library/Ruby/Gems/2.6.0/gems/snmp-1.3.2/lib/snmp/varbind.rb:293:in `initialize': Expected 4 octets or formatted string, got "" (SNMP::InvalidIpAddress)
Any ideas?
I'd like to ask, what have you tried so far?
What springs to my mind, is to check what is happening in code in the lines mentioned. For example, cdp.rb#21:
peer.raw_ip = @mib[OID[:cdpCacheAddress], peer_id].as_ip
and snmp.rb#132:
SNMP::IpAddress.new(value).to_s
We can determine that call to the #as_ip
method is getting empty string as value, while it expected to see 4 octets.
Now perhaps we start asking some questions, which node were we polling, what data did it receive?
My stab in the dark is, some node returned unpopulated field where we expected IP address to be, and the code didn't anticipate that.
You can either fix this yourself, by first answering to some of those questions to yourself and then figuring out if you can find the needed IP in some other way or if you just have to guard against trying in that scenario. I'm also happy to do that, but for that I'd need access to your network to reproduce the problem so I can troubleshoot it, I'd come from 91.198.120.1
you can send auth to saku@ytti.fi
.