|
Hans de Goede |
56753f |
From 6594551ebe427cae4298b038be02ddc9c335219f Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
56753f |
From: Yonit Halperin <yhalperi@redhat.com>
|
|
Hans de Goede |
56753f |
Date: Wed, 8 Feb 2012 15:40:15 +0200
|
|
Hans de Goede |
56753f |
Subject: [PATCH 408/434] spice: support ipv6 channel address in monitor
|
|
Hans de Goede |
56753f |
events and in spice info
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
RHBZ #788444
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
CC: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
|
|
Hans de Goede |
56753f |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
56753f |
---
|
|
Hans de Goede |
56753f |
ui/spice-core.c | 37 ++++++++++++++++++++++++++++++++-----
|
|
Hans de Goede |
56753f |
1 file changed, 32 insertions(+), 5 deletions(-)
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
diff --git a/ui/spice-core.c b/ui/spice-core.c
|
|
Hans de Goede |
56753f |
index d98863e..27216e9 100644
|
|
Hans de Goede |
56753f |
--- a/ui/spice-core.c
|
|
Hans de Goede |
56753f |
+++ b/ui/spice-core.c
|
|
Hans de Goede |
56753f |
@@ -220,10 +220,23 @@ static void channel_event(int event, SpiceChannelEventInfo *info)
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
client = qdict_new();
|
|
Hans de Goede |
56753f |
- add_addr_info(client, &info->paddr, info->plen);
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
server = qdict_new();
|
|
Hans de Goede |
56753f |
- add_addr_info(server, &info->laddr, info->llen);
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
|
|
Hans de Goede |
56753f |
+ if (info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
|
|
Hans de Goede |
56753f |
+ add_addr_info(client, (struct sockaddr *)&info->paddr_ext,
|
|
Hans de Goede |
56753f |
+ info->plen_ext);
|
|
Hans de Goede |
56753f |
+ add_addr_info(server, (struct sockaddr *)&info->laddr_ext,
|
|
Hans de Goede |
56753f |
+ info->llen_ext);
|
|
Hans de Goede |
56753f |
+ } else {
|
|
Hans de Goede |
56753f |
+ fprintf(stderr, "spice: %s, extended address is expected\n",
|
|
Hans de Goede |
56753f |
+ __func__);
|
|
Hans de Goede |
56753f |
+#endif
|
|
Hans de Goede |
56753f |
+ add_addr_info(client, &info->paddr, info->plen);
|
|
Hans de Goede |
56753f |
+ add_addr_info(server, &info->laddr, info->llen);
|
|
Hans de Goede |
56753f |
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+#endif
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
if (event == SPICE_CHANNEL_EVENT_INITIALIZED) {
|
|
Hans de Goede |
56753f |
qdict_put(server, "auth", qstring_from_str(auth));
|
|
Hans de Goede |
56753f |
@@ -376,16 +389,30 @@ static SpiceChannelList *qmp_query_spice_channels(void)
|
|
Hans de Goede |
56753f |
QTAILQ_FOREACH(item, &channel_list, link) {
|
|
Hans de Goede |
56753f |
SpiceChannelList *chan;
|
|
Hans de Goede |
56753f |
char host[NI_MAXHOST], port[NI_MAXSERV];
|
|
Hans de Goede |
56753f |
+ struct sockaddr *paddr;
|
|
Hans de Goede |
56753f |
+ socklen_t plen;
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
chan = g_malloc0(sizeof(*chan));
|
|
Hans de Goede |
56753f |
chan->value = g_malloc0(sizeof(*chan->value));
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
- getnameinfo(&item->info->paddr, item->info->plen,
|
|
Hans de Goede |
56753f |
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
|
|
Hans de Goede |
56753f |
+ if (item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
|
|
Hans de Goede |
56753f |
+ paddr = (struct sockaddr *)&item->info->paddr_ext;
|
|
Hans de Goede |
56753f |
+ plen = item->info->plen_ext;
|
|
Hans de Goede |
56753f |
+ } else {
|
|
Hans de Goede |
56753f |
+#endif
|
|
Hans de Goede |
56753f |
+ paddr = &item->info->paddr;
|
|
Hans de Goede |
56753f |
+ plen = item->info->plen;
|
|
Hans de Goede |
56753f |
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+#endif
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ getnameinfo(paddr, plen,
|
|
Hans de Goede |
56753f |
host, sizeof(host), port, sizeof(port),
|
|
Hans de Goede |
56753f |
NI_NUMERICHOST | NI_NUMERICSERV);
|
|
Hans de Goede |
56753f |
chan->value->host = g_strdup(host);
|
|
Hans de Goede |
56753f |
chan->value->port = g_strdup(port);
|
|
Hans de Goede |
56753f |
- chan->value->family = g_strdup(inet_strfamily(item->info->paddr.sa_family));
|
|
Hans de Goede |
56753f |
+ chan->value->family = g_strdup(inet_strfamily(paddr->sa_family));
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
chan->value->connection_id = item->info->connection_id;
|
|
Hans de Goede |
56753f |
chan->value->channel_type = item->info->type;
|
|
Hans de Goede |
56753f |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|