Skip Menu |

This queue is for tickets about the Net-SNMP CPAN distribution.

Report information
The Basics
Id: 124733
Status: open
Priority: 0/
Queue: Net-SNMP

People
Owner: dtown [...] cpan.org
Requestors: ldavidwalden [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Net::SNMP->session not returning correct value when errored
Date: Thu, 8 Mar 2018 13:55:51 -0600
To: bug-Net-SNMP [...] rt.cpan.org
From: David Walden <ldavidwalden [...] gmail.com>
When initiating a session and the session cannot be established due to an incorrect community string and error and undefined session are not being returned. If an error occurs will not execute the if loop due to no error being returned. ($session, $error) = Net::SNMP->session( -hostname => $ip, -community => $comm, -version => 'snmpv2c', -timeout => 2, -retries => 1, ); if (!defined($session) { printf "ERROR: %s.\n", $error; exit 1; }
When creating a SNMPv1 or SNMPv2 session object, no communication occurs with target "hostname" during the creation of the "session". The community string is just stored in the session object. When the first get/set/next query is performed, the agent on "hostname" will fail to authenticate the invalid community string and drop the message. The query will the return a timeout error because the agent never responded.