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? ./asd 2002:c1ed:8229::1 getaddrinfo() succeeded, result 2002:c1ed:8229::1 ./asd 2002:c1ed:8229:0::1 getaddrinfo() succeeded, result 2002:c1ed:8229:0::1 Either both the above should fail, or at least they should both return the former result.
Created attachment 94718 [details] test program
IMHO glibc is right: http://www.opengroup.org/onlinepubs/007904975/functions/getaddrinfo.html - 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.