* [Qemu-devel] [PATCH] spice: support ipv6 channel address in monitor events and in spice info
@ 2012-02-08 13:40 Yonit Halperin
2012-02-10 11:23 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Yonit Halperin @ 2012-02-08 13:40 UTC (permalink / raw)
To: qemu-devel, spice-devel; +Cc: Yonit Halperin, kraxel
RHBZ #788444
CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
---
ui/spice-core.c | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 5639c6f..60fd6c3 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -220,10 +220,23 @@ static void channel_event(int event, SpiceChannelEventInfo *info)
}
client = qdict_new();
- add_addr_info(client, &info->paddr, info->plen);
-
server = qdict_new();
- add_addr_info(server, &info->laddr, info->llen);
+
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ if (info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
+ add_addr_info(client, (struct sockaddr *)&info->paddr_ext,
+ info->plen_ext);
+ add_addr_info(server, (struct sockaddr *)&info->laddr_ext,
+ info->llen_ext);
+ } else {
+ fprintf(stderr, "spice: %s, extended address is expected\n",
+ __func__);
+#endif
+ add_addr_info(client, &info->paddr, info->plen);
+ add_addr_info(server, &info->laddr, info->llen);
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ }
+#endif
if (event == SPICE_CHANNEL_EVENT_INITIALIZED) {
qdict_put(server, "auth", qstring_from_str(auth));
@@ -376,16 +389,30 @@ static SpiceChannelList *qmp_query_spice_channels(void)
QTAILQ_FOREACH(item, &channel_list, link) {
SpiceChannelList *chan;
char host[NI_MAXHOST], port[NI_MAXSERV];
+ struct sockaddr *paddr;
+ socklen_t plen;
chan = g_malloc0(sizeof(*chan));
chan->value = g_malloc0(sizeof(*chan->value));
- getnameinfo(&item->info->paddr, item->info->plen,
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ if (item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
+ paddr = (struct sockaddr *)&item->info->paddr_ext;
+ plen = item->info->plen_ext;
+ } else {
+#endif
+ paddr = &item->info->paddr;
+ plen = item->info->plen;
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ }
+#endif
+
+ getnameinfo(paddr, plen,
host, sizeof(host), port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV);
chan->value->host = g_strdup(host);
chan->value->port = g_strdup(port);
- chan->value->family = g_strdup(inet_strfamily(item->info->paddr.sa_family));
+ chan->value->family = g_strdup(inet_strfamily(paddr->sa_family));
chan->value->connection_id = item->info->connection_id;
chan->value->channel_type = item->info->type;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] spice: support ipv6 channel address in monitor events and in spice info
2012-02-08 13:40 [Qemu-devel] [PATCH] spice: support ipv6 channel address in monitor events and in spice info Yonit Halperin
@ 2012-02-10 11:23 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2012-02-10 11:23 UTC (permalink / raw)
To: Yonit Halperin; +Cc: qemu-devel, spice-devel
On 02/08/12 14:40, Yonit Halperin wrote:
> RHBZ #788444
Looks good. Well, the #ifdef mess isn't exactly pretty, but I have no
idea how it could be done better. Ping me when the spice server patch
is committed, I'll go queue this patch for qemu then.
thanks,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-10 11:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08 13:40 [Qemu-devel] [PATCH] spice: support ipv6 channel address in monitor events and in spice info Yonit Halperin
2012-02-10 11:23 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).