NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gethostbyname(3) doesn't appear to work under NetBSD-5.2 and NetBSD-6.1.x when hostnames appear only in /etc/hosts

Brian Buhrow writes:
-       hello.  It appears that gethostbyname(3) in NetBSD-5.2 and 6.1.x is
- broken if the name you're trying to fetch is listed in /etc/hosts and 
- nowhere else.  The problem appears to be with this change:

I'm unable to reproduce on "6.1_STABLE amd64".

One thing you've not provided is your nsswitch.conf file, it
controls how getent(1) behaves.

From my test session:

        egsner-> grep /etc/hosts sillyhost
        egsner-> host
        Host not found: 3(NXDOMAIN)
        egsner-> getent hosts  sillyhost
        egsner-> grep host /etc/nsswitch.con
        hosts:          files dns
        # hosts:                dns, files, nis, mdnsd, multicast_dns

If your nsswitch has "dns files", you may want a "[notfound=continue]"
clause between "dns" and "files" (although that is supposed to
be the default.)

I might postulate your configuration has an nsswitch.conf file
with only "dns" in it?

Eric Schnoebelen      

Home | Main Index | Thread Index | Old Index