Error polling bgp-peers. TypeError: long2ip(): Argument #1 ($ip) must be of type int, float given - Cisco ASR

Component Version
LibreNMS 23.5.0-9-gea57c2518 (2023-05-31T01:49:12+02:00)
DB Schema 2023_05_12_071412_devices_expand_timetaken_doubles (252)
PHP 8.2.6
Python 3.7.3
Database MariaDB 10.3.38-MariaDB-0+deb10u1
RRDTool 1.7.1
SNMP 5.7.3
===========================================
I have a problem with BGP peers for Cisco ASR. BGP session from router is not properly present because of that.


Libre log:

Error polling bgp-peers module for X.X.X.X. TypeError: long2ip(): Argument #1 ($ip) must be of type int, float given in /opt/librenms/LibreNMS/Util/IP.php:59
Stack trace:
#0 /opt/librenms/LibreNMS/Util/IP.php(59): long2ip()
#1 /opt/librenms/includes/polling/bgp-peers.inc.php(428): LibreNMS\Util\IP::fromHexString()
#2 /opt/librenms/includes/polling/functions.inc.php(339): include('...')
#3 /opt/librenms/poller.php(126): poll_device()
#4 {main}
long2ip(): Argument #1 ($ip) must be of type int, float given {"exception":"[object] (TypeError(code: 0): long2ip(): Argument #1 ($ip) must be of type int, float given at /opt/librenms/LibreNMS/Util/IP.php:59)"}

But from my another instance of LibreNMS where is:

Component Version
LibreNMS 23.5.0-8-g713bef33b (2023-05-30T15:12:08+02:00)
DB Schema 2023_04_27_164904_update_slas_opstatus_tinyint (252)
PHP 8.1.11
Python 3.9.2
Database MariaDB 10.5.15-MariaDB-0+deb11u1
RRDTool 1.7.2
SNMP 5.9
===========================================

everythink is ok for the same host:

I workaround this issue.
In /opt/librenms/LibreNMS/Util/IP.php and fromHexString function add intval()

        try {
            if (strlen($hex) == 8) {
                return new IPv4(long2ip(**intval**(hexdec($hex))));
            }

And now all bgp sessions are presented like on asr.
But how to fix it correctly, without modify php files?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.