diff options
Diffstat (limited to 'include/net/sctp/sctp.h')
-rw-r--r-- | include/net/sctp/sctp.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index f6e7397e799d..9fbd856e6713 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -320,6 +320,19 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | |||
320 | return asoc ? asoc->assoc_id : 0; | 320 | return asoc ? asoc->assoc_id : 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | static inline enum sctp_sstat_state | ||
324 | sctp_assoc_to_state(const struct sctp_association *asoc) | ||
325 | { | ||
326 | /* SCTP's uapi always had SCTP_EMPTY(=0) as a dummy state, but we | ||
327 | * got rid of it in kernel space. Therefore SCTP_CLOSED et al | ||
328 | * start at =1 in user space, but actually as =0 in kernel space. | ||
329 | * Now that we can not break user space and SCTP_EMPTY is exposed | ||
330 | * there, we need to fix it up with an ugly offset not to break | ||
331 | * applications. :( | ||
332 | */ | ||
333 | return asoc->state + 1; | ||
334 | } | ||
335 | |||
323 | /* Look up the association by its id. */ | 336 | /* Look up the association by its id. */ |
324 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); | 337 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); |
325 | 338 | ||