diff options
author | Xin Long <lucien.xin@gmail.com> | 2019-01-28 08:08:33 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-01-30 09:44:07 +0100 |
commit | e7f282489123d88f5d412c837775e3e8c0f5521f (patch) | |
tree | 94b44961e66191f84bb7dc74d349b0d047216549 /net/sctp/socket.c | |
parent | sctp: use SCTP_FUTURE_ASSOC for SCTP_INTERLEAVING_SUPPORTED sockopt (diff) | |
download | linux-e7f282489123d88f5d412c837775e3e8c0f5521f.tar.xz linux-e7f282489123d88f5d412c837775e3e8c0f5521f.zip |
sctp: add SCTP_CURRENT_ASSOC for SCTP_STREAM_SCHEDULER_VALUE sockopt
SCTP_STREAM_SCHEDULER_VALUE is a special one, as its value is not
save in sctp_sock, but only in asoc. So only SCTP_CURRENT_ASSOC
reserved assoc_id can be used in sctp_setsockopt_scheduler_value.
This patch adds SCTP_CURRENT_ASOC support for
SCTP_STREAM_SCHEDULER_VALUE.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/sctp/socket.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index b9263ad6a3a1..bf915912a2e6 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -4211,8 +4211,8 @@ static int sctp_setsockopt_scheduler_value(struct sock *sk, char __user *optval, unsigned int optlen) { - struct sctp_association *asoc; struct sctp_stream_value params; + struct sctp_association *asoc; int retval = -EINVAL; if (optlen < sizeof(params)) @@ -4225,11 +4225,24 @@ static int sctp_setsockopt_scheduler_value(struct sock *sk, } asoc = sctp_id2assoc(sk, params.assoc_id); - if (!asoc) + if (!asoc && params.assoc_id != SCTP_CURRENT_ASSOC && + sctp_style(sk, UDP)) goto out; - retval = sctp_sched_set_value(asoc, params.stream_id, - params.stream_value, GFP_KERNEL); + if (asoc) { + retval = sctp_sched_set_value(asoc, params.stream_id, + params.stream_value, GFP_KERNEL); + goto out; + } + + retval = 0; + + list_for_each_entry(asoc, &sctp_sk(sk)->ep->asocs, asocs) { + int ret = sctp_sched_set_value(asoc, params.stream_id, + params.stream_value, GFP_KERNEL); + if (ret && !retval) /* try to return the 1st error. */ + retval = ret; + } out: return retval; |