From nobody Fri May 3 11:20:15 2024 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 1495233474247649.3895717195436; Fri, 19 May 2017 15:37:54 -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 99766C0467D9; Fri, 19 May 2017 22:37:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75E9718A22; Fri, 19 May 2017 22:37:52 +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 F3B7E4A48D; Fri, 19 May 2017 22:37:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4JMYCls024435 for ; Fri, 19 May 2017 18:34:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6067C1713F; Fri, 19 May 2017 22:34:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B4C762921 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 07B6E80468 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:03 -0600 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 99766C0467D9 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx07.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 99766C0467D9 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 07B6E80468 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jfehlig@suse.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 07B6E80468 From: Jim Fehlig To: libvir-list@redhat.com Date: Fri, 19 May 2017 16:33:40 -0600 Message-Id: <20170519223341.5090-2-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.28]); Fri, 19 May 2017 22:34:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); 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.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH V2 1/2] maint: define a macro for IPv4 loopback address 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.31]); Fri, 19 May 2017 22:37:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use a macro instead of hardcoding "127.0.0.1" throughout the sources. Signed-off-by: Jim Fehlig Reviewed-by: Joao Martins --- src/internal.h | 2 ++ src/qemu/qemu_conf.c | 4 ++-- src/util/virsocketaddr.c | 4 ++-- src/vz/vz_sdk.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/internal.h b/src/internal.h index 9e7ef553d..03a973ccd 100644 --- a/src/internal.h +++ b/src/internal.h @@ -79,6 +79,8 @@ # define INET_ADDRSTRLEN 16 # endif =20 +# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" + /* String equality tests, suggested by Jim Meyering. */ # define STREQ(a, b) (strcmp(a, b) =3D=3D 0) # define STRCASEEQ(a, b) (c_strcasecmp(a, b) =3D=3D 0) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 1b704daa5..19ddf787d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -250,10 +250,10 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool pr= ivileged) SYSCONFDIR "/pki/qemu") < 0) goto error; =20 - if (VIR_STRDUP(cfg->vncListen, "127.0.0.1") < 0) + if (VIR_STRDUP(cfg->vncListen, VIR_LOOPBACK_IPV4_ADDR) < 0) goto error; =20 - if (VIR_STRDUP(cfg->spiceListen, "127.0.0.1") < 0) + if (VIR_STRDUP(cfg->spiceListen, VIR_LOOPBACK_IPV4_ADDR) < 0) goto error; =20 /* diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index 41f75d5c2..9dffbc736 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -383,11 +383,11 @@ virSocketAddrFormatFull(const virSocketAddr *addr, * nicely for UNIX sockets */ if (addr->data.sa.sa_family =3D=3D AF_UNIX) { if (withService) { - if (virAsprintf(&addrstr, "127.0.0.1%s0", + if (virAsprintf(&addrstr, VIR_LOOPBACK_IPV4_ADDR"%s0", separator ? separator : ":") < 0) goto error; } else { - if (VIR_STRDUP(addrstr, "127.0.0.1") < 0) + if (VIR_STRDUP(addrstr, VIR_LOOPBACK_IPV4_ADDR) < 0) goto error; } return addrstr; diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 4d2c6b0f1..4fab3b9bf 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -3084,7 +3084,7 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdo= m, =20 glisten =3D virDomainGraphicsGetListen(gr, 0); pret =3D PrlVmCfg_SetVNCHostName(sdkdom, glisten && glisten->address ? - glisten->address : "127.0.0.1"); + glisten->address : VIR_LOOPBACK= _IPV4_ADDR); prlsdkCheckRetGoto(pret, cleanup); =20 ret =3D 0; --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 11:20:15 2024 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