Subject: | Calling method "get_entries" with inaccessible column in list does not report error |
Date: | Thu, 16 Jan 2020 19:00:15 -0300 |
To: | <bug-Net-SNMP [...] rt.cpan.org> |
From: | "José Queiroz (PR.RJ)" <JQueiroz [...] mpf.mp.br> |
Hi,
I was studying the use of Net::SNMP to retrieve LLDP data from devices,
and saw that, given "$session" is a valid session handle, opened with
Net::SNMP->open_session(), with a valid hostname, version and community
(thus giving otherwise valid results):
1. If I call "get_entries()" with a list compound of an unaccessible
element, it gives me an error, as in
$result = $snmp->get_entries( -columns=>[
'1.0.8802.1.1.2.1.4.1.1.2'] ) # lldpRemLocalPortNum (not-accessible)
In this case, $result returns undef and $snmp->error() indicates that
"The requested entries are empty or do not exist", as expected.
2. If I call "get_entries()" with a list of accessible elements and an
unaccessible element, it doesn't gives me an error, as in:
# lldpRemSysName (r/o), lldpRemChassisID (r/o), lldpRemPortId
(r/o), lldpRemLocalPortNum (n/a)
$result = $snmp->get_entries( -columns=>[
'1.0.8802.1.1.2.1.4.1.1.9', '1.0.8802.1.1.2.1.4.1.1.5',
'1.0.8802.1.1.2.1.4.1.1.7', '1.0.8802.1.1.2.1.4.1.1.2'] );
In this case, $result returns a valid object, with the contents of
three first valid columns, thus ignoring the invalid/empty column.
3. If I call "get_entries() with the same list above, but placing the
invalid/unaccessible column first, it doesn't gives me an error, as in:
# lldpRemLocalPortNum (n/a), lldpRemSysName (r/o),
lldpRemChassisID (r/o), lldpRemPortId (r/o)
$result = $snmp->get_entries( -columns=>[
'1.0.8802.1.1.2.1.4.1.1.2', '1.0.8802.1.1.2.1.4.1.1.9',
'1.0.8802.1.1.2.1.4.1.1.5', '1.0.8802.1.1.2.1.4.1.1.7'] );
In this case, not only the same above occurs (no error reported), as
also invalid OID keys (space terminated) are found in %$result hash.
This happens with different, otherwise valid, devices.
I'm using perl 5.26.1, (K)ubuntu 18.04 bionic 64bits, and Net::SNMP
6.0.1.
Hope this information is enough.
Thanks for your attention,
José Queiroz
--------------------------------------------------------------
Não alimente os trolls
http://br-linux.org/noticias/002750.html