Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem: the IPv6 address put in /etc/hosts with a special and unique name for it doesn't get returned by gethostbyname using that name.
Version-Release number of selected component (if applicable):
How reproducible:
Just put an IPv6 address in /etc/hosts, and give it a name. Then in a C program call gethostbyname("thename"); even when the /etc/nsswitch.conf has "files dns" for hosts, but the return result is not the IPv6 address in the /etc/hosts for that name. You may need to select a name that your DNS server can resolve.
Steps to Reproduce:
1.
2.
3.
Actual results:
the returned address is from DNS, not the one in /etc/hosts.
Expected results:
the returned address should be from /etc/hosts when "files dns" is used for hosts in nsswitch.conf.
Additional info:
But then the IPv4 address in /etc/hosts fail to work.
Comment 4RHEL Program Management
2013-10-14 01:46:27 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
(In reply to wzis from comment #0)
> Description of problem: the IPv6 address put in /etc/hosts with a special
> and unique name for it doesn't get returned by gethostbyname using that name.
gethostbyname only returns IPv4 addresses, by design. Please provide more details what you are doing.
"gethostbyname only returns IPv4 addresses"? then why after adding "options inet6" to resolve.conf, it can return IPv6 address? Also the man page says
"The gethostbyname() function returns a structure of type hostent for the given host name. Here name is either a hostname, or an IPv4 address in standard dot notation (as for inet_addr(3)), or an IPv6 address in colon (and possibly dot) notation."
The gethostbyname does handle IPv6 address. So why without using the options, it can't return the IPv6 addr specified in the /etc/hosts?
I cannot reproduce this issue with glibc-2.12-1.209.el6.x86_64. With “options inet6”, gethostbyname returns IPv6 addresses mapped IPv4, as expected.
Note that “options inet6” has been deprecated in upstream glibc.
Description of problem: the IPv6 address put in /etc/hosts with a special and unique name for it doesn't get returned by gethostbyname using that name. Version-Release number of selected component (if applicable): How reproducible: Just put an IPv6 address in /etc/hosts, and give it a name. Then in a C program call gethostbyname("thename"); even when the /etc/nsswitch.conf has "files dns" for hosts, but the return result is not the IPv6 address in the /etc/hosts for that name. You may need to select a name that your DNS server can resolve. Steps to Reproduce: 1. 2. 3. Actual results: the returned address is from DNS, not the one in /etc/hosts. Expected results: the returned address should be from /etc/hosts when "files dns" is used for hosts in nsswitch.conf. Additional info: