Skip Menu |

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

Report information
The Basics
Id: 46711
Status: resolved
Worked: 6 min
Priority: 0/
Queue: Net-SNMP

People
Owner: dtown [...] cpan.org
Requestors: tim [...] epkes.net
Cc:
AdminCc:

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



Subject: session error message non-existant
Date: Sun, 7 Jun 2009 08:26:49 -0400
To: bug-Net-SNMP [...] rt.cpan.org
From: Tim Epkes <tim [...] epkes.net>
I have been working with Net::SNMP and noticed that when it cannot reach the host it doesn't give and error during the initial session set up as follows: ------------------------------------------------------------------------------------------------------------- my ($session, $error) = Net::SNMP->session( -version => 'snmpv2c', -nonblocking => 0, -hostname => $address, -community => 'public', -port => 161 ); if (!defined($session)) { printf ("Session Error %s %s Thread $tid ERROR: %s.\n", uc($app),$address,$error); { lock($diesignal); $diesignal=0; } } ------------------------------------------------------------------------------------------------------------- As $session always get assigned a hash. I then thought, testing for $session->error would be good, but it always comes back with nothing. I did a loop through the keys on an address that I could not reach (so their should have been an error returned) and got the following: ------------------------------------------------------------------------------------------------------------- KEY: _translate equals 255 KEY: _security equals Net::SNMP::Security::Community=HASH(0xaaf5618) KEY: _transport_argv equals ARRAY(0xaaf53a8) KEY: _pdu equals KEY: _callback equals KEY: _nonblocking equals 0 KEY: _version equals 1 KEY: _transport equals Net::SNMP::Transport::UDP=HASH(0xaaf5648) *KEY: _error equals * KEY: _context_engine_id equals KEY: _context_name equals KEY: _delay equals 0 KEY: _discovery_queue equals ARRAY(0xaaf5388) KEY: _hostname equals 10.10.10.10 ------------------------------------------------------------------------------------------------------------- As you can see Error returns nothing, even though the host I was querying was definitely unreachable. Thanks Tim
The creation of a SNMPv1/v2c session object using UDP/IPv4 does not initiate any type of communication between the manager (Net::SNMP host) and the agent on the remote host. The inability to communicate to the remote agent will only be detected (most likely by a timeout) once the first message exchange is attempted. The session() constructor prepares the object for communication by instantiated the necessary sub-objects. The Transport sub-object opens a socket for communication but nothing is sent. There is no standards based "handshake" to be performed in SNMPv1/v2c. In SNMPv3, authoritative engine ID discovery is performed and failure to communicate to the remote host will be detected during the creation of the session object.
Subject: Re: [rt.cpan.org #46711] session error message non-existant
Date: Mon, 8 Jun 2009 08:06:11 -0400
To: bug-Net-SNMP [...] rt.cpan.org
From: Tim Epkes <tim.epkes [...] gmail.com>
Very good point. Yes I forgot. TCP is the only one that can actually establish a connection and UDP is best effort delivery. Thanks, appreciate it. Tim On Sun, Jun 7, 2009 at 8:20 PM, David M. Town via RT < bug-Net-SNMP@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=46711 > > > The creation of a SNMPv1/v2c session object using UDP/IPv4 does not > initiate any type of communication between the manager (Net::SNMP host) > and the agent on the remote host. The inability to communicate to the > remote agent will only be detected (most likely by a timeout) once the > first message exchange is attempted. > > The session() constructor prepares the object for communication by > instantiated the necessary sub-objects. The Transport sub-object opens > a socket for communication but nothing is sent. There is no standards > based "handshake" to be performed in SNMPv1/v2c. In SNMPv3, > authoritative engine ID discovery is performed and failure to > communicate to the remote host will be detected during the creation of > the session object. >
Closing ticket.