Fix librenms auto-discovery #2457

Merged
merged 1 commit into from Nov 19, 2015

Projects

None yet

3 participants

@ekoyle
Contributor
ekoyle commented Nov 18, 2015

Librenms autodiscovery currently does not work because of a logic error.

$ip will be an IP address if $dst_host is a valid hostname, but if discovery_by_ip is false then we exit without running discovery (even with a valid hostname in dst_host).

@ekoyle ekoyle Fix librenms auto-discovery
fb05015
@laf
Member
laf commented Nov 18, 2015

We fixed this in another way last night (someone tested the patch) but it's not merged. Here is what we did:

https://www.irccloud.com/pastebin/ZkoK4G3k/

What does everyone think of the best way to resolve this?

@ekoyle
Contributor
ekoyle commented Nov 18, 2015

That should work, as long as the result from gethostbyname is still being checked somewhere. According to http://php.net/manual/en/function.gethostbyname.php , gethostbyname will return the input string in the case of a failure.

@laf
Member
laf commented Nov 19, 2015

Thanks @ekoyle. We will go with yours.

Happy to accept this fix, for future PRs can you sign the contributors agreement though: http://docs.librenms.org/General/Contributing/

@laf laf merged commit 6d82bbf into librenms:master Nov 19, 2015

2 checks passed

Auto-Deploy Build finished. No test results found.
Details
Scrutinizer No new issues
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment