Subject: Quetion about sctp_get[lp]addrs().

From: KOZUKA Masahiro <[email-masked]>
Date: Sun, 21 Mar 2004 02:48:57 +0900

Hi, sctp-impl.
I have a question about sctp_get[lp]addrs().
These functions have the following arguments.
	(int sock, sctp_assoc_t id, struct sockaddr **raddrs);

I think that on this specification we can't use raddrs for getnameinfo(), or
it is hard.
Because to use  getnameinfo() we must set salen for sockaddr's length, but
sctp_get[lp]addrs() doesn't give us the information....

This problem doesn't appear on BSD system, it has sa_len on sockaddr.
But this programing style isn't recommended. On Linux system
there is no sa_le, so it doesn't work on Linux system.
We should add sockaddr's length to sctp_get[lp]addrs()?

P.S.
	I noticed that SCTP Socket API Internet-Draft expireed.
	What happened?:)
-- 
{^-^}/@kozuka.jp / KOZUKA Masahiro

---

From: "Randall Stewart (cisco)" <[email-masked]>
Date: Wed, 24 Mar 2004 05:59:46 -0600

>	I noticed that SCTP Socket API Internet-Draft expireed.
Masahiro-san

Yes, it is true that only BSD has the sa_len. But a couple of things:

1) If you have an AF_INET6 socket and you specify the default
    behavior (according to the socket draft), all addresses will
    be mapped to V6.

2) If you have an AF_INET socket and you do this... all you get
    is  V4 addresses.

3) If you do turn off the mapped addresses (yes I know kame does
    this by default) you will get a mix of AF_INET and AF_INET6 
addresses (yes
    Kacheong I know you hate this :-0). But even if you did this in 
linux land or
    wanted portable code .. one could do
struct sockaddr *sa;
int not_done=0;
not_done =  sctp_get[lp]addrs(&sa);
while(not_done)
    if(sa->sa_family == AF_INET)
          len = sizeof(struct sockaddr_in)
    else if(sa->sa_family == AF_INET6)
          len = sizeof(struct sockaddr_in6_
    else
          break;
    print-address(sa);
    sa = ((caddr_t)sa + len);
    not_done--;
}

This will work no matter which O/S you have.

R

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

---

From: Vladislav Yasevich <[email-masked]>
Date: Thu, 25 Mar 2004 09:42:25 -0500

Masahiro

Changing the sctp API is only a small part of the problem that
you are facing.  The same type of problem exists with TCP and
UDP sockets.  It is simply because Linux doesn't implement
BSD 4.4 style sockaddr structures that introduced sa_len field.

The linux kernel doesn't know how to handle sockaddrs that
have a length specified in them at the API level.  That would
have to be fixed before the sctp API can be updated.

Otherwise, the SCTP API library on linux would face the same
problem you are facing in your code.  It would have to change
to support future addressing extensions (which hopefully the
will not be any :).

-vlad

-- 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Vladislav Yasevich		Linux and Open Source Lab
Hewlett Packard 		Tel: (603) 884-1079
Nashua, NH 03062		ZKO3-3/T07