diff options
| -rw-r--r-- | include/net/sctp/sctp.h | 13 | ||||
| -rw-r--r-- | net/sctp/socket.c | 2 |
2 files changed, 14 insertions, 1 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 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index eb71d49e7653..634a2abb5f3a 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -4243,7 +4243,7 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, | |||
| 4243 | transport = asoc->peer.primary_path; | 4243 | transport = asoc->peer.primary_path; |
| 4244 | 4244 | ||
| 4245 | status.sstat_assoc_id = sctp_assoc2id(asoc); | 4245 | status.sstat_assoc_id = sctp_assoc2id(asoc); |
| 4246 | status.sstat_state = asoc->state; | 4246 | status.sstat_state = sctp_assoc_to_state(asoc); |
| 4247 | status.sstat_rwnd = asoc->peer.rwnd; | 4247 | status.sstat_rwnd = asoc->peer.rwnd; |
| 4248 | status.sstat_unackdata = asoc->unack_data; | 4248 | status.sstat_unackdata = asoc->unack_data; |
| 4249 | 4249 | ||
