From patchwork Thu Oct 7 07:55:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 67002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BE9E3B6EDF for ; Thu, 7 Oct 2010 18:58:10 +1100 (EST) Received: from localhost ([127.0.0.1]:47502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3lMd-0006zi-Rm for incoming@patchwork.ozlabs.org; Thu, 07 Oct 2010 03:58:07 -0400 Received: from [140.186.70.92] (port=36390 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3lKG-0006tk-J9 for qemu-devel@nongnu.org; Thu, 07 Oct 2010 03:55:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3lKB-0003hF-LR for qemu-devel@nongnu.org; Thu, 07 Oct 2010 03:55:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3lKB-0003gt-Dq for qemu-devel@nongnu.org; Thu, 07 Oct 2010 03:55:35 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o977tVho018075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 7 Oct 2010 03:55:31 -0400 Received: from rincewind.home.kraxel.org (vpn1-5-214.ams2.redhat.com [10.36.5.214]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o977tSTI032363; Thu, 7 Oct 2010 03:55:30 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 3CE0D4556A; Thu, 7 Oct 2010 09:55:27 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 7 Oct 2010 09:55:25 +0200 Message-Id: <1286438126-11250-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1286438126-11250-1-git-send-email-kraxel@redhat.com> References: <1286438126-11250-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 4/5] spice: add config options for the listening address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Make listening address configurable. Also add options to force using IPv4 or IPv6. --- qemu-config.c | 9 +++++++++ qemu-options.hx | 7 +++++++ ui/spice-core.c | 13 +++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/qemu-config.c b/qemu-config.c index f52e50c..5a62ae1 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -365,6 +365,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, },{ diff --git a/qemu-options.hx b/qemu-options.hx index bb45b67..f74e380 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -682,6 +682,13 @@ Enable the spice remote desktop protocol. Valid options are @item port= Set the TCP port spice is listening on for plaintext channels. +@item 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= Set the password you need to authenticate. diff --git a/ui/spice-core.c b/ui/spice-core.c index 8f73848..b7f2cb3 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -218,14 +218,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; @@ -275,7 +275,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); }