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

Fix port resource for invalid IP address in netstat output #1603

Merged
merged 1 commit into from
Mar 29, 2017

Conversation

adamleff
Copy link
Contributor

Netstat will sometimes output an IPv6 address that is not
formatted correctly; the address is either truncated or uses
or implies the :: shorthand notation twice. This yields an
invalid IPv6 address and causes IPAddr.new to choke.

This change guards against invalid IP addresses and ensures they
do not end up in the port resource's entries list.

Fixes #1602

@lamont-granquist
Copy link
Contributor

is the more root cause of the issue here that netstat is outputting a fixed-width field that it has to truncate long ipv6 addresses, and either you need to go digging for an option to make it output the full field, or else should really hit the /proc filesystem directly to pull out information?

@adamleff
Copy link
Contributor Author

@lamont-granquist yeah, I really want to rewrite this resource because of the issues you mentioned. I was unable to get it to display the full address, but I at least wanted to unblock you and any others running into this issue.

Netstat will sometimes output an IPv6 address that is not
formatted correctly; the address is either truncated or uses
or implies the `::` shorthand notation twice. This yields an
invalid IPv6 address and causes IPAddr.new to choke.

This change guards against invalid IP addresses and ensures they
do not end up in the port resource's entries list.

Signed-off-by: Adam Leff <adam@leff.co>
Copy link
Contributor

@arlimus arlimus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely 👍 for guarding against these exceptions, kudos @adamleff for the very fast fix

@arlimus arlimus merged commit 279f07c into master Mar 29, 2017
@arlimus arlimus deleted the adamleff/bad-ipv6-address branch March 29, 2017 06:44
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

Successfully merging this pull request may close these issues.

None yet

3 participants