Subject: Re: sctp_get[lp]addrs() and socklen_t

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Wed, 31 Mar 2004 11:11:52 -0600

Jun-ichiro itojun Hagino wrote:

>	sctp_get[lp]addrs() MUST return socket address length as socklen_t
>	(just like accept()).  otherwise you will not be able to support
>	non AF_INET/INET6 address families.
>

Itojun:

This is not so easy.. a simple return of socklen_t would not
work since you get back an array of the socket addresses.. not a
single address.

Maybe we should, as Masahiro-san says, put an explicit
lenght indicator into the socket API...

I am working on getting Kachong's changes in today.. maybe we
should think about this too???

Comments by others??

R

>
>	switch-case statement like http://www.sctp.org/archive/2015.html is
>	exactly what we are trying to avoid.
>
>itojun
>
>  
>

-- 
Randall R. Stewart
ITD - Transport Technologies
815-477-2127(o) or 815-342-5222(c)

---

From: KOZUKA Masahiro <[email-masked]>
Date: Thu, 1 Apr 2004 09:31:47 +0900

> lenght indicator into the socket API...
In a way, use a new struct(sockaddr * and socklen_t and the next pointer) as
getaddrinfo().
This way isn't so difficult because sctp_freeaddrs() already exists,
I think.

Regards, Masahiro.
-- 
{^-^}/@kozuka.jp / KOZUKA Masahiro

---

From: Kacheong Poon <[email-masked]>
Date: Wed, 31 Mar 2004 19:20:40 -0800

>>     non AF_INET/INET6 address families.

The question is do we really want to support non Internet
address family.  I don't think we want to.  As a matter of fact,
the current SCTP spec does not support non Internet address
family.

>>     exactly what we are trying to avoid.

Note that there is no need to use the switch statement because
the address length is pre-determined by the socket address
family.  The packed array in the -07 version of the draft is
broken.  It is removed from the -08 version.  So each array
element has a fixed size (sizeof (sockaddr_in) or (sockaddr_in6)).

-- 

						K. Poon.
						[email-masked]

---

From: Kacheong Poon <[email-masked]>
Date: Wed, 31 Mar 2004 19:44:02 -0800

Jun-ichiro itojun Hagino wrote:

> 	well, 20 years ago there was no AF_INET6.  you cannot predict the
> 	future so you should prepare for the future (there could be AF_INET7
> 	someday).  socket API was lucky/clever as they always pass socklen_t
> 	as a parameter.

But the point is that even if there is an AF_INET7, there is still
no need to add the switch statement.  The reason is that the
address length of each of the array element is pre-determined by
the address family.  So the program can just use it to pass to
whatever socket call, e.g. getnameinfo() in the original mail.

For example, a program wants to use both IPv4 and IPv6 addresses.
It can always assume that the return address length of the
sctp_get*addrs is sizeof (sockaddr_in6).  When there is IPv7
and assuming that it provides the same compatibility mode as IPv6
(which I assume it has to), then the address length will be
sizeof (sockaddr_in7).  Of course, the assumption here is that
Internet address is of fixed size.

Note that we are talking about Internet address family here, not
other address family, such as UNIX domain socket.

-- 

						K. Poon.
						[email-masked]

---

From: Kacheong Poon <[email-masked]>
Date: Wed, 31 Mar 2004 19:53:30 -0800

Jun-ichiro itojun Hagino wrote:

> 	and note that we cannot always embed AF_x address into AF_y address.
> 	IPv4 mapped address was just a special case.

The interesting question to ask will be why there is a IPv4 mapped
address notation for IPv6.  I think the reason is that people want
to provide ease of code migration.  If in IPv7, people decided that
there should not be any compatibility mode, then I think we can
safely say that the program code itself has to be changed to deal
with that.  And the catch is that the sctp_get*addrs() still
do not need to be changed as it will return an array of sockaddr_in7
addresses.

I understand that if the address length of IPv7 is not fixed, the
sctp_get*addrs() will fail to work.  But I am not aware of such
kind of address in real network architecture.  Please correct me
if I am wrong.  If 100 years from now, people decide that it is a
good thing to have, variable address length in network packets, then
we are in trouble...  But by then, I think we probably are not using
SCTP anyway (-:

-- 

						K. Poon.
						[email-masked]