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]

Re: [PATCH][BZ #16077] Get canonical name in getaddrinfo from hosts file for AF_INET


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.

Siddhesh


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