Red Hat Bugzilla – Bug 105374
getaddrinfo returns non-canonical node name
Last modified: 2016-11-24 09:54:11 EST
See attached test program.
When invoked with IP addresses for which there is no reverse DNS, it should
surely fail? When invoked with a non-canonical IPv6 address, it should certainly
not just return the same text?
getaddrinfo() succeeded, result 2002:c1ed:8229::1
getaddrinfo() succeeded, result 2002:c1ed:8229:0::1
Either both the above should fail, or at least they should both return the
Created attachment 94718 [details]
IMHO glibc is right:
- A numeric host address string is not a ``name'', and thus does not have a ``canonical name'' form
- if the canonical name is not available, then ai_canonname shall refer to the nodename argument or a string with the same contents.
So it would be wrong to do a reverse-dns lookup for _any_ numerical input string?
And hence _this_ would be a bug....
$ ./asd 192.168.0.1
getaddrinfo() succeeded, result dwmw2.baythorne.internal
You are right, for numeric addresses as name parameter ai_canonname
must always be a copy of the input string. I've changed that in the
current CVS code. Will be in 2.3.3-59 or so.