getent hosts 192.168.0.1 does not return entry

Bug #28585 reported by Naaman Campbell
6
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

When 'getent hosts 192.168.0.1' is run, no entry is returned although it exists in /etc/hosts as:

192.168.0.1 off

However, 'getent hosts off' works, as does 'getent hosts 192.168.10.1' which is a host that has a valid A record in the local DNS server.

Revision history for this message
Naaman Campbell (naamanc) wrote :

Although a search of the Ubuntu Packages site returns that getent is part of libc6, I could not report a bug against libc6 as it is not part of the list of packages within the Malone system.

Bug reported: https://launchpad.net/products/launchpad/+bug/28586

It was suggested that I log the bug against glibc in the interim.

Revision history for this message
Matt Zimmerman (mdz) wrote :

Works as expected here. Send your complete /etc/hosts and /etc/nsswitch.conf.

mizar:[~] grep 192.168.10.1 /etc/hosts
192.168.10.1 off
mizar:[~] getent hosts off
192.168.10.1 off
mizar:[~] host off 192.168.0.1
Using domain server:
Name: 192.168.0.1
Address: 192.168.0.1#53
Aliases:

Host off not found: 3(NXDOMAIN)

Changed in glibc:
status: Unconfirmed → Needs Info
Revision history for this message
sdb (salvatore-debonis) wrote :

Hi all,

same issue here. The problem seem related to reverse lookup not involving /etc/hosts. There are some similarities here:

http://sources.redhat.com/ml/libc-hacker/2005-10/msg00002.html

/etc/hosts:

127.0.0.1 localhost.localdomain localhost
192.168.0.10 toki

62.152.107.236 danio
192.168.254.3 antispam.bipcamail.it
192.168.3.1 vela

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

/etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd: compat
group: compat
shadow: compat

hosts: files dns mdns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: nis

getent hosts 192.168.3.1 give no result, but curiously enough, getent hosts 127.0.0.1 correctly print

127.0.0.1 localhost

Same problem in debian etch, so the bug seem definitely libc6 related.

HTH

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for glibc (Ubuntu) because there has been no activity for 60 days.]

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.