Fix a bug in syslog #3996

Merged
merged 2 commits into from Aug 8, 2016

Projects

None yet

4 participants

@vitalisator
Contributor

since PR #3812 syslog writes to wrong device id in syslog table.
this happens on all devices where inet_pton() returns false.

@vitalisator vitalisator Fix a bug in syslog
since PR #3812 syslog writes to wrong device id in syslog table.
this happens on all devices where inet_pton() returns false.
330910b
@murrant murrant commented on an outdated diff Aug 8, 2016
includes/syslog.php
@@ -13,7 +13,12 @@ function get_cache($host, $value) {
case 'device_id':
// Try by hostname
$ip = inet_pton($host);
- $dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM devices WHERE `hostname` = ? OR `sysName` = ? OR `ip` = ?', array($host, $host, $ip));
+ if (var_export(inet_ntop($ip),1) == 'false') {
@murrant
murrant Aug 8, 2016 Contributor

Wouldn't inet_ntop($ip) === false work?

@vitalisator vitalisator reduction, thx an @murrant
b438e94
@laf laf added the Bug label Aug 8, 2016
@laf laf merged commit c2efdcf into librenms:master Aug 8, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@vitalisator vitalisator deleted the vitalisator:fix-syslog branch Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment