Subject: SCTP_PEER_ADDR_PARAMS and one-to-one sockets

From: "Jan Newmarch" <[email-masked]>
Date: Thu, 19 Apr 2007 22:12:54 +1000

Hi

The Stevens book in Figure 23.13 gives code using sctp_opt_info(...
SCTP_PEER_ADDR_PARAMS ...) to find the association id directly rather
than monitoring association events. I presume this code works under
BSD since that seems to have been the author's test environment. But
it doesn't work on the one-to-one model under Linux.

The spec in 7.1.13 says about the struct sctp_paddrparams:
"spp_assoc_id    - (one-to-many style socket) This is filled in the
application, and identifies the association for this query". But it
doesn't say anything about the one-to-one style socket. The Linux code
doesn't fill in a value for the association id, but I presume the BSD
does. Other parts of the spec say what should happen to the one-to-one
model for other calls, so shoud this one too?

 I would prefer the spec to also say: "For the one-to-one model the
value is filled in by the sctp_opt_info call and returned to the
user"?

Jan
--

---

From: Randall Stewart <[email-masked]>
Date: Sun, 22 Apr 2007 07:44:32 -0400

> it doesn't work on the one-to-one model under Linux.

Try using SCTP_GET_PEER_ADDR_INFO.

The socket api specifies this to be the mechanism to get the
assoc id. Note that this was not true when the Stevens book
was written.. In BSD you can use eitehr PEER_ADDR_PARAMS or
GET_PEER_ADDR_INFO.. but obviously you can't for linux :-)

Note too, that for the one-2-one style socket I don't think (if
I remember right) solaris actually will give you an assoc_id...
or if it does its not really used... always 1 or something..

BSD and Linux give you a real asoc_id...
> model for other calls, so shoud this one too?

I think you should look at 7.2.2

    spinfo_assoc_id -  This is field may be filled in by the application,
       if so, this field will have priority in looking up the association
       over the address specified in spinfo_address.  Note that if the
       address does not belong to the association specified then this
       call will fail.  If the application does NOT fill in the
       spinfo_assoc_id, then the address will be used to lookup the
       association and on return this field will have the valid
       association id.  In other words, this call can be used to
       translate a address into an association id.

This will give you what you want.. in theory... not sure if linux
will give it to you on the one-2-one model.. it should I think..

> value is filled in by the sctp_opt_info call and returned to the

R

-- 
Randall Stewart
NSSTG - Cisco Systems Inc.
803-345-0369 <or> 803-317-4952 (cell)