New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Net::Ping patch #2987
Comments
From gellyfish@gellyfish.comHello, With Net::Ping, when using the default udp 'ping', undef may be returned by Use of uninitialized value in subroutine entry at which is confusing to the user of the module and unnecessary. The following The patch is against version 2.02 of the module as distributed with 5.6.0 . Inline Patch--- Ping.pm~ Thu Dec 14 07:12:10 2000
+++ Ping.pm Thu Dec 14 07:56:22 2000
@@ -369,14 +369,20 @@
elsif ($nfound) # A packet is waiting
{
$from_msg = "";
- $from_saddr = recv($self->{"fh"}, $from_msg, 1500, $flags);
- ($from_port, $from_ip) = sockaddr_in($from_saddr);
- if (($from_ip eq $ip) && # Does the packet check out?
- ($from_port == $self->{"port_num"}) &&
- ($from_msg eq $msg))
+ if( $from_saddr = recv($self->{"fh"}, $from_msg, 1500, $flags) )
{
- $ret = 1; # It's a winner
- $done = 1;
+ ($from_port, $from_ip) = sockaddr_in($from_saddr);
+ if (($from_ip eq $ip) && # Does the packet check out?
+ ($from_port == $self->{"port_num"}) &&
+ ($from_msg eq $msg))
+ {
+ $ret = 1; # It's a winner
+ $done = 1;
+ }
+ }
+ else # probably no UDP echo service running. But persist.
+ {
+ $done = 0;
}
}
else # Oops, timed out
@@ -454,6 +460,11 @@
received from the remote host and the received packet contains the
same data as the packet that was sent, the remote host is considered
reachable. This protocol does not require any special privileges.
+
+It should be borne in mind that, for both tcp and udp ping, a host
+will be reported as unreachable if if not is not running the
+appropriate echo service. For Unix-like systems see L<inetd(8)> for
+more information.
If the "icmp" protocol is specified, the ping() method sends an icmp
echo message to the remote host, which is what the UNIX ping program
|
From gellyfish@gellyfish.comPing.diff--- Ping.pm~ Thu Dec 14 07:12:10 2000
+++ Ping.pm Thu Dec 14 07:56:22 2000
@@ -369,14 +369,20 @@
elsif ($nfound) # A packet is waiting
{
$from_msg = "";
- $from_saddr = recv($self->{"fh"}, $from_msg, 1500, $flags);
- ($from_port, $from_ip) = sockaddr_in($from_saddr);
- if (($from_ip eq $ip) && # Does the packet check out?
- ($from_port == $self->{"port_num"}) &&
- ($from_msg eq $msg))
+ if( $from_saddr = recv($self->{"fh"}, $from_msg, 1500, $flags) )
{
- $ret = 1; # It's a winner
- $done = 1;
+ ($from_port, $from_ip) = sockaddr_in($from_saddr);
+ if (($from_ip eq $ip) && # Does the packet check out?
+ ($from_port == $self->{"port_num"}) &&
+ ($from_msg eq $msg))
+ {
+ $ret = 1; # It's a winner
+ $done = 1;
+ }
+ }
+ else # probably no UDP echo service running. But persist.
+ {
+ $done = 0;
}
}
else # Oops, timed out
@@ -454,6 +460,11 @@
received from the remote host and the received packet contains the
same data as the packet that was sent, the remote host is considered
reachable. This protocol does not require any special privileges.
+
+It should be borne in mind that, for both tcp and udp ping, a host
+will be reported as unreachable if if not is not running the
+appropriate echo service. For Unix-like systems see L<inetd(8)> for
+more information.
If the "icmp" protocol is specified, the ping() method sends an icmp
echo message to the remote host, which is what the UNIX ping program
|
From @jhiSomething very similar to your patch had already gone in to the elsif ($nfound) # A packet is waiting On Thu, Dec 14, 2000 at 08:28:14AM +0000, Jonathan Stowe wrote:
|
From [Unknown Contact. See original ticket]On Thu, 14 Dec 2000, Jarkko Hietaniemi wrote:
I must be going blind - I looked at the latest cut of the development track /J\ |
From @jhiOn Fri, Dec 15, 2000 at 09:36:05AM +0000, Jonathan Stowe wrote:
The doc snippet was a good addition, though. |
Migrated from rt.perl.org#4909 (status was 'resolved')
Searchable as RT4909$
The text was updated successfully, but these errors were encountered: