5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-11 05:18:01 +03:00

storage migration: insecure: improve logging

by including the message/error from the remote side. Some people on the forum[0]
ran into 'no tunnel IP received', but without information from the remote side
it's hard to tell why.

[0]: https://forum.proxmox.com/threads/failed-no-tunnel-ip-received.80172

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2021-02-11 11:24:13 +01:00 committed by Thomas Lamprecht
parent 525b4a6ebe
commit 7cdc75a290

View File

@ -758,8 +758,14 @@ sub storage_migrate {
or die "receive command failed: $!\n";
close($input);
my ($ip) = <$info> =~ /^($PVE::Tools::IPRE)$/ or die "no tunnel IP received\n";
my ($port) = <$info> =~ /^(\d+)$/ or die "no tunnel port received\n";
my $try_ip = <$info> // '';
my ($ip) = $try_ip =~ /^($PVE::Tools::IPRE)$/ # untaint
or die "no tunnel IP received, got '$try_ip'\n";
my $try_port = <$info> // '';
my ($port) = $try_port =~ /^(\d+)$/ # untaint
or die "no tunnel port received, got '$try_port'\n";
my $socket = IO::Socket::IP->new(PeerHost => $ip, PeerPort => $port, Type => SOCK_STREAM)
or die "failed to connect to tunnel at $ip:$port\n";
# we won't be reading from the socket