On Thursday, 11/29/2001 at 08:55 EST, Lori Napoli/Raleigh/IBM@IBMUS wrote:
> draft-ietf-ipngwg-rfc2553bis-04.txt section 6.2 states:
>
> The flags argument is a flag that changes the default actions of the
> function. By default the fully-qualified domain name (FQDN) for the host
> shall be returned, but:
>
>   - If the flag bit NI_NOFQDN is set, only the node name portion of the
>     FQDN shall be returned for local hosts.
>
>   - If the flag bit NI_NUMERICHOST is set, the numeric form of the
>     host's address shall be returned instead of its name, under all
>     circumstances.
>
>   - If the flag bit NI_NAMEREQD is set, an error shall be returned if the
>     host's name cannot be located.
>
>   - If the flag bit NI_NUMERICSERV is set, the numeric form of the
>     service address shall be returned (for example, its port number)
> instead of
>     its name, under all circumstances.
>
>   - If the flag bit NI_NUMERICSCOPE is set, the numeric form of the
>     scope identifier shall be returned (for example, interface index)
>     instead of its name.  This flag is ignored if the sa argument is
>     not an IPv6 address.
>
>   - If the flag bit NI_DGRAM is set, this indicates that the service is
>     a datagram service (SOCK_DGRAM). The default behavior shall assume
that
>     the service is a stream service (SOCK_STREAM).
>
> So what if NI_NUMERICHOST is not set and NI_NAMEREQD is not set.
> Getnameinfo attempts to resolve the name via DNS query and scan of the
> local files.  If the host name is not resolved, do we return the numeric
> form or an error?

You should return the numeric form.  The pertinent text which describes
this situation appears just prior to the flags you included above.

> Also, if NI_NUMERICSERV is not set, getnameinfo calls getservbyport to
scan
> the local service name file and if the service name is not resolved we
> return the numeric form.  So, how can the application calling getnameinfo
> determine that the resolution of the service name failed since it can
> receive the numeric form regardless of NI_NUMERICSERV setting.  It would
> have to determine that numeric form was returned and NI_NUMERICSERV had
not
> been specified.  There doesn't seem to be a service name equivalent of
> NI_NAMEREQD.  Should getnameinfo return the numeric form of the service
> name if name resolution fails or should we return an error?

Again, the draft specifies that the numeric form be returned.  And you seem
to be correct - there isn't an equivalent to NI_NAMEREQD for the service
name.  I guess any application which was really interested whether the port
number could be found in the service name file would need to use strcmp()
to compare value returned to the value which was input, and if they are the
same and NI_NUMERICSERV was not coded infer (possibly incorrectly if
someone coded a numeric service name in the local file) that the name could
not be located.

Roy Brabson

--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to