summaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2018-11-18 16:08:52 +0800
committerDavid S. Miller <davem@davemloft.net>2018-11-19 12:25:43 -0800
commita1e3a0590f9bd232f3a03fd87226a4a99bd5ec92 (patch)
tree297cba2473cc25cc11b9aa5d5bc49a3b6b3d9e81 /net/sctp/socket.c
parent2cc0eeb67636e0339ad7b6cdfa305f63983642af (diff)
downloadlinux-a1e3a0590f9bd232f3a03fd87226a4a99bd5ec92.tar.bz2
sctp: add subscribe per asoc
The member subscribe should be per asoc, so that sockopt SCTP_EVENT in the next patch can subscribe a event from one asoc only. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9d7512958a6a..c7718272d69b 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2307,6 +2307,7 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
struct sctp_event_subscribe subscribe;
__u8 *sn_type = (__u8 *)&subscribe;
struct sctp_sock *sp = sctp_sk(sk);
+ struct sctp_association *asoc;
int i;
if (optlen > sizeof(struct sctp_event_subscribe))
@@ -2319,14 +2320,17 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
sctp_ulpevent_type_set(&sp->subscribe, SCTP_SN_TYPE_BASE + i,
sn_type[i]);
+ list_for_each_entry(asoc, &sp->ep->asocs, asocs)
+ asoc->subscribe = sctp_sk(sk)->subscribe;
+
/* At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
* if there is no data to be sent or retransmit, the stack will
* immediately send up this notification.
*/
if (sctp_ulpevent_type_enabled(sp->subscribe, SCTP_SENDER_DRY_EVENT)) {
- struct sctp_association *asoc = sctp_id2assoc(sk, 0);
struct sctp_ulpevent *event;
+ asoc = sctp_id2assoc(sk, 0);
if (asoc && sctp_outq_is_empty(&asoc->outqueue)) {
event = sctp_ulpevent_make_sender_dry_event(asoc,
GFP_USER | __GFP_NOWARN);