Subject: Proposed changes in the SCTP socket API draft

From: Kacheong Poon <[email-masked]>
Date: Mon, 20 Oct 2003 17:02:54 -0700

There is one notable change in the version 7 of SCTP socket
API draft on how list of IP addresses are represented.  A
packed array of structures is used instead of an array
of fixed size structures.  Besides the fact that it is
incompatible with the previous drafts, it causes
portability issues and is quite inefficient to
implement.  Unfortunately, the incompatible change was
not discussed in any mailing list before it was made.

In light of the issues and the desire to save memory used
in some operating systems, I propose the following
change in how list of IP addresses are represented in the
draft.

int sctp_bindx(int sd, const void *ipaddrs, int addrcnt,
     int flags);

The parameter ipaddrs is either an array of struct in_addr
if sd is a v4 socket or an array of struct in6_addr if
the sd is a v6 socket (v4 address is represented as mapped
address).  This can save memory and copying cost (even more
than that in version 7) for this call and should not
have any portability issue across platforms with different
alignment requirements.  This also follows the fact that
SCTP cares about IP addresses, not socket addresses (there
is no need to replicate some info, such as port).  This
representation of list of IP addresses also applies to
sctp_getladdrs(), sctp_getpaddrs(), and sctp_connectx().

A variant of the above which can be implemented as a
replacement of bind() can be defined like

int sctp_bindx(int sd, const struct sockaddr *addr, int len,
     const void *ipaddrs, int addrcnt, int flags);

The additional parameters addr and len are the equivalents
of what should be passed in the bind() call.

Please comment on these changes.  I know that the IETF
is near so these changes may not be discussed in the next
IETF.  But do make suggestions on the above.  Thanks.

-- 

						K. Poon.
						[email-masked]

---

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Tue, 21 Oct 2003 05:44:22 -0500

Kacheong:

I guess I am missing something on the "packed array"

If you are in IPv6 you send an array of
sockaddr_in6 (with IPv4 mapped to V6)

If you are in IPv4 you get send an array of
sockaddr_in's

I am not sure packed array is the right terminlogy.. but I do
see that the array of sockaddr_in6 will cause a 64 bit alignment
error.

But will not your array of in_addr's also cause 64 bit aligment issues
as well.. and of course you will loose the ability to call
sctp_bindx() by itself and forever need to call

bind()
sctp_bindx()

I would think you would want to at least add a port number so I
only have one call to make...

But I am not sure I see the advantage of sending arry's of in_addr or
in6_addr vs arry's of sockaddr_in and sockaddr_in6...

It could save us a few bytes in the kernel to user space transition though..

R

-- 
Randall R. Stewart
ITD
Cisco Systems Inc.
[email-masked] 815-342-5222(cell) or 815-477-2127(office)

---

From: Kacheong Poon <[email-masked]>
Date: Tue, 21 Oct 2003 12:53:34 -0700

> sockaddr_in6 (with IPv4 mapped to V6)

This is not what is specified in the v7 draft.  Please
read it again.

What you are saying above is indeed not a packed array.
But it is also incompatible with what is specified in
the v7 draft.  The point I am trying to make is we should
get rid of packed array.

> only have one call to make...

Check the variant in my previous mail.  It includes a socket
address, which includes the port number.

> It could save us a few bytes in the kernel to user space transition 

My main objection is the packed array.  If people really
like to waste space with duplicate info (such as port),
I am fine with that.  But from what I heard, the main
reason for the incompatible v7 changes was because of
memory usage in copying the sockaddr_storage array.
I guess people will really like to save more space.

-- 

						K. Poon.
						[email-masked]

---

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Tue, 21 Oct 2003 16:23:10 -0500

> I guess people will really like to save more space.
a sockaddr storage is 256 bytes.
a sockaddr_in is 16 bytes
and
a sockaddr_in6 is 28 bytes

I can put 9 sockaddr_in6's in a sockaddr_storage structure
I can put 16 sockaddr_in's in a sockaddr_storage structure

There is an extreme magnitude of difference between the
sockaddr_inX and sockaddr_storage sizes..

I will take a look at the v7 draft again.. it seems to me the word you
are hostile to is packed.. and I think we can easily take that word
out of the document...

R