From nobody Fri May 16 23:32:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495233479505702.7388392997923; Fri, 19 May 2017 15:37:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3036B3D944; Fri, 19 May 2017 22:37:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D80218A25; Fri, 19 May 2017 22:37:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BDC08180BAF2; Fri, 19 May 2017 22:37:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4JMYC5s024437 for ; Fri, 19 May 2017 18:34:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7162F17C1A; Fri, 19 May 2017 22:34:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C8B65DC1D for ; Fri, 19 May 2017 22:34:10 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F07081252 for ; Fri, 19 May 2017 22:34:06 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Fri, 19 May 2017 16:34:04 -0600 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3036B3D944 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3036B3D944 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0F07081252 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jfehlig@suse.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0F07081252 From: Jim Fehlig To: libvir-list@redhat.com Date: Fri, 19 May 2017 16:33:41 -0600 Message-Id: <20170519223341.5090-3-jfehlig@suse.com> In-Reply-To: <20170519223341.5090-1-jfehlig@suse.com> References: <20170519223341.5090-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 19 May 2017 22:34:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 19 May 2017 22:34:06 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -1.501 (BAYES_50, RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH V2 2/2] libxl: add default listen address for VNC and spice X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 19 May 2017 22:37:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If a VNC listen address is not specified in domXML, libxl will default to 127.0.0.1, but this is never reflected in the domXML. In the case of spice, a missing listen address resulted in listening on all interfaces, i.e. '0.0.0.0'. If not specified, set the listen address in virDomainGraphicsDef struct to the libxl default when creating the frame buffer device. Additionally, set default spice listen address to 127.0.0.1. Signed-off-by: Jim Fehlig Reviewed-by: Joao Martins --- V2: include setting the listen address for spice as well as VNC src/libxl/libxl_conf.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 56bc09719..b04dffcfa 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1227,13 +1227,18 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports, } x_vfb->vnc.display =3D l_vfb->data.vnc.port - LIBXL_VNC_PORT_M= IN; =20 - if ((glisten =3D virDomainGraphicsGetListen(l_vfb, 0)) && - glisten->address) { - /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */ - VIR_FREE(x_vfb->vnc.listen); - if (VIR_STRDUP(x_vfb->vnc.listen, glisten->address) < 0) - return -1; + if ((glisten =3D virDomainGraphicsGetListen(l_vfb, 0))) { + if (glisten->address) { + /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1"= ) */ + VIR_FREE(x_vfb->vnc.listen); + if (VIR_STRDUP(x_vfb->vnc.listen, glisten->address) < = 0) + return -1; + } else { + if (VIR_STRDUP(glisten->address, VIR_LOOPBACK_IPV4_ADD= R) < 0) + return -1; + } } + if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd)= < 0) return -1; if (VIR_STRDUP(x_vfb->keymap, l_vfb->data.vnc.keymap) < 0) @@ -1335,10 +1340,16 @@ libxlMakeBuildInfoVfb(virPortAllocatorPtr graphicsp= orts, } b_info->u.hvm.spice.port =3D l_vfb->data.spice.port; =20 - if ((glisten =3D virDomainGraphicsGetListen(l_vfb, 0)) && - glisten->address && - VIR_STRDUP(b_info->u.hvm.spice.host, glisten->address) < 0) - return -1; + if ((glisten =3D virDomainGraphicsGetListen(l_vfb, 0))) { + if (glisten->address) { + if (VIR_STRDUP(b_info->u.hvm.spice.host, glisten->address)= < 0) + return -1; + } else { + if (VIR_STRDUP(b_info->u.hvm.spice.host, VIR_LOOPBACK_IPV4= _ADDR) < 0 || + VIR_STRDUP(glisten->address, VIR_LOOPBACK_IPV4_ADDR) <= 0) + return -1; + } + } =20 if (VIR_STRDUP(b_info->u.hvm.keymap, l_vfb->data.spice.keymap) < 0) return -1; --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list