This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH][BZ #16077] Get canonical name in getaddrinfo from hosts file for AF_INET
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 23 Oct 2013 19:42:08 +0530
- Subject: Re: [PATCH][BZ #16077] Get canonical name in getaddrinfo from hosts file for AF_INET
- Authentication-results: sourceware.org; auth=none
- References: <20131023100431 dot GG7401 at spoyarek dot pnq dot redhat dot com> <20131023131253 dot GB5866 at domone dot podge>
On Wed, Oct 23, 2013 at 03:12:53PM +0200, OndÅej BÃlka wrote:
> On Wed, Oct 23, 2013 at 03:34:31PM +0530, Siddhesh Poyarekar wrote:
> > Hi,
> > AF_INET lookup in hosts file uses _nss_files_gethostbyname2_r, which
> > is not capable of returning a canonical name if it has found one.
> > This change adds _nss_files_gethostbyname3_r, which wraps around
> > _nss_files_gethostbyname2_r and then returns result.h_name as the
> > canonical name.
> How this will be used? Will there be a followup patches? A single function
> that is not called internally and has no documentation is not very useful.
getaddrinfo calls _nss_MODULE_FUNC from resolver modules, where MODULE
may be files, dns, etc. and FUNC (for getaddrinfo) could be
gethostbyname4_r, gethostbyname3_r, gethostbyname2_r, etc. Earlier,
since _nss_files_gethostbyname3_r was not available, any non-AF_UNSPEC
query would call _nss_files_gethostbyname2_r, which doesn't set
canonname, due to which the canonical name returned is simply a copy
of the query.
So to summarize, the function is called via the horribly convoluted
callback system of the nss modules.