* Re: [PATCH] sctp: fix missing send up SCTP_SENDER_DRY_EVENT when subscribe it
2011-07-02 19:18 [PATCH] sctp: fix missing send up SCTP_SENDER_DRY_EVENT when subscribe it Wei Yongjun
@ 2011-07-02 11:55 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-07-02 11:55 UTC (permalink / raw)
To: weiyj.lk; +Cc: netdev, linux-sctp, Michael.Tuexen, seggelmann
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Sun, 03 Jul 2011 03:18:56 +0800
> @@ -2073,10 +2073,33 @@ static int
> sctp_setsockopt_disable_fragments(struct sock *sk,
Patch corrupted by your email client.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] sctp: fix missing send up SCTP_SENDER_DRY_EVENT when subscribe it
@ 2011-07-02 19:18 Wei Yongjun
2011-07-02 11:55 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2011-07-02 19:18 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-sctp, Michael Tüxen, Robin Seggelmann
From: Wei Yongjun<yjwei@cn.fujitsu.com>
We forgot to send up SCTP_SENDER_DRY_EVENT notification when
user app subscribes to this event, and there is no data to be
sent or retransmit.
This is required by the Socket API and used by the DTLS/SCTP
implementation.
Reported-by: Michael Tüxen<Michael.Tuexen@lurchi.franken.de>
Signed-off-by: Wei Yongjun<yjwei@cn.fujitsu.com>
Tested-by: Robin Seggelmann<seggelmann@fh-muenster.de>
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6766913..99e25de 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2073,10 +2073,33 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk,
static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
unsigned int optlen)
{
+ struct sctp_association *asoc;
+ struct sctp_ulpevent *event;
+
if (optlen> sizeof(struct sctp_event_subscribe))
return -EINVAL;
if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
return -EFAULT;
+
+ /*
+ * 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(SCTP_SENDER_DRY_EVENT,
+ &sctp_sk(sk)->subscribe)) {
+ asoc = sctp_id2assoc(sk, 0);
+
+ if (asoc&& sctp_outq_is_empty(&asoc->outqueue)) {
+ event = sctp_ulpevent_make_sender_dry_event(asoc,
+ GFP_ATOMIC);
+ if (!event)
+ return -ENOMEM;
+
+ sctp_ulpq_tail_event(&asoc->ulpq, event);
+ }
+ }
+
return 0;
}
--
1.7.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-02 11:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-02 19:18 [PATCH] sctp: fix missing send up SCTP_SENDER_DRY_EVENT when subscribe it Wei Yongjun
2011-07-02 11:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).