https://bugs.openldap.org/show_bug.cgi?id=9287
--- Comment #9 from jessica.1.chen@nokia-sbell.com --- Per our configuration, NSS would firstly check /etc/hosts and then do DNS query when gethostbyname_r is invokded from ldap_set_option or ldap_create.
In our IPv4 test bed, gethostbyname_r returned successfully with the info found in /etc/hosts. ==================================================== NSS/HOST configuration in IPv4 test bed ==================================================== bash-4.2$ hostname udm5g-udmee-1-788bbbb649-f667m bash-4.2$ bash-4.2$ cat /etc/hosts |grep udm5g-udmee-1-788bbbb649-f667m 192.168.1.11 udm5g-udmee-1-788bbbb649-f667m bash-4.2$ bash-4.2$ cat /etc/nsswitch.conf |grep host hosts: files dns myhostname bash-4.2$
However in our IPv6 test bed, gethostbyname_r somehow didn't recognize the entry in /etc/hosts so it started DNS query which timed out after about 10 seconds which was expected behavior. The timer duration is controlled by the following configuration in /usr/include/resolv.h.
# define RES_TIMEOUT 5 /* min. seconds between retries */ # define RES_DFLRETRY 2 /* Default #/tries. */
With exactly the same configuration, getaddrinfo() would return successfully with info in /etc/hosts.
==================================================== NSS/HOST Configuration in IPv6 TB ==================================================== bash-4.2$ hostname mix-udmee-1-6f869bc959-px7gx bash-4.2$ bash-4.2$ cat /etc/hosts |grep mix-udmee fd00::7bd1:e96f:ccda:8aa0 mix-udmee-1-6f869bc959-px7gx bash-4.2$ bash-4.2$ cat nsswitch.conf |grep hosts hosts: files dns myhostname