diff mbox

spice: return unspecified address according to protocol

Message ID 1399653553-5978-1-git-send-email-akong@redhat.com
State New
Headers show

Commit Message

Amos Kong May 9, 2014, 4:39 p.m. UTC
Commit 4f60af9a changed '0.0.0.0' to '*' to indicate unspecified
address.

"::" is used to indicate unspecified address in IPV6.

This patch returns different address for different protocol,
it's more meaningful for the protocol specification than returning '*'.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 ui/spice-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Gerd Hoffmann May 12, 2014, 9:34 a.m. UTC | #1
Hi,

>      info->has_host = true;
> -    info->host = g_strdup(addr ? addr : "*");
> +    info->host = g_strdup(addr ? addr : (qemu_opt_get_bool(opts,
> +                                                           "ipv6", 0)
> +                                         ? "::" : "0.0.0.0"));

"ipv6" means "force ipv6".  If the option is not present spice-server
might still listen on ipv6, and qemu can't easily figure whenever that
is the case or not.

cheers,
  Gerd
Amos Kong May 12, 2014, 10:06 a.m. UTC | #2
On Mon, May 12, 2014 at 11:34:18AM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> >      info->has_host = true;
> > -    info->host = g_strdup(addr ? addr : "*");
> > +    info->host = g_strdup(addr ? addr : (qemu_opt_get_bool(opts,
> > +                                                           "ipv6", 0)
> > +                                         ? "::" : "0.0.0.0"));
> 
> "ipv6" means "force ipv6".  If the option is not present spice-server
> might still listen on ipv6, and qemu can't easily figure whenever that
> is the case or not.

OK. And management will not use this returned address, so it's
not a serious issue.

Thanks. NAK this patch.
 
> cheers,
>   Gerd
> 
>
Markus Armbruster May 12, 2014, 12:38 p.m. UTC | #3
Amos Kong <akong@redhat.com> writes:

> On Mon, May 12, 2014 at 11:34:18AM +0200, Gerd Hoffmann wrote:
>>   Hi,
>> 
>> >      info->has_host = true;
>> > -    info->host = g_strdup(addr ? addr : "*");
>> > +    info->host = g_strdup(addr ? addr : (qemu_opt_get_bool(opts,
>> > +                                                           "ipv6", 0)
>> > +                                         ? "::" : "0.0.0.0"));
>> 
>> "ipv6" means "force ipv6".  If the option is not present spice-server
>> might still listen on ipv6, and qemu can't easily figure whenever that
>> is the case or not.
>
> OK. And management will not use this returned address, so it's
> not a serious issue.
>
> Thanks. NAK this patch.

Thanks for trying, Amos.  The "*" is ugly... but I have no better ideas,
either.
diff mbox

Patch

diff --git a/ui/spice-core.c b/ui/spice-core.c
index d10818a..929c405 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -533,7 +533,9 @@  SpiceInfo *qmp_query_spice(Error **errp)
     info->auth = g_strdup(auth);
 
     info->has_host = true;
-    info->host = g_strdup(addr ? addr : "*");
+    info->host = g_strdup(addr ? addr : (qemu_opt_get_bool(opts,
+                                                           "ipv6", 0)
+                                         ? "::" : "0.0.0.0"));
 
     info->has_compiled_version = true;
     major = (SPICE_SERVER_VERSION & 0xff0000) >> 16;