From nobody Fri May 16 22:59:21 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 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