From nobody Mon Feb 2 06:00:50 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=1769425840; cv=none; d=zohomail.com; s=zohoarc; b=mRPcVVE/VQX5scnta+lMtbscvF127z5Boqg1m1DeSAGxCCrMTQ9VNnkqtYvW4EsKrIoeYw54y5zaHUpZ3Nmh7nhAAkcpj7e36EgFZks/YmhTBx7Ltgk4tY7+/P+Jju89PcHLtPsQqVc7+2q9HU7Zq6h8s2BmyDgyj/miOtVe5tc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769425840; 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=+aosotRhT9MEK76EfL5rgbVlcSPlgiSz3jHldV5WUOA=; b=S1GU+lLxOdtMYrqa8H5XN30djh4dCgckgcqOjq+Z81uT4Rc2StXt1o6F1WK9SyNo50SK6L1tdoTa3IuommguDeaFCaUpuKAj4XkgUbebUmI4GOYfzpivQ7utWWhwPyM/QcXGiiPpM4GtVSsmORSq6XrsqjrwogVs8SE7VHfIxoA= 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 1769425840140825.8164512202766; Mon, 26 Jan 2026 03:10:40 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 08DCE41B45; Mon, 26 Jan 2026 06:10:39 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 798DB43DB8; Mon, 26 Jan 2026 06:09:20 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 8BD983FD2B; Mon, 26 Jan 2026 06:09:14 -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 1531B4196F for ; Mon, 26 Jan 2026 06:09:14 -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-679-1FMZVVWTNgC0pn4JyY8Vow-1; Mon, 26 Jan 2026 06:09:12 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 98E25180057E for ; Mon, 26 Jan 2026 11:09:11 +0000 (UTC) Received: from dosh.home.annexia.org.com (unknown [10.45.226.73]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 64C4019560B4; Mon, 26 Jan 2026 11:09:10 +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=1769425753; 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=+aosotRhT9MEK76EfL5rgbVlcSPlgiSz3jHldV5WUOA=; b=jHws7kYV6w+IZHiM66pJ7poVaeOqvTGrRxHlgCbxF96tP5+X+VuY70jxDvGwa4AWPF4IYm x8wOGVllSP/Dpj2kqZhvkjZyxYjK18XB8A0qQfGoXqBCQhQvGlSQZZpyx97MLAk+oMdpwc bL4BnvGgnxOVUiPeyKCGgWomT5K27sg= X-MC-Unique: 1FMZVVWTNgC0pn4JyY8Vow-1 X-Mimecast-MFC-AGG-ID: 1FMZVVWTNgC0pn4JyY8Vow_1769425751 To: devel@lists.libvirt.org Subject: [PATCH 1/3] esx: Debug URL just before opening with curl Date: Mon, 26 Jan 2026 11:05:00 +0000 Message-ID: <20260126110905.1316001-2-rjones@redhat.com> In-Reply-To: <20260126110905.1316001-1-rjones@redhat.com> References: <20260126110905.1316001-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: JL4ssIj-UQGFwpQ9EOCTylA8_PrNSZgOKewcXuvurVg_1769425751 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: RBD3Z3QIVQDYM7UDVQFJXTOMYRFJRBTK X-Message-ID-Hash: RBD3Z3QIVQDYM7UDVQFJXTOMYRFJRBTK 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: 1769425845407158500 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Richard W.M. Jones Reviewed-by: Michal Privoznik --- src/esx/esx_vi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 3264afc13a..c5ecb22bc4 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -383,6 +383,7 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, = char **content, } =20 VIR_WITH_MUTEX_LOCK_GUARD(&curl->lock) { + VIR_DEBUG("URL: %s", url); curl_easy_setopt(curl->handle, CURLOPT_URL, url); curl_easy_setopt(curl->handle, CURLOPT_RANGE, range); curl_easy_setopt(curl->handle, CURLOPT_WRITEDATA, &buffer); @@ -423,6 +424,7 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, co= nst char *content) } =20 VIR_WITH_MUTEX_LOCK_GUARD(&curl->lock) { + VIR_DEBUG("URL: %s", url); curl_easy_setopt(curl->handle, CURLOPT_URL, url); curl_easy_setopt(curl->handle, CURLOPT_RANGE, NULL); curl_easy_setopt(curl->handle, CURLOPT_READDATA, &content); @@ -1220,6 +1222,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char = *methodName, return -1; =20 VIR_WITH_MUTEX_LOCK_GUARD(&ctx->curl->lock) { + VIR_DEBUG("URL: %s", ctx->url); curl_easy_setopt(ctx->curl->handle, CURLOPT_URL, ctx->url); curl_easy_setopt(ctx->curl->handle, CURLOPT_RANGE, NULL); curl_easy_setopt(ctx->curl->handle, CURLOPT_WRITEDATA, &buffer); --=20 2.52.0 From nobody Mon Feb 2 06:00:50 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=1769425879; cv=none; d=zohomail.com; s=zohoarc; b=iLN12yP/k9s4wpa5wL1I4exXc71uWSfE0XF2WXJLZ25b7N3+kw7cG5zXmuRpW1OYhMDyMej3nZwsDjuphwkWlHgtEg40UeAR4PzXrclcSWfweHRSfDKDhivhC8SElDAWmmH5PytzMvC4/uoOngn2UE/XFjUz94bfZNefTgQTkmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769425879; 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=Vn9jWcgifx+SeypXje35WigvmTJ7MGUpbFKntfOLVMeoZraTxJevOGrSq3cl0ghQYjZ9xDolQAyHe1IrGRzwpNUXIV6KwgzyNFuUpps/Mts1bty+E3KsxuuzhkVeAcPYHJn99B5rpxR/BB2z5W9q4t6aJf59ZxcceNoJZodqUcw= 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 176942587902258.06801865454395; Mon, 26 Jan 2026 03:11:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 1C44C41B3A; Mon, 26 Jan 2026 06:11:18 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 229A543E24; Mon, 26 Jan 2026 06:09:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 4C52441969; Mon, 26 Jan 2026 06:09:16 -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 C8AC23FD2B for ; Mon, 26 Jan 2026 06:09:15 -0500 (EST) Received: from mx-prod-mc-08.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-253-2IwJwntFOvatWii769t2VA-1; Mon, 26 Jan 2026 06:09:14 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4AF88180047F for ; Mon, 26 Jan 2026 11:09:13 +0000 (UTC) Received: from dosh.home.annexia.org.com (unknown [10.45.226.73]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1B4011955F66; Mon, 26 Jan 2026 11:09:11 +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=1769425755; 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=UYTjI81pTJB5isoHtv70C8pF0Lvkt0regG/C1FQ+YcAuGrGtvkKQE5VfEGLZyxEJx3Ylsc Ln+UnWIY0IOUU/dM1txTx7AXyk3uxSC11iTncJ1zwGz1Q9R60M59x+KakBFWPenf0CEgHa FZ2HKSg8KdEmbvFF/J0BwlhvdRi+/4s= X-MC-Unique: 2IwJwntFOvatWii769t2VA-1 X-Mimecast-MFC-AGG-ID: 2IwJwntFOvatWii769t2VA_1769425753 To: devel@lists.libvirt.org Subject: [PATCH 2/3] esx: Abstract all URL-creation code into two functions Date: Mon, 26 Jan 2026 11:05:01 +0000 Message-ID: <20260126110905.1316001-3-rjones@redhat.com> In-Reply-To: <20260126110905.1316001-1-rjones@redhat.com> References: <20260126110905.1316001-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: eTs_5UOf0mfICTim3vPaeEvs-AYFeDk3YDv6YXMxrMU_1769425753 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 625QOW6MWAA2THXZBWRJB55JDLFWGJDV X-Message-ID-Hash: 625QOW6MWAA2THXZBWRJB55JDLFWGJDV 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: 1769425880883158501 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 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 06:00:50 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=1769425912; cv=none; d=zohomail.com; s=zohoarc; b=IAvabddzRewl1ZjD/xM2DvBVCpQdA3pO1vlROWDGAtrkYZvnBbQRtPK07UCwKThSyupXSlANlxF3qa/o9OdL4ReKHDPwjvznqW8HNCRoedLFEuwchzdhbJz0Uc8oQXw6zLRjMf49/0noIoHi8YJfoWZGY4dQiYgxCVagenI+xc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769425912; 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=fxQK5EedEwT/CHyguwC1zMQgcZ6mfpJFdmbukyVfRzQ=; b=WRyq5ixaC7A2Nxzy+5shz5mJa7SzPAnYxTKJEbQfCG0U2yJKBIw0V4w5hRwcl9WuZKrmDefHyQnD5luvtba4K558tImpJu6rguOZaFsTSkXsuCLoP9eZDgDlP4xBDSebIlsvrgnIxfn0nJ00LzxI//sTRteyqHmghBEdx6osnNo= 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 1769425912097711.3135976547153; Mon, 26 Jan 2026 03:11:52 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id D03553FB01; Mon, 26 Jan 2026 06:11:51 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0B8F641BE3; Mon, 26 Jan 2026 06:09:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 61A9241BE5; Mon, 26 Jan 2026 06:09:30 -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 C43A23FD2B for ; Mon, 26 Jan 2026 06:09:17 -0500 (EST) Received: from mx-prod-mc-01.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-518-Ksg8qpCRO9qDTf2j9VPxUA-1; Mon, 26 Jan 2026 06:09:15 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 16B301944EA8 for ; Mon, 26 Jan 2026 11:09:15 +0000 (UTC) Received: from dosh.home.annexia.org.com (unknown [10.45.226.73]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D046319560B4; Mon, 26 Jan 2026 11:09:13 +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=1769425757; 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=fxQK5EedEwT/CHyguwC1zMQgcZ6mfpJFdmbukyVfRzQ=; b=b6MGQEyasNAy/EPSXZ4W0ymXDg4jYSJv4FktUwIorE93FGuomvpNqHoCXGrPHDO2QBa/PP ydkTZDBqV9K5zcSHibUgcV8FInuQuXWC1ORNrdgPlG63a7YRKROYJp/6QPGwlmlD4ZkpIt yHD+UwTRNnVAqdURWbjUzDlf5q29bSU= X-MC-Unique: Ksg8qpCRO9qDTf2j9VPxUA-1 X-Mimecast-MFC-AGG-ID: Ksg8qpCRO9qDTf2j9VPxUA_1769425755 To: devel@lists.libvirt.org Subject: [PATCH 3/3] esx: Form URLs containing IPv6 addresses correctly Date: Mon, 26 Jan 2026 11:05:02 +0000 Message-ID: <20260126110905.1316001-4-rjones@redhat.com> In-Reply-To: <20260126110905.1316001-1-rjones@redhat.com> References: <20260126110905.1316001-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ab0ofxWYQcYkmq56zrrxBMUwrFL6jPwle12L0SnYJyo_1769425755 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QOEQIRXBBW6BNLZMYLBFYHUYPO6UNUZE X-Message-ID-Hash: QOEQIRXBBW6BNLZMYLBFYHUYPO6UNUZE 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: 1769425914981158500 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 Signed-off-by: Richard W.M. Jones Reviewed-by: Michal Privoznik --- 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