[pve-devel] [PATCH] pass port family to next_vnc_port

Wolfgang Bumiller w.bumiller at proxmox.com
Tue May 12 12:12:47 CEST 2015


---
 PVE/API2/Nodes.pm | 10 ++++++----
 PVE/API2Tools.pm  |  5 ++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 1191925..3519117 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -680,14 +680,16 @@ __PACKAGE__->register_method ({
 	$sslcert = PVE::Tools::file_get_contents("/etc/pve/pve-root-ca.pem", 8192)
 	    if !$sslcert;
 
-	my $port = PVE::Tools::next_vnc_port();
-
-	my $remip;
+	my ($remip, $family);
 
 	if ($node ne PVE::INotify::nodename()) {
-	    $remip = PVE::Cluster::remote_node_ip($node);
+	    ($remip, $family) = PVE::Cluster::remote_node_ip($node);
+	} else {
+	    $family = PVE::Tools::get_host_address_family($node);
 	}
 
+	my $port = PVE::Tools::next_vnc_port($family);
+
 	# NOTE: vncterm VNC traffic is already TLS encrypted,
 	# so we select the fastest chipher here (or 'none'?)
 	my $remcmd = $remip ? 
diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index 1e79df6..56cc044 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -5,6 +5,7 @@ use warnings;
 use Net::IP;
 
 use PVE::Tools;
+use PVE::INotify;
 use Digest::MD5 qw(md5_hex);
 use URI;
 use URI::Escape;
@@ -143,7 +144,9 @@ sub run_spiceterm {
 
     my $authuser = $rpcenv->get_user();
 
-    my $port = PVE::Tools::next_spice_port();
+    my $nodename = PVE::INotify::nodename();
+    my $family = PVE::Tools::get_host_address_family($nodename);
+    my $port = PVE::Tools::next_spice_port($family);
     
     my ($ticket, undef, $remote_viewer_config) = 
 	PVE::AccessControl::remote_viewer_config($authuser, $vmid, $node, $proxy, $title, $port);
-- 
2.1.4





More information about the pve-devel mailing list