On 05/08/09 09:17, Stacey Jonathan Marshall wrote:
On 05/08/09 13:51, Sebastien Roy wrote:
On Fri, 2009-05-08 at 13:32 +0100, Stacey Jonathan Marshall wrote:
On 05/08/09 00:44, Girish Moodalbail wrote:
Folks,

How should getaddrinfo() behave if the user requested for AI_CANONNAME and passes in a literal IP address? (aka CR 6831339)
getaddrinfo(3SOCKET) states:

     The getaddrinfo() function performs the *node name to address*
translation. Therefore if the caller passes in an address and not a name while including AI_CANONNAME then I think its fair enough to reply with the IP address as the canonical name when no name is found.

I would agree, but additional investigation since my original reply
reveals that the existing code is probably correct.  See below.

Assuming we agree that the alternative of returning error EAI_BADFLAGS or EAI_NODATA is not an option.

Agreed.

The CR justification states that this is a standards problem, which standard is this and what does it say?

It's the Open Group, and see the following:

http://www.opengroup.org/onlinepubs/009695399/functions/getaddrinfo.html

Under AI_CANONNAME:

"A numeric host address string is not a ``name'', and thus does not have
a ``canonical name'' form; no address to host name translation is
performed. See below for handling of the case where a canonical name
cannot be obtained."

Then, the "below" text:

"If nodename is not null, and if requested by the AI_CANONNAME flag, the
ai_canonname field of the first returned addrinfo structure shall point
to a null-terminated string containing the canonical name corresponding
to the input nodename; if the canonical name is not available, then
ai_canonname shall refer to the nodename argument or a string with the
same contents. The contents of the ai_flags field of the returned
structures are undefined."

So it would seem that our existing code is spot on, and we just need to
update our man page to more accurately reflect reality.

-Seb


Thanks Seb, well, that is very clear "A numeric host address string is not a `name'".

Girish you should be able to update the public comments of the CR and re-categories to "manpage", sub-cat "section3socket".

Seb, Stace,

thanks a bunch. Will do the same.

~Girish
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to