aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2008-09-04 20:55:26 -0400
committerVlad Yasevich <vladislav.yasevich@hp.com>2008-10-01 11:34:16 -0400
commit536428a9b9a98495f7ea54ad95cad83e22f1d47d (patch)
treea4a38e61207bf6144945cc5bf23cc78c8fa3bbb4
parent52cae8f06babf9eed327479c1aa024ce3732f912 (diff)
sctp: Fix to start T5-shutdown-guard timer while enter SHUTDOWN-SENT state
RFC 4960: Section 9.2 The sender of the SHUTDOWN MAY also start an overall guard timer 'T5-shutdown-guard' to bound the overall time for the shutdown sequence. At the expiration of this timer, the sender SHOULD abort the association by sending an ABORT chunk. If the 'T5-shutdown- guard' timer is used, it SHOULD be set to the recommended value of 5 times 'RTO.Max'. The timer 'T5-shutdown-guard' is used to counter the overall time for shutdown sequence, and it's start by the sender of the SHUTDOWN. So timer 'T5-shutdown-guard' should be start when we send the first SHUTDOWN chunk and enter the SHUTDOWN-SENT state, not start when we receipt of the SHUTDOWN primitive and enter SHUTDOWN-PENDING state. If 'T5-shutdown-guard' timer is start at SHUTDOWN-PENDING state, the association may be ABORT while data is still transmitting. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
-rw-r--r--net/sctp/sm_statefuns.c24
-rw-r--r--net/sctp/sm_statetable.c2
2 files changed, 8 insertions, 18 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 7c622af2ce55..e57d1d3ad0a6 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -2076,10 +2076,6 @@ sctp_disposition_t sctp_sf_shutdown_pending_abort(
2076 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest)) 2076 sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
2077 return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); 2077 return sctp_sf_discard_chunk(ep, asoc, type, arg, commands);
2078 2078
2079 /* Stop the T5-shutdown guard timer. */
2080 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
2081 SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD));
2082
2083 return __sctp_sf_do_9_1_abort(ep, asoc, type, arg, commands); 2079 return __sctp_sf_do_9_1_abort(ep, asoc, type, arg, commands);
2084} 2080}
2085 2081
@@ -4543,13 +4539,6 @@ sctp_disposition_t sctp_sf_do_9_2_prm_shutdown(
4543 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 4539 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
4544 SCTP_STATE(SCTP_STATE_SHUTDOWN_PENDING)); 4540 SCTP_STATE(SCTP_STATE_SHUTDOWN_PENDING));
4545 4541
4546 /* sctpimpguide-05 Section 2.12.2
4547 * The sender of the SHUTDOWN MAY also start an overall guard timer
4548 * 'T5-shutdown-guard' to bound the overall time for shutdown sequence.
4549 */
4550 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START,
4551 SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD));
4552
4553 disposition = SCTP_DISPOSITION_CONSUME; 4542 disposition = SCTP_DISPOSITION_CONSUME;
4554 if (sctp_outq_is_empty(&asoc->outqueue)) { 4543 if (sctp_outq_is_empty(&asoc->outqueue)) {
4555 disposition = sctp_sf_do_9_2_start_shutdown(ep, asoc, type, 4544 disposition = sctp_sf_do_9_2_start_shutdown(ep, asoc, type,
@@ -4994,6 +4983,13 @@ sctp_disposition_t sctp_sf_do_9_2_start_shutdown(
4994 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, 4983 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START,
4995 SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN)); 4984 SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN));
4996 4985
4986 /* RFC 4960 Section 9.2
4987 * The sender of the SHUTDOWN MAY also start an overall guard timer
4988 * 'T5-shutdown-guard' to bound the overall time for shutdown sequence.
4989 */
4990 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START,
4991 SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD));
4992
4997 if (asoc->autoclose) 4993 if (asoc->autoclose)
4998 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, 4994 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
4999 SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); 4995 SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE));
@@ -5520,12 +5516,6 @@ sctp_disposition_t sctp_sf_autoclose_timer_expire(
5520 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 5516 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
5521 SCTP_STATE(SCTP_STATE_SHUTDOWN_PENDING)); 5517 SCTP_STATE(SCTP_STATE_SHUTDOWN_PENDING));
5522 5518
5523 /* sctpimpguide-05 Section 2.12.2
5524 * The sender of the SHUTDOWN MAY also start an overall guard timer
5525 * 'T5-shutdown-guard' to bound the overall time for shutdown sequence.
5526 */
5527 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START,
5528 SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD));
5529 disposition = SCTP_DISPOSITION_CONSUME; 5519 disposition = SCTP_DISPOSITION_CONSUME;
5530 if (sctp_outq_is_empty(&asoc->outqueue)) { 5520 if (sctp_outq_is_empty(&asoc->outqueue)) {
5531 disposition = sctp_sf_do_9_2_start_shutdown(ep, asoc, type, 5521 disposition = sctp_sf_do_9_2_start_shutdown(ep, asoc, type,
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index d991237fb400..dd4ddc40c0ad 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -897,7 +897,7 @@ static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_
897 /* SCTP_STATE_ESTABLISHED */ \ 897 /* SCTP_STATE_ESTABLISHED */ \
898 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \ 898 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
899 /* SCTP_STATE_SHUTDOWN_PENDING */ \ 899 /* SCTP_STATE_SHUTDOWN_PENDING */ \
900 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \ 900 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
901 /* SCTP_STATE_SHUTDOWN_SENT */ \ 901 /* SCTP_STATE_SHUTDOWN_SENT */ \
902 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \ 902 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
903 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \ 903 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \