|
|
eec4b3 |
From fe2d91f045188e5f58e33727741cff97793ad227 Mon Sep 17 00:00:00 2001
|
|
|
eec4b3 |
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
|
|
|
eec4b3 |
Date: Wed, 11 Mar 2015 16:19:12 +0100
|
|
|
eec4b3 |
Subject: [PATCH] Take --direct into consideration when checking if a guest is
|
|
|
eec4b3 |
reachable
|
|
|
eec4b3 |
|
|
|
eec4b3 |
When connecting to a remote host (using qemu+ssh://...) that has a
|
|
|
eec4b3 |
virtual machine listening to "127.0.0.1", virt_viewer_is_reachable() must
|
|
|
eec4b3 |
take --direct into account, otherwise it can end up connecting to a local
|
|
|
eec4b3 |
virtual machine listening to "0.0.0.0" instead of returning that the
|
|
|
eec4b3 |
guest is not reachable.
|
|
|
eec4b3 |
|
|
|
eec4b3 |
Resolves: rhbz#1085216
|
|
|
eec4b3 |
(cherry picked from commit 21306d13f931153a6eb13f455ca7d8fedc800f78)
|
|
|
eec4b3 |
---
|
|
|
eec4b3 |
src/virt-viewer.c | 14 ++++++++------
|
|
|
eec4b3 |
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
eec4b3 |
|
|
|
eec4b3 |
diff --git a/src/virt-viewer.c b/src/virt-viewer.c
|
|
|
eec4b3 |
index ec7d875..aeed5c1 100644
|
|
|
eec4b3 |
--- a/src/virt-viewer.c
|
|
|
eec4b3 |
+++ b/src/virt-viewer.c
|
|
|
eec4b3 |
@@ -355,8 +355,10 @@ virt_viewer_is_loopback(const char *host)
|
|
|
eec4b3 |
|
|
|
eec4b3 |
|
|
|
eec4b3 |
static gboolean
|
|
|
eec4b3 |
-virt_viewer_is_reachable(const gchar *host, const char *transport,
|
|
|
eec4b3 |
- const char *transport_host)
|
|
|
eec4b3 |
+virt_viewer_is_reachable(const gchar *host,
|
|
|
eec4b3 |
+ const char *transport,
|
|
|
eec4b3 |
+ const char *transport_host,
|
|
|
eec4b3 |
+ gboolean direct)
|
|
|
eec4b3 |
{
|
|
|
eec4b3 |
gboolean host_is_loopback;
|
|
|
eec4b3 |
gboolean transport_is_loopback;
|
|
|
eec4b3 |
@@ -367,7 +369,7 @@ virt_viewer_is_reachable(const gchar *host, const char *transport,
|
|
|
eec4b3 |
if (!transport)
|
|
|
eec4b3 |
return TRUE;
|
|
|
eec4b3 |
|
|
|
eec4b3 |
- if (strcmp(transport, "ssh") == 0)
|
|
|
eec4b3 |
+ if (strcmp(transport, "ssh") == 0 && !direct)
|
|
|
eec4b3 |
return TRUE;
|
|
|
eec4b3 |
|
|
|
eec4b3 |
if (strcmp(transport, "unix") == 0)
|
|
|
eec4b3 |
@@ -402,6 +404,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
|
|
|
eec4b3 |
gchar *user = NULL;
|
|
|
eec4b3 |
gint port = 0;
|
|
|
eec4b3 |
gchar *uri = NULL;
|
|
|
eec4b3 |
+ gboolean direct = virt_viewer_app_get_direct(app);
|
|
|
eec4b3 |
|
|
|
eec4b3 |
virt_viewer_app_free_connect_info(app);
|
|
|
eec4b3 |
|
|
|
eec4b3 |
@@ -457,8 +460,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
|
|
|
eec4b3 |
*/
|
|
|
eec4b3 |
if (virt_viewer_replace_host(ghost)) {
|
|
|
eec4b3 |
gchar *replacement_host = NULL;
|
|
|
eec4b3 |
- if ((g_strcmp0(transport, "ssh") == 0)
|
|
|
eec4b3 |
- && !virt_viewer_app_get_direct(app)) {
|
|
|
eec4b3 |
+ if ((g_strcmp0(transport, "ssh") == 0) && !direct) {
|
|
|
eec4b3 |
replacement_host = g_strdup("localhost");
|
|
|
eec4b3 |
} else {
|
|
|
eec4b3 |
replacement_host = g_strdup(host);
|
|
|
eec4b3 |
@@ -469,7 +471,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
|
|
|
eec4b3 |
ghost = replacement_host;
|
|
|
eec4b3 |
}
|
|
|
eec4b3 |
|
|
|
eec4b3 |
- if (!virt_viewer_is_reachable(ghost, transport, host)) {
|
|
|
eec4b3 |
+ if (!virt_viewer_is_reachable(ghost, transport, host, direct)) {
|
|
|
eec4b3 |
g_debug("graphics listen '%s' is not reachable from this machine",
|
|
|
eec4b3 |
ghost ? ghost : "");
|
|
|
eec4b3 |
virt_viewer_app_simple_message_dialog(app, _("Guest '%s' is not reachable"),
|