mailing list of musl libc
 help / color / mirror / code / Atom feed
* gethostbyname and resolv.conf
@ 2014-04-30 16:02 John Mudd
  2014-04-30 16:12 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: John Mudd @ 2014-04-30 16:02 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

FYI: Looks like the musl gethostbyname() doesn't use the "search" command
in the resolv.conf file.


$ cat test_gethostbyname.c
#include <stdio.h>
#include <netdb.h>

int main(int argc, char *argv[])
{
    struct hostent *lh = gethostbyname(argv[1]);

    if (lh)
        puts(lh->h_name);
    else
        herror("gethostbyname");

    return 0;
}
$


$ make  test_gethostbyname
gcc     test_gethostbyname.c   -o test_gethostbyname
$ test_gethostbyname lifeline.rx30.com
lifeline.rx30.com
$ test_gethostbyname lifeline
lifeline.rx30.com
$


$ make  test_gethostbyname
musl-gcc -fno-stack-protector    test_gethostbyname.c   -o
test_gethostbyname
$ test_gethostbyname lifeline.rx30.com
lifeline.rx30.com
$ test_gethostbyname lifeline
gethostbyname: Non-recoverable error
$


$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by
resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search rx30.com
$

[-- Attachment #2: Type: text/html, Size: 1824 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gethostbyname and resolv.conf
  2014-04-30 16:02 gethostbyname and resolv.conf John Mudd
@ 2014-04-30 16:12 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2014-04-30 16:12 UTC (permalink / raw)
  To: musl

On Wed, Apr 30, 2014 at 12:02:17PM -0400, John Mudd wrote:
> FYI: Looks like the musl gethostbyname() doesn't use the "search" command
> in the resolv.conf file.

Indeed, search is not implemented. It's on the roadmap for the
resolver overhaul, which is the next task and should be done sometime
next month.

One matter that could use discussion is how search should be
performed. The queries could be done in parallel, or in series once
the previous one fails. In any case the operation cannot complete
until there is an initial subsequence of the search list beginning
with zero or more negative results followed by a positive result; a
positive result with unanswered queries before it is non-conclusive.

Also a question is how search should interact with hosts file. If a
non-initial search suffix succeeds in the hosts file, should DNS
queries still be performed to check if the earlier search suffixes are
found via DNS?

These kinds of questions are why it's not implemented yet, and they
need to be discussed now I think if we're going to get it implemented
soon.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-30 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 16:02 gethostbyname and resolv.conf John Mudd
2014-04-30 16:12 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).