* [pve-devel] [PATCH storage] storage migration: insecure: improve logging
@ 2021-02-11 9:42 Fabian Ebner
2021-02-11 9:46 ` Fabian Ebner
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2021-02-11 9:42 UTC (permalink / raw)
To: pve-devel
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>
---
PVE/Storage.pm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 22a6ef1..3c03abe 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -758,8 +758,16 @@ 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 $ip = <$info> // '';
+ chomp($ip);
+ die "no tunnel IP received, got '$ip'\n"
+ if $ip !~ /^$PVE::Tools::IPRE$/;
+
+ my $port = <$info> // '';
+ chomp($port);
+ die "no tunnel port received, got '$port'\n"
+ if $port !~ /^\d+$/;
+
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
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [pve-devel] [PATCH storage] storage migration: insecure: improve logging
2021-02-11 9:42 [pve-devel] [PATCH storage] storage migration: insecure: improve logging Fabian Ebner
@ 2021-02-11 9:46 ` Fabian Ebner
0 siblings, 0 replies; 2+ messages in thread
From: Fabian Ebner @ 2021-02-11 9:46 UTC (permalink / raw)
To: pve-devel
This breaks pvesr replication, because the -T switch is active there.
I'll send a v2 and preserve the regex captures.
Am 11.02.21 um 10:42 schrieb Fabian Ebner:
> 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>
> ---
> PVE/Storage.pm | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/Storage.pm b/PVE/Storage.pm
> index 22a6ef1..3c03abe 100755
> --- a/PVE/Storage.pm
> +++ b/PVE/Storage.pm
> @@ -758,8 +758,16 @@ 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 $ip = <$info> // '';
> + chomp($ip);
> + die "no tunnel IP received, got '$ip'\n"
> + if $ip !~ /^$PVE::Tools::IPRE$/;
> +
> + my $port = <$info> // '';
> + chomp($port);
> + die "no tunnel port received, got '$port'\n"
> + if $port !~ /^\d+$/;
> +
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-11 9:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 9:42 [pve-devel] [PATCH storage] storage migration: insecure: improve logging Fabian Ebner
2021-02-11 9:46 ` Fabian Ebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox