Subject: (IPng 6557) Base API: Check on IPv4 Literal Addresses

From: [email-masked]
Date: Wed, 30 Sep 1998 09:31:09 -0400

Folks thanks for all the edits on the spec keep them coming.  One came
in offline to us co-authors I think should be checked with the WG thanks
to Atsushi Onoe.

In section 6.1 just before section 6.2 we speak of dealing with literal
addresses.  In addition we changed the semantics of AI_V4MAPPED or'd
AI_ALL as follows per input from implementors that we should not assume
v4mapped.

--------------------------------------------
-  If the AI_V4MAPPED flag is specified along with an af of AF_INET6,
   then the caller will accept IPv4-mapped IPv6 addresses.  That is, if
   no AAAA records are found then a query is made for A records and any
   found are returned as IPv4-mapped IPv6 addresses (h_length will be 16).
   The AI_V4MAPPED flag is ignored unless af equals AF_INET6.

-  The AI_ALL flag is used in conjunction with the AI_V4MAPPED flag,
   and is only used with the IPv6 address family.  When AI_ALL is
   logically or'd with AI_V4MAPPED flag then the caller wants all
   addresses: IPv6 and IPv4-mapped IPv6.  A query is first made for AAAA
   records and if successful, the IPv6 addresses are returned.  Another
   query is then made for A records and any found are returned as
   IPv4-mapped IPv6 addresses. h_length will be 16.  Only if both
   queries fail does the function return a NULL pointer.  This flag is 
   ignored unless af equals AF_INET6.
-------------------------------------------

First:
What we did was force the use of AI_V4MAPPED directly when you want
mapped addresses.

Second:
To get mapped and v6 addresses you 'or' AI_ALL with AI_V4MAPPED. The
input was that each operation should be spelled out through the logic
operation of the flags rather than a "default".  

So from the working groups perspective it was a syntax change really
rather than semantics, but in fact did change the semantics of AI_ALL.

for getipnodebyname....

.. if you want IPv6 addresses don't specify any flags with AF_INET6.

.. if you want V4 Mapped specify AI_V4MAPPED with AF_INET6.

.. if you want  IPv6 address and V4 Mapped specify AI_V4MAPPED | 
   AI_ALL and AF_INET6 and you get both.

But for literal address situations and it is IPv4 dotted decimal it is
not logical to specify AI_ALL with AI_V4MAPPED.  Because I have no way
of getting an IPv6 address from 12.10.120.3 IPv4 address.  Unless I take
the name returned and then do an IPv6 lookup and that is going to be a
performance nightmare and a bit to many gyrations for DNS resolvers. Esp
with the new A6 records being proposed for the inverse tree. Users will
scream so why do it.  

Here is the text that was misplaced and should be in the spec just
before section 6.2 using the AI_V4MAPPED flag.  

--------------------------------------
When name is a dotted-decimal IPv4 address and af equals AF_INET6, and
flags equals AI_V4MAPPED, an IPv4-mapped IPv6 address is returned:
h_name points to an IPv6 hex address containing the IPv4-mapped IPv6
address, h_aliases is a NULL pointer, h_addrtype is AF_INET6, h_length
is 16, h_addr_list[0] is a pointer to the 16-byte binary address, and
h_addr_list[1] is a NULL pointer.
--------------------------------------

Please comment on this issue so we can wrap it up.

thanks
/jim
--------------------------------------------------------------------
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-masked]
--------------------------------------------------------------------

---

From: Atsushi Onoe <[email-masked]>
Date: Wed, 30 Sep 1998 23:22:02 +0900 (JST)

> of getting an IPv6 address from 12.10.120.3 IPv4 address.  Unless I take

I think getipnodebyname() for IPv4 literal address with AI_V4MAPPED flag
should return IPv4-mapped IPv6 address regardless AI_ALL flag.

For applications support multi protocol (ex. telnet), setting
AI_V4MAPPED | AI_ALL is very helpful as well as getaddrinfo().

However, if a user specifies remote host as IPv4 literal string, such
applications must call inet_pton() for each address family prior calls
to getipnodebyname() unless it returns IPv4-mapped address.

Actually the current spec for IPv4 literal address is very confusing:
	with AI_V4MAPPED		returns IPv4-mapped IPv6 address
	with AI_V4MAPPED | AI_ALL	returns NULL

Regards,

Atsushi

---

From: [email-masked]
Date: Wed, 30 Sep 1998 12:37:30 -0400

Atushi,

>should return IPv4-mapped IPv6 address regardless AI_ALL flag.

agree.  I did not have my bogon deflector on.  In the spec for dotted we
don't really have to set AI_V4MAPPED or AI_ALL it will return IPv4
mapped to save the inet_pton as we state in the spec.  Sorry for the
confusion.  I thought we now wanted all IPv6 addrs in haddrlist.

>AI_V4MAPPED | AI_ALL is very helpful as well as getaddrinfo().

For AF_INET6 this is in the spec now yes.

>to getipnodebyname() unless it returns IPv4-mapped address.

But with the misplaced text now in there that is fixed and I will take
out the req to specifiy AI_V4MAPPED.

>	with AI_V4MAPPED | AI_ALL	returns NULL

Agreed.  Neither is required to be specified.

thanks
/jim

---

From: Erik Nordmark <[email-masked]>
Date: Wed, 30 Sep 1998 16:18:03 -0700 (PDT)

JIM,

> Agreed.  Neither is required to be specified.

Just to make sure ...

I assume you don't want to return a mapped address (even for literal IPv4 
addresses) unless AI_V4MAPPED is set since it might confuse applications.

Thus I think the rules for IPv4 literals with getipnodebyname(AF_INET6, ...)
should be
	If AI_V4MAPPED is set (with or without AI_ALL) return IPv4-mapped
	Otherwise return NULL

   Erik