On 01/13/2017 11:27 AM, Andrea Bolognani wrote:
On Mon, 2016-12-05 at 11:31 +0100, Michal Privoznik wrote:
[...]
> +<pre>
> +$ cat /etc/nsswitch.conf
> +# /etc/nsswitch.conf:
> +hosts: files libvirt-guest dns
> +# ...
> +</pre>
> + <p>Or users can enable both at the same time:</p>
> +<pre>
> +$ cat /etc/nsswitch.conf
> +# /etc/nsswitch.conf:
> +hosts: files libvirt libvirt-guest dns
> +# ...
> +</pre>
I just realized that, while the documentation consistently
refers to the new module as "libvirt-guest", the module is
actually called "libvirt_guest". In particular, the examples
above won't work at all.
We should change one or the other before release.
Ah, good catch.
Unfortunately, due to way that glibc works, we cannot use libvirt-guest
and have to stick with libvirt_guest. The problem is: when gethost*() is
called, glibc loads all the plugins listed in nsswitch.conf and tries to
see if they implement the name translation function. This function,
however, has to be unique otherwise symbol clash would occur. Therefore
glibc developers decided to go with:
_nss_$(pluginName)_$(implemntedFunction)_r
Now, if $pluginName was "libvirt-guest" you could hardly declare the
function in C as its name would have to be:
_nss_libvirt-guest_gethostbyname_r
C compiler sees two tokens there. Therefore we have to stick with a bit
more ugly "libvirt_guest" name.
Patch on its way.
Michal