Subject: [Tsvwg] question about Ipv4 mapped addresses

From: [email-masked]
Date: Fri, 11 Jan 2002 10:53:12 +0200

Hi

I have a questions related to Ipv4 mapped addresses.

In "Sockets API Extensions for SCTP"
on Page 5, socket()
    The first form creates an endpoint which can use only IPv4
    addresses, while, the second form creates an endpoint which can use
    both IPv6 and IPv4 mapped addresses.
			^^^^^^^^^^^^^^^^^^^^^^
but on page 6, bind() 
    If sd is an IPv4 socket, the address passed must be an IPv4 address.
    If the sd is an IPv6 socket, the address passed can either be an
    IPv4 or an IPv6 address.
    ^^^^^

Why is there such a difference? Why use IPv4 mapped addresses instead of
Ipv4 address in socket()?

Would anyone give me an answer?
Thanks!

Dajiang Zhang

_______________________________________________
tsvwg mailing list
[email-masked]
http://www1.ietf.org/mailman/listinfo/tsvwg

---

From: Randall Stewart <[email-masked]>
Date: Fri, 11 Jan 2002 07:16:36 -0600

Dajiang:

I don't know if I will have an answer :> And I am
sure some of my peers co-authors may disagree :-0

But I can comment on how Peter and I did ours :>>

>     both IPv6 and IPv4 mapped addresses.

When a IPv4 socket is opened IPv6 addresses are NOT allowed.
When a IPv6 socket is opened we DO allow IPv4 addresses to
be used... say on a sendmsg() call.

Now I have noticed that some of the KAME code will look
for a mapped address coming down and convert it to a
IPv4 address and then call the IPv4 routines. 

For our case we did not feel we needed to do this since all
of our routines were completely dual stacked. Now this may
be a arguable point and maybe we should have at least checked
all V6 address coming down the socket and if they were mapped
convert them to v4.. ... but for now we are not doing that :>

So in my view maybe the mapped wording can be deleted :>>

Well for our case this is true of course since it takes V4 and V6
addresses... our only problem is we need to add code to reject
V6 addresses on V4 sockets.. since we don't really care :-0

We probably should think about doing that :>>

> Ipv4 address in socket()?

I think the idea is so a given socket type only gets one type
of address on it.. but as far as I am concerned it should not
matter.. since under the covers you would just convert a
mapped address into a true V4 address why not allow the V4 address
to begin with... it makes sense to me :>

I think I more agree with you rather than answer you :)

R
-- 
Randall R. Stewart
[email-masked] 815-342-5222 (cell phone)

---

From: Kacheong Poon <[email-masked]>
Date: Fri, 11 Jan 2002 14:54:50 -0800 (PST)

> Ipv4 address in socket()?

I guess we should correct the above to use mapped addresses also.
The goal is to make things clean so that for v6 socket, one should
not pass in a v4 address structure.

Thanks for pointing this out.

							K. Poon.
							[email-masked]

---

From: Randall Stewart <[email-masked]>
Date: Sat, 12 Jan 2002 02:11:09 -0600

Kacheong:

Somehow I knew we would dis-agree on this :)

From reading the advanced socket BIS Peter and I get
the impression the IPV6_ONLY flag applies to the 
interface... which sort of makes sense since it
says that a mapped address is allowed on a IPv6 socket
that is v6 only....

And that leaves us with the thought that if you don't
have the V6 only flag on then you can pass IPv4 or IPv6
addresses up the socket.

Otherwise you end up doing something really silly in 
both the kernel and app.. i.e:

---on send--
App: Mapps IPv4 address to IPv6
Kernel: Gets address/ checks to see if mapped
Kernel: Unmapps address and calls routine to handle send

OR

---on recv--
Kernel: Mapps IPv4 address to IPv6 and sends up stack
App: gets/address checks to see if its mapped
App: unmapps address and then processes..

This is very very awkward and wastes a lot of cycles
for NO GOOD point.

Now I can see doing the mapping if the IPV6ONLY flag is
applied.. since the app is saying I only deal with V6 addresses.

We have asked Erik what he thinks on this (offline).. since I think
either the advanced socket draft needs more clearification 
and we are really doing something silly besides... or we
have it interpreted right...

I can see if you had a bunch of code that only handled
AF_INET and you needed to preserve as much of it as
possible this mapping thing may be worthwhile.. but in
our case with a new stack it would be awful wasteful and
silly IMHO...

R

---

From: Kacheong Poon <[email-masked]>
Date: Sat, 12 Jan 2002 13:54:13 -0800 (PST)

> says that a mapped address is allowed on a IPv6 socket

Do you mean the IPV6_V6ONLY option as described in the
basic socket draft (draft-ietf-ipngwg-rfc2553bis-04.txt)?
If it is, then I believe it is actually the other way
round.  For example, a v6 TCP socket, for portability reason, 
always works with TCP/IPv4 connections.  That option is
to tell the stack that the socket does not want anything
to do with TCP/IPv4 connections.

> have the V6 only flag on then you can pass IPv4 or IPv6

If I am not mistaken, the IPv6 socket draft says that the
address structure passed in to a v6 socket is the v6
address structure.

> App: unmapps address and then processes..

Hmmm, I believe this is just one way of doing things....

							K. Poon.
							[email-masked]