public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common v3 3/3] daemon: add compat code for pmgproxy 6.x
Date: Wed,  5 May 2021 16:36:24 +0200	[thread overview]
Message-ID: <20210505143630.16884-4-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20210505143630.16884-1-s.ivanov@proxmox.com>

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 <s.ivanov@proxmox.com>
---
 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





  parent reply	other threads:[~2021-05-05 14:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 14:36 [pve-devel] [PATCH common/manager/http-server/docs] v3] improve binding, docs and access-control for pveproxy/spiceproxy Stoiko Ivanov
2021-05-05 14:36 ` [pve-devel] [PATCH common v3 1/3] daemon: drop Domain parameter from create_reusable_socket Stoiko Ivanov
2021-05-05 14:36 ` [pve-devel] [PATCH common v3 2/3] daemon: explicitly bind to wildcard address Stoiko Ivanov
2021-05-05 14:36 ` Stoiko Ivanov [this message]
2021-05-05 14:36 ` [pve-devel] [PATCH manager v3 1/1] proxy: fix wildcard address use Stoiko Ivanov
2021-05-05 14:36 ` [pve-devel] [PATCH http-server v3 1/2] access control: correctly match v4-mapped-v6 addresses Stoiko Ivanov
2021-05-05 14:36 ` [pve-devel] [PATCH http-server v3 2/2] access control: also include ipv6 in 'all' Stoiko Ivanov
2021-05-05 14:36 ` [pve-devel] [PATCH docs v3 1/3] pveproxy: add note about bindv6only sysctl Stoiko Ivanov
2021-05-05 14:36 ` [pve-devel] [PATCH docs v3 2/3] pveproxy: update documentation on 'all' alias Stoiko Ivanov
2021-05-05 14:36 ` [pve-devel] [PATCH docs v3 3/3] network: shortly document disabling ipv6 support Stoiko Ivanov
2021-05-07 16:21 ` [pve-devel] applied-series: [PATCH common/manager/http-server/docs] v3] improve binding, docs and access-control for pveproxy/spiceproxy Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505143630.16884-4-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal