Skip to content

Commit 5fe642f

Browse files
loopodoopomurrant
andauthored
Fix: parseIpField() handles TiMOS SNMP-encoded hex IP strings (e.g. '… (librenms#17375)
* Fix: parseIpField() handles TiMOS SNMP-encoded hex IP strings (e.g. '0A 01 06 26') * only one try catch is needed * Create timos_ixr.json * whitespace --------- Co-authored-by: Tony Murray <murraytony@gmail.com>
1 parent 2edcaae commit 5fe642f

File tree

3 files changed

+21623
-0
lines changed

3 files changed

+21623
-0
lines changed

LibreNMS/OS/Timos.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,10 @@ private function parseIpField(array $data, string $ngField): ?string
927927
{
928928
if (isset($data[$ngField])) {
929929
try {
930+
if (is_string($data[$ngField]) && preg_match('/^([0-9A-Fa-f]{2} ?)+$/', $data[$ngField])) {
931+
return IP::fromHexString($data[$ngField])->uncompressed();
932+
}
933+
930934
return IP::parse($data[$ngField])->uncompressed();
931935
} catch (InvalidIpException $e) {
932936
return null;

0 commit comments

Comments
 (0)