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]

gethostbyaddr without /etc/{resolv,nsswitch}.conf


Hello,

(Resent from libc-help as Carlos suggested.)

Guix builds packages in Linux containers where only âloâ is available,
/etc/{nsswitch,resolv}.conf are missing, and /etc/hosts maps 127.0.0.1
to âlocalhostâ.

In that context, looking up âlocalhostâ works fine.
However, gethostbyaddr("127.0.0.1") fails with TRY_AGAIN.


The problem stems from the fact that the default config for the âhostsâ
database when resolv.conf is missing is (from nss/hosts-lookup.c):

  dns [!UNAVAIL=return] files

When doing a host name lookup, âdnsâ returns NSS_STATUS_UNAVAIL, so we
go on with âfilesâ and /etc/hosts is honored as expected.

Conversely, when doing a reverse lookup, the DNS name service returns
NSS_STATUS_NOTFOUND, and so âgethostbyaddrâ returns the error directly.

(Of course, changing the âhostsâ config to âdns filesâ solves this
particular problem.)


Should the DNS name service always return NSS_STATUS_UNAVAIL when
resolv.conf is missing?  Or should the default config for reverse hosts
lookups be âdns filesâ?  Or...?

Thanks,
Ludoâ.


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