[PATCH v2 0/3] esx: Form URLs containing IPv6 addresses correctly

Richard W.M. Jones via Devel posted 3 patches 6 days, 14 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20260126142300.1518327-1-rjones@redhat.com
[PATCH v2 0/3] esx: Form URLs containing IPv6 addresses correctly
Posted by Richard W.M. Jones via Devel 6 days, 14 hours ago
v1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/YRCX4UCCLV4LTGDF4NCGZJWKUEFU6PGO/

In v2, replace multiple VIR_DEBUG with just one, and add the
Reported-by and Reviewed-by tags on the last commit.

I'm sure this can't be the only place in libvirt that has to solve
this problem (nor the "is this hostname IPv6" problem for that
matter), but my searching skills are not good enough to find any other
places.

Rich.
Re: [PATCH v2 0/3] esx: Form URLs containing IPv6 addresses correctly
Posted by Michal Prívozník via Devel 6 days, 13 hours ago
On 1/26/26 15:22, Richard W.M. Jones wrote:
> v1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/YRCX4UCCLV4LTGDF4NCGZJWKUEFU6PGO/
> 
> In v2, replace multiple VIR_DEBUG with just one, and add the
> Reported-by and Reviewed-by tags on the last commit.
> 
> I'm sure this can't be the only place in libvirt that has to solve
> this problem (nor the "is this hostname IPv6" problem for that
> matter), but my searching skills are not good enough to find any other
> places.

Thing is, it can be not just address but a hostname too. I mean we do
have virSocketAddrFormat() but that works specifically with IP addresses
and/or UNIX sockets. And in this case, the hostname can be
"123.datacentre.internal.company.org" or whatever.

Having said that, esxUtil_ResolveHostname() returns resolved IP address
and it is passed to esxVI_Context_Connect() indeed, but HTTP has this
'Host' header field where the original hostname should appear, not
resolved IP address (though, I don't think anybody is running a web
server on their VMWare hosts).

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal
Re: [PATCH v2 0/3] esx: Form URLs containing IPv6 addresses correctly
Posted by Daniel P. Berrangé via Devel 6 days, 13 hours ago
On Mon, Jan 26, 2026 at 04:01:44PM +0100, Michal Prívozník via Devel wrote:
> On 1/26/26 15:22, Richard W.M. Jones wrote:
> > v1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/YRCX4UCCLV4LTGDF4NCGZJWKUEFU6PGO/
> > 
> > In v2, replace multiple VIR_DEBUG with just one, and add the
> > Reported-by and Reviewed-by tags on the last commit.
> > 
> > I'm sure this can't be the only place in libvirt that has to solve
> > this problem (nor the "is this hostname IPv6" problem for that
> > matter), but my searching skills are not good enough to find any other
> > places.
> 
> Thing is, it can be not just address but a hostname too. I mean we do
> have virSocketAddrFormat() but that works specifically with IP addresses
> and/or UNIX sockets. And in this case, the hostname can be
> "123.datacentre.internal.company.org" or whatever.
> 
> Having said that, esxUtil_ResolveHostname() returns resolved IP address
> and it is passed to esxVI_Context_Connect() indeed, but HTTP has this
> 'Host' header field where the original hostname should appear, not
> resolved IP address (though, I don't think anybody is running a web
> server on their VMWare hosts).

Can we use  virURI  for ESX URI formatting ?  That didn't try to
detect IPv6 formally, but instead simply adds [] if the "server name"
contained a ":".

> 
> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
> 
> Michal
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [PATCH v2 0/3] esx: Form URLs containing IPv6 addresses correctly
Posted by Richard W.M. Jones via Devel 6 days, 11 hours ago
On Mon, Jan 26, 2026 at 03:11:42PM +0000, Daniel P. Berrangé wrote:
> On Mon, Jan 26, 2026 at 04:01:44PM +0100, Michal Prívozník via Devel wrote:
> > On 1/26/26 15:22, Richard W.M. Jones wrote:
> > > v1: https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/YRCX4UCCLV4LTGDF4NCGZJWKUEFU6PGO/
> > > 
> > > In v2, replace multiple VIR_DEBUG with just one, and add the
> > > Reported-by and Reviewed-by tags on the last commit.
> > > 
> > > I'm sure this can't be the only place in libvirt that has to solve
> > > this problem (nor the "is this hostname IPv6" problem for that
> > > matter), but my searching skills are not good enough to find any other
> > > places.
> > 
> > Thing is, it can be not just address but a hostname too. I mean we do
> > have virSocketAddrFormat() but that works specifically with IP addresses
> > and/or UNIX sockets. And in this case, the hostname can be
> > "123.datacentre.internal.company.org" or whatever.
> > 
> > Having said that, esxUtil_ResolveHostname() returns resolved IP address
> > and it is passed to esxVI_Context_Connect() indeed, but HTTP has this
> > 'Host' header field where the original hostname should appear, not
> > resolved IP address (though, I don't think anybody is running a web
> > server on their VMWare hosts).
> 
> Can we use  virURI  for ESX URI formatting ?  That didn't try to
> detect IPv6 formally, but instead simply adds [] if the "server name"
> contained a ":".

Indeed it does.  I'll see if we can use src/utils/viruri.c.

Rich.

> > 
> > Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
> > 
> > Michal
> > 
> 
> With regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v