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.
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
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 :|
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
© 2016 - 2026 Red Hat, Inc.