]> git.proxmox.com Git - qemu.git/commitdiff
spice: add config options for the listening address
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 27 Aug 2010 12:29:16 +0000 (14:29 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 8 Oct 2010 10:49:51 +0000 (12:49 +0200)
Make listening address configurable.  Also add options to
force using IPv4 or IPv6.

qemu-config.c
qemu-options.hx
ui/spice-core.c

index f52e50c377288e60493746c284e5f676075048fe..5a62ae131d60e20dd4440897cc20b39f0ef75059 100644 (file)
@@ -364,6 +364,15 @@ QemuOptsList qemu_spice_opts = {
         },{
             .name = "tls-port",
             .type = QEMU_OPT_NUMBER,
+        },{
+            .name = "addr",
+            .type = QEMU_OPT_STRING,
+        },{
+            .name = "ipv4",
+            .type = QEMU_OPT_BOOL,
+        },{
+            .name = "ipv6",
+            .type = QEMU_OPT_BOOL,
         },{
             .name = "password",
             .type = QEMU_OPT_STRING,
index 5a0d26b4742b115034bd20e81d7c555bf0a473fc..0410b90dce775c478f015381b6edc5c1adf08ae9 100644 (file)
@@ -682,6 +682,13 @@ Enable the spice remote desktop protocol. Valid options are
 @item port=<nr>
 Set the TCP port spice is listening on for plaintext channels.
 
+@item addr=<addr>
+Set the IP address spice is listening on.  Default is any address.
+
+@item ipv4
+@item ipv6
+Force using the specified IP version.
+
 @item password=<secret>
 Set the password you need to authenticate.
 
index 7664ef770006c34bdb17968b5113a8dd13218034..6f613c6324eca3f4ff748ffcfbbeb9de79845cb7 100644 (file)
@@ -221,14 +221,14 @@ static int add_channel(const char *name, const char *value, void *opaque)
 void qemu_spice_init(void)
 {
     QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);
-    const char *password, *str, *x509_dir,
+    const char *password, *str, *x509_dir, *addr,
         *x509_key_password = NULL,
         *x509_dh_file = NULL,
         *tls_ciphers = NULL;
     char *x509_key_file = NULL,
         *x509_cert_file = NULL,
         *x509_cacert_file = NULL;
-    int port, tls_port, len;
+    int port, tls_port, len, addr_flags;
     spice_image_compression_t compression;
     spice_wan_compression_t wan_compr;
 
@@ -278,7 +278,16 @@ void qemu_spice_init(void)
         tls_ciphers = qemu_opt_get(opts, "tls-ciphers");
     }
 
+    addr = qemu_opt_get(opts, "addr");
+    addr_flags = 0;
+    if (qemu_opt_get_bool(opts, "ipv4", 0)) {
+        addr_flags |= SPICE_ADDR_FLAG_IPV4_ONLY;
+    } else if (qemu_opt_get_bool(opts, "ipv6", 0)) {
+        addr_flags |= SPICE_ADDR_FLAG_IPV6_ONLY;
+    }
+
     spice_server = spice_server_new();
+    spice_server_set_addr(spice_server, addr ? addr : "", addr_flags);
     if (port) {
         spice_server_set_port(spice_server, port);
     }