Not only stop all timers when entering the SHUTDOWN_SENT state,

but also when entering the SHUTDOWN_ACK_SEND state.

MFC after: 3 days.
This commit is contained in:
Michael Tuexen 2010-11-07 14:39:40 +00:00
parent ff91cc99dd
commit 12af6654a3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214918
3 changed files with 28 additions and 25 deletions

View File

@ -4369,7 +4369,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
sctp_send_shutdown_ack(stcb,
stcb->asoc.primary_destination);
sctp_stop_timers_for_shutdown(stcb);
sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
stcb->sctp_ep, stcb, asoc->primary_destination);
}
@ -5081,7 +5081,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
sctp_send_shutdown_ack(stcb,
stcb->asoc.primary_destination);
sctp_stop_timers_for_shutdown(stcb);
sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK,
stcb->sctp_ep, stcb, asoc->primary_destination);
return;

View File

@ -908,9 +908,7 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp,
}
SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT);
SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, net,
SCTP_FROM_SCTP_INPUT + SCTP_LOC_7);
/* start SHUTDOWN timer */
sctp_stop_timers_for_shutdown(stcb);
sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep,
stcb, net);
}

View File

@ -724,6 +724,31 @@ sctp_audit_log(uint8_t ev, uint8_t fd)
#endif
/*
* sctp_stop_timers_for_shutdown() should be called
* when entering the SHUTDOWN_SENT or SHUTDOWN_ACK_SENT
* state to make sure that all timers are stopped.
*/
void
sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb)
{
struct sctp_association *asoc;
struct sctp_nets *net;
asoc = &stcb->asoc;
(void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
(void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
(void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
}
}
/*
* a list of sizes based on typical mtu's, used only if next hop size not
* returned.
@ -749,26 +774,6 @@ static int sctp_mtu_sizes[] = {
65535
};
void
sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb)
{
struct sctp_association *asoc;
struct sctp_nets *net;
asoc = &stcb->asoc;
(void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
(void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
(void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
(void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
}
}
int
find_next_best_mtu(int totsz)
{