Use IO::Socket::IP instead of INET
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 8 May 2015 10:24:41 +0000 (12:24 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 8 May 2015 10:35:15 +0000 (12:35 +0200)
src/PVE/Daemon.pm
src/PVE/Tools.pm

index 264f8be..0d0e16b 100644 (file)
@@ -24,7 +24,7 @@ use PVE::INotify;
 use POSIX ":sys_wait_h";
 use Fcntl ':flock';
 use Socket qw(IPPROTO_TCP TCP_NODELAY SOMAXCONN);
-use IO::Socket::INET;
+use IO::Socket::IP;
 
 use Getopt::Long;
 use Time::HiRes qw (gettimeofday);
@@ -795,13 +795,13 @@ sub create_reusable_socket {
            if $sockfd !~ m/^(\d+)$/;
        $sockfd = $1; # untaint
 
-       $socket = IO::Socket::INET->new;
+       $socket = IO::Socket::IP->new;
        $socket->fdopen($sockfd, 'w') || 
            die "cannot fdopen file descriptor '$sockfd' - $!\n";
 
     } else {
 
-       $socket = IO::Socket::INET->new(
+       $socket = IO::Socket::IP->new(
            LocalAddr => $host,
            LocalPort => $port,
            Listen => SOMAXCONN,
index 827ca58..d886a3d 100644 (file)
@@ -3,7 +3,7 @@ package PVE::Tools;
 use strict;
 use warnings;
 use POSIX qw(EINTR);
-use IO::Socket::INET;
+use IO::Socket::IP;
 use IO::Select;
 use File::Basename;
 use File::Path qw(make_path);
@@ -691,11 +691,11 @@ sub next_unused_port {
        for (my $p = $range_start; $p < $range_end; $p++) {
            next if $ports->{$p}; # reserved
 
-           my $sock = IO::Socket::INET->new(Listen => 5,
-                                            LocalAddr => '0.0.0.0',
-                                            LocalPort => $p,
-                                            ReuseAddr => 1,
-                                            Proto     => 0);
+           my $sock = IO::Socket::IP->new(Listen => 5,
+                                          LocalAddr => '0.0.0.0',
+                                          LocalPort => $p,
+                                          ReuseAddr => 1,
+                                          Proto     => 0);
 
            if ($sock) {
                close($sock);