Bug 105374 - getaddrinfo returns non-canonical node name
Summary: getaddrinfo returns non-canonical node name
Alias: None
Product: Red Hat Linux Beta
Classification: Retired
Component: glibc
Version: beta1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2003-09-25 15:02 UTC by David Woodhouse
Modified: 2016-11-24 14:54 UTC (History)
2 users (show)

Clone Of:
Last Closed: 2004-09-28 07:09:12 UTC

Attachments (Terms of Use)
test program (648 bytes, text/plain)
2003-09-25 15:04 UTC, David Woodhouse
no flags Details

Description David Woodhouse 2003-09-25 15:02:49 UTC
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.

Comment 1 David Woodhouse 2003-09-25 15:04:22 UTC
Created attachment 94718 [details]
test program

Comment 2 Jakub Jelinek 2003-09-26 13:56:07 UTC
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.

Comment 3 David Woodhouse 2003-09-26 14:01:41 UTC
So it would be wrong to do a reverse-dns lookup for _any_ numerical input string?
And hence _this_ would be a bug....

$ ./asd
getaddrinfo() succeeded, result dwmw2.baythorne.internal


Comment 4 Ulrich Drepper 2004-09-28 07:09:12 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.