Репозитории ALT
Группа :: Разработка/Perl
Пакет: perl-Net-Ping
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: perl-Net-Ping-2.31-bleadperl-24699.patch
Скачать
Скачать
--- Net-Ping-2.31/lib/Net/Ping.pm 2003-06-28 01:31:07 +0400
+++ perl-5.9.3.24699/lib/Net/Ping.pm 2005-06-04 01:33:12 +0400
@@ -16,7 +16,7 @@ use Carp;
@ISA = qw(Exporter);
@EXPORT = qw(pingecho);
-$VERSION = "2.31";
+$VERSION = "2.31_02";
sub SOL_IP { 0; };
sub IP_TOS { 1; };
@@ -316,9 +316,9 @@ sub socket_blocking_mode
# set the non-blocking mode (set O_NONBLOCK)
my $flags;
- if ($^O eq 'MSWin32') {
- # FIONBIO enables non-blocking sockets on windows.
- # FIONBIO is (0x80000000|(4<<16)|(ord('f')<<8)|126), as per winsock.h.
+ if ($^O eq 'MSWin32' || $^O eq 'VMS') {
+ # FIONBIO enables non-blocking sockets on windows and vms.
+ # FIONBIO is (0x80000000|(4<<16)|(ord('f')<<8)|126), as per winsock.h, ioctl.h
my $f = 0x8004667e;
my $v = pack("L", $block ? 0 : 1);
ioctl($fh, $f, $v) or croak("ioctl failed: $!");
@@ -395,12 +395,13 @@ sub ping_external {
return Net::Ping::External::ping(ip => $ip, timeout => $timeout);
}
-use constant ICMP_ECHOREPLY => 0; # ICMP packet types
-use constant ICMP_ECHO => 8;
-use constant ICMP_STRUCT => "C2 n3 A"; # Structure of a minimal ICMP packet
-use constant SUBCODE => 0; # No ICMP subcode for ECHO and ECHOREPLY
-use constant ICMP_FLAGS => 0; # No special flags for send or recv
-use constant ICMP_PORT => 0; # No port with ICMP
+use constant ICMP_ECHOREPLY => 0; # ICMP packet types
+use constant ICMP_UNREACHABLE => 3; # ICMP packet types
+use constant ICMP_ECHO => 8;
+use constant ICMP_STRUCT => "C2 n3 A"; # Structure of a minimal ICMP packet
+use constant SUBCODE => 0; # No ICMP subcode for ECHO and ECHOREPLY
+use constant ICMP_FLAGS => 0; # No special flags for send or recv
+use constant ICMP_PORT => 0; # No port with ICMP
sub ping_icmp
{
@@ -478,10 +479,12 @@ sub ping_icmp
$self->{"from_subcode"} = $from_subcode;
if (($from_pid == $self->{"pid"}) && # Does the packet check out?
($from_seq == $self->{"seq"})) {
- if ($from_type == ICMP_ECHOREPLY){
+ if ($from_type == ICMP_ECHOREPLY) {
$ret = 1;
+ $done = 1;
+ } elsif ($from_type == ICMP_UNREACHABLE) {
+ $done = 1;
}
- $done = 1;
}
} else { # Oops, timed out
$done = 1;