This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BUG] NSCD fails to collect all the available IP addresses for a host


Hi,

I came across a problem with the gethostbyname()/getaddrinfo(), where these functions failed to return all the addresses available for a particular host from /etc/hosts. Upon debugging I could find that this problem happens only when we run nscd daemon.

Here is the configuration details :

* /etc/nsswitch.conf has the hosts lookup priority as hosts,dns

* /etc/host.conf have the multi directive turned on.

* /etc/hosts have two IPs associated with the same host name.

The above functions returns all the addresses, if I stop the nscd daemon.

Upon debugging, I could find that the problem lies in __nss_files_get_hostbyname2_r / __nss_files_get_hostbyname_r .

while ((status = internal_getent (result, buffer, buflen, errnop
H_ERRNO_ARG EXTRA_ARGS_VALUE)) == NSS_STATUS_SUCCESS)
{ break_if_match } if (status == NSS_STATUS_SUCCESS
&& _res_hconf.flags & HCONF_FLAG_MULTI)


Even though we check for HCONF_FLAG_MULTI in _res_hconf.flags, the _res_hconf is not initialized when we check the same. I tried adding,

+ if (!_res_hconf.initialized)
+   _res_hconf_init();

to fix the problem, but when I tried to build the libc, the build failed with unable to resolve the symbol _res_hconf_init().

I also tried defining :

#define NEED__RES_HCONF for nscd daemon code, which again lead to the above compilation error.


Could you please share your thoughts about the issue and how to fix the same ?


Thanks

Suzuki K P
Linux Technology Center
IBM Software Labs



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]