From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id D746179C1D for ; Wed, 5 May 2021 16:36:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 003DD17CF6 for ; Wed, 5 May 2021 16:36:48 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 7ADCB17C66 for ; Wed, 5 May 2021 16:36:45 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5558642A04 for ; Wed, 5 May 2021 16:36:45 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Wed, 5 May 2021 16:36:24 +0200 Message-Id: <20210505143630.16884-4-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210505143630.16884-1-s.ivanov@proxmox.com> References: <20210505143630.16884-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.007 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [daemon.pm, perl.org] Subject: [pve-devel] [PATCH common v3 3/3] daemon: add compat code for pmgproxy 6.x X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 14:36:51 -0000 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 390fc10dc4a696dd30646cbdd018ad08d855175f, 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 --- src/PVE/Daemon.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/PVE/Daemon.pm b/src/PVE/Daemon.pm index 2ab4f35..2095001 100644 --- a/src/PVE/Daemon.pm +++ b/src/PVE/Daemon.pm @@ -799,7 +799,7 @@ sub register_status_command { # some useful helper sub create_reusable_socket { - my ($self, $port, $host) = @_; + my ($self, $port, $host, $family) = @_; die "no port specifed" if !$port; @@ -818,7 +818,6 @@ sub create_reusable_socket { $socket->fcntl(Fcntl::F_SETFD(), Fcntl::FD_CLOEXEC); } else { - my %sockargs = ( LocalPort => $port, Listen => SOMAXCONN, @@ -826,7 +825,16 @@ sub create_reusable_socket { GetAddrInfoFlags => 0, 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) || die "unable to create socket - $@\n"; } else { -- 2.20.1