From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Stoiko Ivanov <s.ivanov@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [RFC manager 1/1] proxy: fix wildcard address use
Date: Fri, 30 Apr 2021 09:12:09 +0200 [thread overview]
Message-ID: <20210430071209.7xq6aobehmvfhngc@wobu-vie.proxmox.com> (raw)
In-Reply-To: <20210429133702.23584-3-s.ivanov@proxmox.com>
On Thu, Apr 29, 2021 at 03:37:02PM +0200, Stoiko Ivanov wrote:
> This patch fixes a regression for hosts disabling ipv6 via kernel
> commandline ('ipv6.disable=1')introduced in commit
> fc087ec2b924dc9c72d3bf80face8a1731c15405
>
> by hardcoding the address to '::', pveproxy and spiceproxy failed to
> start with:
> 'unable to create socket - Address family not supported by protocol'
>
> Disabling IPv6 via sysctl did not exhibit these problems.
>
> This patch depends on the commit in pve-common and needs a versioned
> dependency bump on libpve-common-perl.
>
> With this patch the listening addresses are (`ss -tlnp |grep 8006` output)
> * disabled via kernel cmdline: '0.0.0.0:8006'
> * disabled via sysctl net.ipv6.conf.all.disable_ipv6=1: '0.0.0.0:8006'
> * else: '*:8006'
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> PVE/Service/pveproxy.pm | 2 +-
> PVE/Service/spiceproxy.pm | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
> index 4ecd442a..742c0a9a 100755
> --- a/PVE/Service/pveproxy.pm
> +++ b/PVE/Service/pveproxy.pm
> @@ -69,7 +69,7 @@ sub init {
> my $lockfh = IO::File->new(">>${accept_lock_fn}") ||
> die "unable to open lock file '${accept_lock_fn}' - $!\n";
>
> - my $listen_ip = $proxyconf->{LISTEN_IP} // "::0";
> + my $listen_ip = $proxyconf->{LISTEN_IP} // PVE::Tools::get_wildcard_address();
> my $socket = $self->create_reusable_socket(8006, $listen_ip);
^ This passes `Domain => PF_INET6`. That makes no sense given that I can
literally give it an IPv4 :S
It also actually uses getaddrinfo in the background, however, the
commmit forcing this to be 0 explains:
perl's IO::Socket::IP passes AI_ADDRCONFIG if no GetAddrInfoFlags are passed,
which is often useful but also causes it to error when explicitly trying to
bind to 127.0.0.1 when there are no _other_ IPv4 addresses present.
In this case however, we don't do that, so maybe instead of ending up using
`getaddrinfo` twice, we should just make this an optional parameter?
I'm hoping passing `undef` as host, the proper port and `AI_ADDRCONFIG |
AI_PASSIVE` here should do the same?
We also don't use `$listen_ip` for anything else either, so we don't need it
explicitly ;-)
>
> my $dirs = {};
> diff --git a/PVE/Service/spiceproxy.pm b/PVE/Service/spiceproxy.pm
> index 24be0ed7..34882ca4 100755
> --- a/PVE/Service/spiceproxy.pm
> +++ b/PVE/Service/spiceproxy.pm
> @@ -39,7 +39,7 @@ sub init {
> my $lockfh = IO::File->new(">>${accept_lock_fn}") ||
> die "unable to open lock file '${accept_lock_fn}' - $!\n";
>
> - my $listen_ip = $proxyconf->{LISTEN_IP} // "::0";
> + my $listen_ip = $proxyconf->{LISTEN_IP} // PVE::Tools::get_wildcard_address();
> my $socket = $self->create_reusable_socket(3128, $listen_ip);
>
> $self->{server_config} = {
> --
> 2.20.1
prev parent reply other threads:[~2021-04-30 7:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 13:37 [pve-devel] [RFC common/manger] use appropriate wildcard address for pveproxy/spiceproxy Stoiko Ivanov
2021-04-29 13:37 ` [pve-devel] [RFC common 1/1] tools: add get_wildcard_address Stoiko Ivanov
2021-04-29 13:37 ` [pve-devel] [RFC manager 1/1] proxy: fix wildcard address use Stoiko Ivanov
2021-04-30 7:12 ` Wolfgang Bumiller [this message]
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=20210430071209.7xq6aobehmvfhngc@wobu-vie.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.ivanov@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