Subject: [Tsvwg] SCTP: association id of outgoing connection

From: Petr Malát <[email-masked]>
Date: Sun, 22 Mar 2009 12:38:37 +0100

Hi all,
according to draft-ietf-tsvwg-sctpsocket-19.txt there is no (easy) way to get 
association id of outgoing connection. There are at least two situations when 
this is needed:
 * You make new association from socket which is also in listening state - you 
need to distinguish newly created outgoing association and incoming 
associations. (this is what I do)
 * When you want to start multiple associations in nonblocking mode from one 
socket.

I've patched linux implementation for myself to support this and I will 
appreciate official way to do this.

My solution:
New sctp msg_control structure:
struct sctp_assocstart {
     sctp_assoc_t sinfo_assoc_id;
};

Subscription for it:
struct sctp_event_subscribe{
     /* ... */
     uint8_t sctp_association_start_event;  
};

Define for subscription and cmsg_type
SCTP_ASSOC_START

After subscribing to SCTP_ASSOC_START cmsg with sctp_assocstart structure is 
pushed into ancillary data buffer when creating new association trough 
sendmsg().
	Petr

---

From: Randy Stewart <[email-masked]>
Date: Sun, 22 Mar 2009 10:42:14 -0400

Petr:

Does not the linux implementation support sctp_connectx()...

When you use this method you can pass in a pointer to
the an assoc id and it is returned filled in with the newly
forming asoc-id..

i.e.:

int sctp_connectx(int sd,
                      struct sockaddr *addrs,
                      int addrcnt,
                      sctp_assoc_t *id);

This is one of the purposes of the call.. the other being to
allow multiple addresses to be attempted to connect to.

Why does this not suffice?

R

> pushed into ancillary data buffer when creating new association trough

-----
Randall Stewart
[email-masked]

---

From: Petr Malát <[email-masked]>
Date: Sun, 22 Mar 2009 19:20:07 +0100

I've forgotten to write I'm programming for kernel space and there are only 
the typical socket calls available. But you pointed me the right way and I've 
found it is possible to call sctp_connectx trough setsockopt(). Thanks a lot
  Petr