Skip to content

Commit

Permalink
sctp: start t5 timer only when peer rwnd is 0 and local state is SHUT…
Browse files Browse the repository at this point in the history
…DOWN_PENDING

when A sends a data to B, then A close() and enter into SHUTDOWN_PENDING
state, if B neither claim his rwnd is 0 nor send SACK for this data, A
will keep retransmitting this data until t5 timeout, Max.Retrans times
can't work anymore, which is bad.

if B's rwnd is not 0, it should send abort after Max.Retrans times, only
when B's rwnd == 0 and A's retransmitting beyonds Max.Retrans times, A
will start t5 timer, which is also commit f8d9605 ("sctp: Enforce
retransmission limit during shutdown") means, but it lacks the condition
peer rwnd == 0.

so fix it by adding a bit (zero_window_announced) in peer to record if
the last rwnd is 0. If it was, zero_window_announced will be set. and use
this bit to decide if start t5 timer when local.state is SHUTDOWN_PENDING.

Fixes: commit f8d9605 ("sctp: Enforce retransmission limit during shutdown")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
lucien authored and David S. Miller committed Dec 7, 2015
1 parent 8b570dc commit 8a0d19c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/net/sctp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,8 @@ struct sctp_association {
* : SACK's are not delayed (see Section 6).
*/
__u8 sack_needed:1, /* Do we need to sack the peer? */
sack_generation:1;
sack_generation:1,
zero_window_announced:1;
__u32 sack_cnt;

__u32 adaptation_ind; /* Adaptation Code point. */
Expand Down
1 change: 1 addition & 0 deletions net/sctp/outqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
*/

sack_a_rwnd = ntohl(sack->a_rwnd);
asoc->peer.zero_window_announced = !sack_a_rwnd;
outstanding = q->outstanding_bytes;

if (outstanding < sack_a_rwnd)
Expand Down
3 changes: 2 additions & 1 deletion net/sctp/sm_statefuns.c
Original file line number Diff line number Diff line change
Expand Up @@ -5412,7 +5412,8 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(struct net *net,
SCTP_INC_STATS(net, SCTP_MIB_T3_RTX_EXPIREDS);

if (asoc->overall_error_count >= asoc->max_retrans) {
if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING) {
if (asoc->peer.zero_window_announced &&
asoc->state == SCTP_STATE_SHUTDOWN_PENDING) {
/*
* We are here likely because the receiver had its rwnd
* closed for a while and we have not been able to
Expand Down

0 comments on commit 8a0d19c

Please sign in to comment.