Use IO::Socket::IP instead of INET

This commit is contained in:
Wolfgang Bumiller 2015-05-08 12:24:41 +02:00 committed by Dietmar Maurer
parent 93276209cc
commit 00dc9d0fa9
2 changed files with 9 additions and 9 deletions

View 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,

View 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);