Bug 1059122
| Summary: | libc getaddrinfo fails for hostname containing only decimal digits | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Ariel Glenn <ariel.glenn> | ||||
| Component: | glibc | Assignee: | Carlos O'Donell <codonell> | ||||
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 20 | CC: | codonell, fweimer, jakub, law, pfrankli, spoyarek | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2014-01-31 12:28:35 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Numeric arguments are considered to be IP addresses and not valid host names. The amendment to RFC 952 (with RFC 1123) may allow for all-numeric host names, but that conflicts with this documented documented IP address format: http://pubs.opengroup.org/onlinepubs/009695399/functions/inet_addr.html There is an explicit note in RFC 1123: If a dotted-decimal number can be entered without such identifying delimiters, then a full syntactic check must be made, because a segment of a host domain name is now allowed to begin with a digit and could legally be entirely numeric (see Section 6.1.2.4). However, a valid host name can never have the dotted-decimal form #.#.#.#, since at least the highest-level component label will be alphabetic. which technically allows us to look at a number as an IP address and if that fails, fall back to a hostname lookup. This would be very confusing behaviour though, so I don't think it's a good idea to change the current state of the art. So to conclude, please don't use only numeric hostnames. |
Created attachment 856951 [details] test-getaddrinfo.c does what the name says Description of problem: getaddrinfo fails with an error for a hostname that consists only of digits 0-9. Docker for example generates such hostnames for its containers (it generates hex strings but some of those turn out to contain only 0-9). Version-Release number of selected component (if applicable): glibc-2.18-11.fc20.x86_64 Steps to Reproduce: 1. add the lines to /etc/hosts: 172.17.10.53 blobber 172.17.10.54 836937931829 2. compile the attached c program (just sets up a struct addrinfo and calls getaddrinfo() and run it Actual results: $ ./test-getaddrinfo 172.17.10.53 80 Success! $ ./test-getaddrinfo blobber 80 Success! $ ./test-getaddrinfo 172.17.10.54 80 Success! $ ./test-getaddrinfo 836937931829 80 getaddrinfo: Name or service not known Expected results: success for all four runs Additional info: this also breaks getaddrinfo() in python.