From nobody Mon Feb 2 05:59:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769437470; cv=none; d=zohomail.com; s=zohoarc; b=TCzyJzEqJxDpl7q9xURZ6kpeXYPTRsgcd99WnsrchUYz7qKSEFS2HU6QW8O4O/lcMUf/fStlTzISbhZrDIpokvMwGa1U70JG4FFOGTlDMA16CRrGl9cZXAmjXl8d+gQir3DDbPV55FBYGjjR3wPcKf9QiqiZroM5Yk3nmQBJ5OE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769437470; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=01XahbHtgnGR4z33JkoNvSCgV4iNtSahQvTmGbktgOg=; b=bIE2JXzjHZ5FqPBhXlKwynauBssr0y4XPGzFwCtt7Kz8gmWJmuBuLakBOXdBzfFblnu+VUkH68NdMO3p20lmt3PjeyYLxT81svgekg0L4Q64k+14tVM/Uig44ACfTm7lFs4QHLmgKc3oB4kjXV6fhTeKPdhGrlip9cLHX69ZXNY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769437470906610.8737724329093; Mon, 26 Jan 2026 06:24:30 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id E90A841AEC; Mon, 26 Jan 2026 09:24:29 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 72F0643DCF; Mon, 26 Jan 2026 09:23:15 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 008DD4196E; Mon, 26 Jan 2026 09:23:09 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7E35A41969 for ; Mon, 26 Jan 2026 09:23:09 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-551-S1VSZzl_NsmRgRo_wVLQEw-1; Mon, 26 Jan 2026 09:23:07 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F074C1956096 for ; Mon, 26 Jan 2026 14:23:06 +0000 (UTC) Received: from dosh.home.annexia.org.com (unknown [10.45.226.197]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E6FFF1800285; Mon, 26 Jan 2026 14:23:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769437389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=01XahbHtgnGR4z33JkoNvSCgV4iNtSahQvTmGbktgOg=; b=XHS6wofdaJbz+JWBs/LHFpAY5eIZpHD+rkbyDY9S0dKDao3UlIyi4b3SCT7pJKJiIixoDi liZGxeBRHoe/ozdRTN3YfbJcx/9tY/Ea4FIbXE8Bf8iA5jShi5aU7XrMBXdaSQt2nwstkA W7GPSMcbXlNc6JDiuUIVnN0a8dOby/I= X-MC-Unique: S1VSZzl_NsmRgRo_wVLQEw-1 X-Mimecast-MFC-AGG-ID: S1VSZzl_NsmRgRo_wVLQEw_1769437387 To: devel@lists.libvirt.org Subject: [PATCH v2 1/3] esx: Debug URL just before opening with curl Date: Mon, 26 Jan 2026 14:22:50 +0000 Message-ID: <20260126142300.1518327-2-rjones@redhat.com> In-Reply-To: <20260126142300.1518327-1-rjones@redhat.com> References: <20260126142300.1518327-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: rVCb9PUZYYBQ8or6tc1GODh74_2bfw-avnMnnW33s0g_1769437387 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2HH7FVOTK3N22K5LH5XI37JBNGOG6AS3 X-Message-ID-Hash: 2HH7FVOTK3N22K5LH5XI37JBNGOG6AS3 X-MailFrom: rjones@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: mprivozn@redhat.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Richard W.M. Jones via Devel" Reply-To: "Richard W.M. Jones" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769437472873158500 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Richard W.M. Jones Reported-by and Reviewed-by tags on the last commit. Reviewed-by: Michal Privoznik --- src/esx/esx_vi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 3264afc13a..8d2ffb3f8f 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -231,6 +231,8 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url) long responseCode =3D 0; const char *redirectUrl =3D NULL; =20 + VIR_DEBUG("URL: %s", url); + errorCode =3D curl_easy_perform(curl->handle); =20 if (errorCode !=3D CURLE_OK) { --=20 2.52.0 From nobody Mon Feb 2 05:59:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769437506; cv=none; d=zohomail.com; s=zohoarc; b=OruJ1BEB9FJZKTyOskWbXnvH2dOMJpYiPtT3/USGgiVzfTaFjVKgbbCObWcUlsNCm7QB2TFmO0iXwCJByX6m1kSnUpj6gl9bJ9ia30EZ1uXBYB8Jo9XETq/jAjPeS1w7JydMt5kdy9BFbf91oJqbGdkGwCdg8DGGgtkdWKQ4Z1c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769437506; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=OlyUHu5utIjqS1W4WekM27P0mioayVcMvxmEInMYkX0=; b=m7MvN8stPTMzMtbVdnNhc2XwCwlj+kygBajO6hC7BU6f+vWS+NIb+mdm42nXaB8UsSYdJNrdZgEzD0KKKIzHSviFpkyENlFXAJCd1AfnCBK85lmI4h3j5ne7lCLKaXOGFaz49jyXGwOQFf7eON9/F7Wal23c7nd0iGvF1mV4EnA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769437506718482.1040435479566; Mon, 26 Jan 2026 06:25:06 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id BB56841B83; Mon, 26 Jan 2026 09:25:05 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id B6A2543E35; Mon, 26 Jan 2026 09:23:16 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 62B6041969; Mon, 26 Jan 2026 09:23:11 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DD82F418CA for ; Mon, 26 Jan 2026 09:23:10 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-Ez1jmk7kOYuG4uBfRiWrhQ-1; Mon, 26 Jan 2026 09:23:09 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A5B2A18003FD for ; Mon, 26 Jan 2026 14:23:08 +0000 (UTC) Received: from dosh.home.annexia.org.com (unknown [10.45.226.197]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9E287180009E; Mon, 26 Jan 2026 14:23:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769437390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OlyUHu5utIjqS1W4WekM27P0mioayVcMvxmEInMYkX0=; b=WRePnxBSvZfIcG57dmwk+9WUHI15egQYClEfmKc4cgK2u/4xSZF7bkT2D1YdY+yp0gBlM7 z9hoE/aCAUlK7ffEbYNhvAWLxNtEQk4tLgOBDgqgsljgXmVXxujg+nIsDBRy/VGENrpCAh aBmYcxCZivOwkq2KN9eum++BkhBa7bI= X-MC-Unique: Ez1jmk7kOYuG4uBfRiWrhQ-1 X-Mimecast-MFC-AGG-ID: Ez1jmk7kOYuG4uBfRiWrhQ_1769437388 To: devel@lists.libvirt.org Subject: [PATCH v2 2/3] esx: Abstract all URL-creation code into two functions Date: Mon, 26 Jan 2026 14:22:51 +0000 Message-ID: <20260126142300.1518327-3-rjones@redhat.com> In-Reply-To: <20260126142300.1518327-1-rjones@redhat.com> References: <20260126142300.1518327-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: PtpxUSN94az_iPqKp99Yq7IycN8ue4GrhsZKyZ9sbX8_1769437388 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: OTSKF5Y633RLC22KWQKRQZKQLSTE4WYM X-Message-ID-Hash: OTSKF5Y633RLC22KWQKRQZKQLSTE4WYM X-MailFrom: rjones@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: mprivozn@redhat.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Richard W.M. Jones via Devel" Reply-To: "Richard W.M. Jones" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769437508962158500 Content-Type: text/plain; charset="utf-8"; x-default="true" Abstract the places where we create URLs into one place (but actually into two functions because of how URLs are used). Signed-off-by: Richard W.M. Jones Reported-by and Reviewed-by tags on the last commit. Reviewed-by: Michal Privoznik --- src/esx/esx_driver.c | 55 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 02f30c2b19..8d7c58c88f 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -582,7 +582,39 @@ esxCapsInit(esxPrivate *priv) return NULL; } =20 +static char * +esxCreateURL(const char *transport, + const char *server, + int port, + const char *path) +{ + char *url; =20 + url =3D g_strdup_printf("%s://%s:%d/%s", + transport, + server, + port, + path); + return url; +} + +static void +esxCreateURLBuffer(virBuffer *buffer, + const char *transport, + const char *server, + int port, + const char *path) +{ + /* Same as above, but add it to a buffer because the calling code + * will append query strings etc. + */ + virBufferAsprintf(buffer, + "%s://%s:%d/%s", + transport, + server, + port, + path); +} =20 static int esxConnectToHost(esxPrivate *priv, @@ -619,8 +651,8 @@ esxConnectToHost(esxPrivate *priv, conn->uri->server))) goto cleanup; =20 - url =3D g_strdup_printf("%s://%s:%d/sdk", priv->parsedUri->transport, - conn->uri->server, conn->uri->port); + url =3D esxCreateURL(priv->parsedUri->transport, + conn->uri->server, conn->uri->port, "sdk"); =20 if (esxVI_Context_Alloc(&priv->host) < 0 || esxVI_Context_Connect(priv->host, url, ipAddress, username, passwo= rd, @@ -706,8 +738,8 @@ esxConnectToVCenter(esxPrivate *priv, if (!(password =3D virAuthGetPassword(conn, auth, "esx", username, hos= tname))) return -1; =20 - url =3D g_strdup_printf("%s://%s:%d/sdk", priv->parsedUri->transport, = hostname, - conn->uri->port); + url =3D esxCreateURL(priv->parsedUri->transport, hostname, + conn->uri->port, "sdk"); =20 if (esxVI_Context_Alloc(&priv->vCenter) < 0 || esxVI_Context_Connect(priv->vCenter, url, ipAddress, username, @@ -2357,8 +2389,9 @@ esxDomainScreenshot(virDomainPtr domain, virStreamPtr= stream, } =20 /* Build URL */ - virBufferAsprintf(&buffer, "%s://%s:%d/screen?id=3D", priv->parsedUri-= >transport, - domain->conn->uri->server, domain->conn->uri->port); + esxCreateURLBuffer(&buffer, priv->parsedUri->transport, + domain->conn->uri->server, domain->conn->uri->port, + "screen?id=3D"); virBufferURIEncodeString(&buffer, virtualMachine->obj->value); =20 url =3D virBufferContentAndReset(&buffer); @@ -2563,8 +2596,9 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int= flags) goto cleanup; } =20 - virBufferAsprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->tran= sport, - domain->conn->uri->server, domain->conn->uri->port); + esxCreateURLBuffer(&buffer, priv->parsedUri->transport, + domain->conn->uri->server, domain->conn->uri->port, + "folder/"); virBufferURIEncodeString(&buffer, directoryAndFileName); virBufferAddLit(&buffer, "?dcPath=3D"); esxUtil_EscapeInventoryObject(&buffer, priv->primary->datacenterPath); @@ -2987,8 +3021,9 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const cha= r *xml, unsigned int flags) goto cleanup; } =20 - virBufferAsprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->tran= sport, - conn->uri->server, conn->uri->port); + esxCreateURLBuffer(&buffer, priv->parsedUri->transport, + conn->uri->server, conn->uri->port, + "folder/"); =20 if (directoryName) { virBufferURIEncodeString(&buffer, directoryName); --=20 2.52.0 From nobody Mon Feb 2 05:59:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769437548; cv=none; d=zohomail.com; s=zohoarc; b=dAEYgLJYVCBgNPdOSHInS0loidob5Y9UJG64woZslh900WV2SAO027rRdcU41h6gJPOdT5RS3O/6HIPs1SoMYGBeVoAViQtrhdXEEfQa9E+6W/A6i0nyD5yb0Q+Jnd6iOXFd0bd8+eksQ/3tTrcdBLr0uXT48r9sURbfGtWc1RA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769437548; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=GCDoWoWLFOI1fsdgwLcZXT4Kad7DXeXTVUxPhOakB5E=; b=fpFC4PjIKRSLgxUY9K4RZID3UR7UPVJY9KbHdfnY8Wn8WEoqk34K4ZNg679R5/wzZLX+xPEik/m4pHEPogkUYVw5BI5ltDy218naUyuvmPEyAcVygVwHwvtlgWkMaunxYHNByHN4PYf3pD5A0D3cfxkr8PFoxfkFfQ0UeIPjuM0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769437548952915.0327902928934; Mon, 26 Jan 2026 06:25:48 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 295FD4196F; Mon, 26 Jan 2026 09:25:48 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 16A8843E9A; Mon, 26 Jan 2026 09:23:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 56AE541AEC; Mon, 26 Jan 2026 09:23:23 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CB56641AB1 for ; Mon, 26 Jan 2026 09:23:12 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-522-vB6aB0zxMwSD4WRZgNtF8w-1; Mon, 26 Jan 2026 09:23:11 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B71B19775A7 for ; Mon, 26 Jan 2026 14:23:10 +0000 (UTC) Received: from dosh.home.annexia.org.com (unknown [10.45.226.197]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 33C7018007D2; Mon, 26 Jan 2026 14:23:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769437392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GCDoWoWLFOI1fsdgwLcZXT4Kad7DXeXTVUxPhOakB5E=; b=YR2ZblrFQ/zQKVU4BBhEgT8dl0LbnS+r5yl6XQqnPsdLGV8onTu2JRDuGLOxyEkmd7pAYI 6qKe6iwEDrM4am0c2T1PYa+al1ZOidrpJxYpBBpuSVgKZyYr18VPTZItJAk9r5rqUUY4tv mxysIj/hXqYVFGZo4Cw+CqivchNfkDA= X-MC-Unique: vB6aB0zxMwSD4WRZgNtF8w-1 X-Mimecast-MFC-AGG-ID: vB6aB0zxMwSD4WRZgNtF8w_1769437390 To: devel@lists.libvirt.org Subject: [PATCH v2 3/3] esx: Form URLs containing IPv6 addresses correctly Date: Mon, 26 Jan 2026 14:22:52 +0000 Message-ID: <20260126142300.1518327-4-rjones@redhat.com> In-Reply-To: <20260126142300.1518327-1-rjones@redhat.com> References: <20260126142300.1518327-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: WIM7JZEPt5IOpLaASiHad2sUY69KCkHWCR3zN_MdRYs_1769437390 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6JBO37QOQUT2I7V64Y7OHVLKJTSGB62D X-Message-ID-Hash: 6JBO37QOQUT2I7V64Y7OHVLKJTSGB62D X-MailFrom: rjones@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: mprivozn@redhat.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Richard W.M. Jones via Devel" Reply-To: "Richard W.M. Jones" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769437551936154100 Content-Type: text/plain; charset="utf-8"; x-default="true" When creating a URL to pass to curl, if the server name is an IPv6 address, enclose it in '[...]', for example forming a URL like: https://[1234:56:0:789a:bcde:72ff:fe0a:7baa]:443/sdk Fixes: https://issues.redhat.com/browse/RHEL-138300 Updates: commit 845210011a9ffd9d17e30c51cbc81ba67c5d3166 Reported-by: Ming Xie Signed-off-by: Richard W.M. Jones Reviewed-by: Michal Privoznik Reported-by and Reviewed-by tags on the last commit. --- src/esx/esx_driver.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 8d7c58c88f..208077eeda 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -582,6 +582,19 @@ esxCapsInit(esxPrivate *priv) return NULL; } =20 +static bool +esxServerIsIPv6(const char *server) +{ + size_t i; + const size_t n =3D strlen(server); + + for (i =3D 0; i < n; ++i) { + if (!g_ascii_isxdigit(server[i]) && server[i] !=3D ':') + return false; + } + return true; +} + static char * esxCreateURL(const char *transport, const char *server, @@ -589,10 +602,13 @@ esxCreateURL(const char *transport, const char *path) { char *url; + const bool is_ipv6 =3D esxServerIsIPv6(server); =20 - url =3D g_strdup_printf("%s://%s:%d/%s", + url =3D g_strdup_printf("%s://%s%s%s:%d/%s", transport, + is_ipv6 ? "[" : "", server, + is_ipv6 ? "]" : "", port, path); return url; @@ -605,13 +621,17 @@ esxCreateURLBuffer(virBuffer *buffer, int port, const char *path) { + const bool is_ipv6 =3D esxServerIsIPv6(server); + /* Same as above, but add it to a buffer because the calling code * will append query strings etc. */ virBufferAsprintf(buffer, - "%s://%s:%d/%s", + "%s://%s%s%s:%d/%s", transport, + is_ipv6 ? "[" : "", server, + is_ipv6 ? "]" : "", port, path); } --=20 2.52.0