Subject: SCTP_GET_ASOC_ID_LIST query

From: "Jan Newmarch" <[email-masked]>
Date: Sat, 28 Apr 2007 23:41:22 +1000

Hi

The socket option SCTP_GET_ASOC_ID_LIST in draft 14, section 7.2.5 is
missing from Linux, so I thought I would have a go at putting it in.
Easy enough, but I have some unease at the spec:

"asls_assoc_start -  This parameter gives an initial starting place to
      begin collecting association information.  Normally a user sets
      this initially to 0.  Subsequent calls that need to get more
      association identifications (in cases where the socket has more
      than MAX_ASOC_IDS_RET established i.e asls_more_to_get returns set
      to false) are made by incrementing the asls_assoc_start by the
      number of previous association id's seen.  This cycle is repeated
      until the asls_more_to_get field becomes true, indicating that all
      association id's have been retrieved.
"

There is a potential race here if there are more than MAX_ASOC_IDS_RET
associations exist. If you do have that many associations, then I
would guess associations coming and going would be pretty common, so
in between getting the first group and any subsequent group there
could be a number of changes to the entire set. Depending on how it is
implemented, any successive get could return unexpected results, such
as repeating entries from the first get. I couldn't find anything in
the archives about this (they only seem to be searchable on subject,
not contents).

Some ways of satisfying this spec and avoiding the race, such as
keeping a complete snapshot (in kernel space!) or putting a lock on
new associations (for how long?) just don't seem acceptable.

What I have seen in other situations is:
- you ask for X values max
- you get back Y values (Y <= X)
- you also get back Z, the total number you could have got if X was big enough

Then if Z is bigger than X and you want a complete set at some
instance of time, you keep increasing X and retrying until Z  <= X and
you have all values. But that would mean changing this spec...

Is there another way?

BTW:  is the value of asls_more_to_get the wrong way round? The spec
says set to true if all values have been received, shouldn't it be
false?

Cheers

Jan
--