mirror of
https://git.proxmox.com/git/pve-common
synced 2025-04-29 15:42:43 +00:00
daemon: add compat code for pmgproxy 6.x
The changes to the listening behavior introduced with PVE 6.4 break
backwardscompatibility w.r.t. listening address and logging, which
should not be changed without explictly notifying the user.
This patch re-adds the family parameter, which is still used by
pmgproxy and based on its existence creates the socket as before.
compared to the IO::Socket::IP->new call used before
390fc10dc4
, the only change is the
renaming of 'LocalAddr' to 'LocalHost' (which are synonymous in
IO::Socket::IP [0])
It can simply be reverted with the release of pmg-api 7.0 (where
we'll record the change in the release-notes and upgrade-page)
[0] https://perldoc.perl.org/IO::Socket::IP
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
2f8be3bfda
commit
a3777dce67
@ -799,7 +799,7 @@ sub register_status_command {
|
|||||||
# some useful helper
|
# some useful helper
|
||||||
|
|
||||||
sub create_reusable_socket {
|
sub create_reusable_socket {
|
||||||
my ($self, $port, $host) = @_;
|
my ($self, $port, $host, $family) = @_;
|
||||||
|
|
||||||
die "no port specifed" if !$port;
|
die "no port specifed" if !$port;
|
||||||
|
|
||||||
@ -818,7 +818,6 @@ sub create_reusable_socket {
|
|||||||
|
|
||||||
$socket->fcntl(Fcntl::F_SETFD(), Fcntl::FD_CLOEXEC);
|
$socket->fcntl(Fcntl::F_SETFD(), Fcntl::FD_CLOEXEC);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
my %sockargs = (
|
my %sockargs = (
|
||||||
LocalPort => $port,
|
LocalPort => $port,
|
||||||
Listen => SOMAXCONN,
|
Listen => SOMAXCONN,
|
||||||
@ -826,7 +825,16 @@ sub create_reusable_socket {
|
|||||||
GetAddrInfoFlags => 0,
|
GetAddrInfoFlags => 0,
|
||||||
ReuseAddr => 1,
|
ReuseAddr => 1,
|
||||||
);
|
);
|
||||||
if (defined($host)) {
|
|
||||||
|
# FIXME: drop this if clause and the $family parameter with 7.0:
|
||||||
|
# compat code for pmgproxy
|
||||||
|
if (defined($family)) {
|
||||||
|
$socket = IO::Socket::IP->new(
|
||||||
|
Family => $family,
|
||||||
|
LocalHost => $host,
|
||||||
|
%sockargs) ||
|
||||||
|
die "unable to create socket - $@\n";
|
||||||
|
} elsif (defined($host)) {
|
||||||
$socket = IO::Socket::IP->new( LocalHost => $host, %sockargs) ||
|
$socket = IO::Socket::IP->new( LocalHost => $host, %sockargs) ||
|
||||||
die "unable to create socket - $@\n";
|
die "unable to create socket - $@\n";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user