},
'Net::Ping' => {
- 'DISTRIBUTION' => 'RURBAN/Net-Ping-2.55.tar.gz',
+ 'DISTRIBUTION' => 'RURBAN/Net-Ping-2.61.tar.gz',
'FILES' => q[dist/Net-Ping],
'EXCLUDED' => [
qw(README.md.PL),
'CUSTOMIZED' => [
qw( t/000_load.t
t/001_new.t
- t/010_pingecho.t
- t/500_ping_icmp.t
- t/510_ping_udp.t),
+ t/500_ping_icmp.t),
],
},
CHANGES
-------
+2.61 Sat Jun 17 13:12:58 CEST 2017 (rurban)
+ Bugfixes
+ - Fix ping_udp for a started udp echo server (PR#5 by Stephan Loyd)
+
+2.60 Mon Jun 12 20:14:13 CEST 2017 (rurban)
+ Bugfixes
+ - Fix t/400_ping_syn.t phases
+ - Try to handle Windows Socket::getnameinfo errors
+ - Improve some tests on missing network connections
+
+2.59 Tue Apr 18 08:46:48 2017 +0200 (rurban)
+ Bugfixes
+ - skip udp ping tests on more platforms: hpux, irix, aix.
+ also pingecho on os390.
+ (from perl5 core)
+ Features
+ - added a make release target
+
+2.58 Wed Feb 1 19:34:03 CET 2017 (rurban)
+ Features
+ - return the port num as 5th return value with ack (jfraire)
+
+2.57 Wed Feb 1 19:34:03 CET 2017 (rurban)
+ Bugfixes
+ - Resigned with new gpg key
+
+2.56 Wed Jan 18 16:00:00 2017 -0700 (bbb)
+ Bugfixes
+ - Stabilize tests
+
2.55 Thu Oct 20 09:16:06 2016 +0200 (rurban)
Bugfixes
use Socket qw( SOCK_DGRAM SOCK_STREAM SOCK_RAW AF_INET PF_INET IPPROTO_TCP
SOL_SOCKET SO_ERROR SO_BROADCAST
IPPROTO_IP IP_TOS IP_TTL
- inet_ntoa inet_aton getnameinfo NI_NUMERICHOST sockaddr_in );
+ inet_ntoa inet_aton getnameinfo sockaddr_in );
use POSIX qw( ENOTCONN ECONNREFUSED ECONNRESET EINPROGRESS EWOULDBLOCK EAGAIN
WNOHANG );
use FileHandle;
@ISA = qw(Exporter);
@EXPORT = qw(pingecho);
@EXPORT_OK = qw(wakeonlan);
-$VERSION = "2.55";
+$VERSION = "2.61";
# Globals
# Constants
-my $AF_INET6 = eval { Socket::AF_INET6() };
+my $AF_INET6 = eval { Socket::AF_INET6() } || 30;
my $AF_UNSPEC = eval { Socket::AF_UNSPEC() };
-my $AI_NUMERICHOST = eval { Socket::AI_NUMERICHOST() };
-my $NI_NUMERICHOST = eval { Socket::NI_NUMERICHOST() };
-my $IPPROTO_IPV6 = eval { Socket::IPPROTO_IPV6() };
+my $AI_NUMERICHOST = eval { Socket::AI_NUMERICHOST() } || 4;
+my $NI_NUMERICHOST = eval { Socket::NI_NUMERICHOST() } || 2;
+my $IPPROTO_IPV6 = eval { Socket::IPPROTO_IPV6() } || 41;
#my $IPV6_HOPLIMIT = eval { Socket::IPV6_HOPLIMIT() }; # ping6 -h 0-255
my $qr_family = qr/^(?:(?:(:?ip)?v?(?:4|6))|${\AF_INET}|$AF_INET6)$/;
my $qr_family4 = qr/^(?:(?:(:?ip)?v?4)|${\AF_INET})$/;
? ('ip' => $ip->{addr_in})
: ('host' => $ip->{host});
- eval { require Net::Ping::External; }
- or croak('Protocol "external" not supported on your system: Net::Ping::External not found');
+ eval {
+ local @INC = @INC;
+ pop @INC if $INC[-1] eq '.';
+ require Net::Ping::External;
+ } or croak('Protocol "external" not supported on your system: Net::Ping::External not found');
return Net::Ping::External::ping(@addr, timeout => $timeout,
family => $family);
}
$done = 1;
} else {
($from_port, $from_ip) = _unpack_sockaddr_in($from_saddr, $ip->{family});
+ my $addr_in = ref($ip) eq "HASH" ? $ip->{addr_in} : $ip;
if (!$source_verify ||
- (($from_ip eq $ip) && # Does the packet check out?
+ (($from_ip eq $addr_in) && # Does the packet check out?
($from_port == $self->{port_num}) &&
($from_msg eq $msg)))
{
}
}
- my $entry = [ $host, $ip, $fh, $start_time, $stop_time ];
+ my $entry = [ $host, $ip, $fh, $start_time, $stop_time, $self->{port_num} ];
$self->{syn}->{$fh->fileno} = $entry;
if ($self->{stop_time} < $stop_time) {
$self->{stop_time} = $stop_time;
}
# Everything passed okay, return the answer
return wantarray ?
- ($entry->[0], &time() - $entry->[3], $self->ntop($entry->[1]))
+ ($entry->[0], &time() - $entry->[3], $self->ntop($entry->[1]), $entry->[5])
: $entry->[0];
} else {
warn "Corrupted SYN entry: unknown fd [$fd] ready!";
# Socket warns when undef is passed in, but it still works.
my $port = getservbyname('echo', 'udp');
my $sockaddr = _pack_sockaddr_in($port, $ip);
- my ($error, $address) = getnameinfo($sockaddr, NI_NUMERICHOST);
- if($error) {
- croak $error;
- }
+ my ($error, $address) = getnameinfo($sockaddr, $NI_NUMERICHOST);
+ croak $error if $error;
return $address;
}
croak("getnameinfo($getaddr[0]->{addr}) failed - $err");
}
} else {
- my $error = sprintf "getaddrinfo($h{host},,%s) failed - $err",
- ($family == AF_INET) ? "AF_INET" : "AF_INET6";
- croak("$error");
+ croak(sprintf("getaddrinfo($h{host},,%s) failed - $err",
+ $family == AF_INET ? "AF_INET" : "AF_INET6"));
}
# old way
} else {
reached before the TCP ACK is received, or if the remote
host is not listening on the port attempted, then the TCP
connection will not be established and ack() will return
-undef. In list context, the host, the ack time, and the
-dotted ip string will be returned instead of just the host.
+undef. In list context, the host, the ack time, the dotted ip
+string, and the port number will be returned instead of just the host.
If the optional $host argument is specified, the return
value will be pertaining to that host only.
This call simply does nothing if you are using any protocol
BEGIN {use_ok('Net::Ping')};
TODO: {
- local $TODO = "Not working on os390 smoker; may be a prermissions problem"
+ local $TODO = "Not working on os390 smoker; may be a permissions problem"
if $^O eq 'os390';
my $result = pingecho("127.0.0.1");
is($result, 1, "pingecho works");
#
# $ PERL_CORE=1 make test
-use Test::More tests => 13;
+use Test::More tests => 12;
BEGIN {use_ok('Net::Ping');}
my $p = new Net::Ping "tcp",9;
# Test a few remote servers
# Hopefully they are up when the tests are run.
-foreach (qw(www.geocities.com www.wisc.edu
- www.freeservers.com ftp.freeservers.com
- yahoo.com www.yahoo.com www.about.com)) {
+if ($p->ping('google.com')) { # check for firewall
+ foreach (qw(google.com www.google.com www.wisc.edu
+ yahoo.com www.yahoo.com www.about.com)) {
isnt($p->ping($_), 0, "Can ping $_");
+ }
+} else {
+ SKIP: {
+ skip "Cannot ping google.com: no TCP connection or firewall", 6;
+ }
}
if ($ENV{PERL_CORE}) {
unless ($ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
- exit;
+ exit;
}
}
unless (eval "require Socket") {
# $ PERL_CORE=1 make test
# Try a few remote servers
-my %webs;
-BEGIN {
- %webs = (
+my %webs = (
# Hopefully this is never a routeable host
"172.29.249.249" => 0,
# Hopefully all these web ports are open
- "www.geocities.com." => 1,
"www.freeservers.com." => 1,
"yahoo.com." => 1,
"www.yahoo.com." => 1,
"www.about.com." => 1,
"www.microsoft.com." => 1,
);
-}
-use Test::More tests => 3 + 2 * keys %webs;
+use Test::More;
+plan tests => 3 + 2 * keys %webs;
-BEGIN {use_ok('Net::Ping')};
+use_ok('Net::Ping');
my $can_alarm = eval {alarm 0; 1;};
# (Make sure getservbyname works in scalar context.)
cmp_ok(($p->{port_num} = getservbyname("http", "tcp")), '>', 0, 'valid port');
+# check if network is up
+eval { $p->ping('www.google.com.'); };
+if ($@ =~ /getaddrinfo.*failed/) {
+ ok(1, "skip $@");
+ ok(1, "skip") for 0..12;
+ exit;
+}
foreach my $host (keys %webs) {
# ping() does dns resolution and
# only sends the SYN at this point
is($p->ping($host), 1, "Can reach $host [" . ($p->{bad}->{$host} || "") . "]");
}
+my $failed;
Alarm(20);
while (my $host = $p->ack()) {
- is($webs{$host}, 1, "supposed to be up: http://$host/");
+ next if $host eq 'www.google.com.';
+ $failed += !is($webs{$host}, 1, "supposed to be up: http://$host/");
delete $webs{$host};
}
Alarm(0);
foreach my $host (keys %webs) {
- is($webs{$host}, 0, "supposed to be down: http://$host/ [" . ($p->{bad}->{$host} || "") . "]");
+ $failed += !is($webs{$host}, 0,
+ "supposed to be down: http://$host/ [" . ($p->{bad}->{$host} || "") . "]");
+}
+
+if ($failed) {
+ diag ("NOTE: ",
+ "Network connectivity will be required for all tests to pass.\n",
+ "Firewalls may also cause some tests to fail, so test it ",
+ "on a clear network.");
}
"172.29.249.249" => 0,
# Hopefully all these web ports are open
- "www.geocities.com." => 1,
+ "www.google.com." => 1,
"www.freeservers.com." => 1,
"yahoo.com." => 1,
"www.yahoo.com." => 1,
Memoize cpan/Memoize/Memoize.pm 902092ff91cdec9c7b4bd06202eb179e1ce26ca2
Net::Ping dist/Net-Ping/t/000_load.t deff5dc2ca54dae28cb19d3631427db127279ac2
Net::Ping dist/Net-Ping/t/001_new.t 90c9d63509b3efc8941449fbd1ca8b807fa42040
-Net::Ping dist/Net-Ping/t/010_pingecho.t fd91db2daf78a994bd0210ab32cca2a46dff4f44
Net::Ping dist/Net-Ping/t/500_ping_icmp.t a003daa5eaf215e58234786bb1fbfbebf669bf44
-Net::Ping dist/Net-Ping/t/510_ping_udp.t 6f01825a13a3ea294888bbd3af0aac95fb7f672f
NEXT cpan/NEXT/lib/NEXT.pm 2c83d03ee361816e53ccb931137d314ab878d19f
NEXT cpan/NEXT/t/next.t 66fd60eb0f75b6f3eea95d1dee745f9a7a348146
Pod::Checker cpan/Pod-Checker/t/pod/contains_bad_pod.xr 73538fd80dfe6e19ad561fe034009b44460208f6