Cleanup the stream reset and asconf timer.

MFC after:		1 week
This commit is contained in:
Michael Tuexen 2020-03-19 18:55:54 +00:00
parent 87d8d5ea3d
commit e95b3d7faf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359151
3 changed files with 20 additions and 16 deletions

View File

@ -1103,10 +1103,9 @@ sctp_cookie_timer(struct sctp_inpcb *inp,
}
int
sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
struct sctp_nets *net)
sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
{
struct sctp_nets *alt;
struct sctp_nets *alt, *net;
struct sctp_tmit_chunk *strrst = NULL, *chk = NULL;
if (stcb->asoc.stream_reset_outstanding == 0) {
@ -1117,9 +1116,9 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
if (strrst == NULL) {
return (0);
}
net = strrst->whoTo;
/* do threshold management */
if (sctp_threshold_management(inp, stcb, strrst->whoTo,
stcb->asoc.max_send_times)) {
if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
/* Assoc is over */
return (1);
}
@ -1127,9 +1126,8 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
* Cleared threshold management, now lets backoff the address and
* select an alternate
*/
sctp_backoff_on_timeout(stcb, strrst->whoTo, 1, 0, 0);
alt = sctp_find_alternate_net(stcb, strrst->whoTo, 0);
sctp_free_remote_addr(strrst->whoTo);
sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
alt = sctp_find_alternate_net(stcb, net, 0);
strrst->whoTo = alt;
atomic_add_int(&alt->ref_count, 1);
@ -1154,6 +1152,8 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
*/
sctp_move_chunks_from_net(stcb, net);
}
sctp_free_remote_addr(net);
/* mark the retran info */
if (strrst->sent != SCTP_DATAGRAM_RESEND)
sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
@ -1161,7 +1161,7 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
strrst->flags |= CHUNK_FLAGS_FRAGMENT_OK;
/* restart the timer */
sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, strrst->whoTo);
sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, inp, stcb, alt);
return (0);
}
@ -1186,8 +1186,9 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
if (asconf == NULL) {
return (0);
}
net = asconf->whoTo;
/* do threshold management */
if (sctp_threshold_management(inp, stcb, asconf->whoTo,
if (sctp_threshold_management(inp, stcb, net,
stcb->asoc.max_send_times)) {
/* Assoc is over */
return (1);
@ -1208,10 +1209,9 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
* cleared threshold management, so now backoff the net and
* select an alternate
*/
sctp_backoff_on_timeout(stcb, asconf->whoTo, 1, 0, 0);
alt = sctp_find_alternate_net(stcb, asconf->whoTo, 0);
sctp_backoff_on_timeout(stcb, net, 1, 0, 0);
alt = sctp_find_alternate_net(stcb, net, 0);
if (asconf->whoTo != alt) {
sctp_free_remote_addr(asconf->whoTo);
asconf->whoTo = alt;
atomic_add_int(&alt->ref_count, 1);
}
@ -1248,6 +1248,8 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
*/
sctp_move_chunks_from_net(stcb, net);
}
sctp_free_remote_addr(net);
/* mark the retran info */
if (asconf->sent != SCTP_DATAGRAM_RESEND)
sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);

View File

@ -50,12 +50,15 @@ sctp_find_alternate_net(struct sctp_tcb *,
int
sctp_t3rxt_timer(struct sctp_inpcb *, struct sctp_tcb *,
struct sctp_nets *);
int
sctp_t1init_timer(struct sctp_inpcb *, struct sctp_tcb *,
struct sctp_nets *);
int
sctp_shutdown_timer(struct sctp_inpcb *, struct sctp_tcb *,
struct sctp_nets *);
int
sctp_heartbeat_timer(struct sctp_inpcb *, struct sctp_tcb *,
struct sctp_nets *);
@ -72,8 +75,7 @@ int
sctp_shutdownack_timer(struct sctp_inpcb *, struct sctp_tcb *,
struct sctp_nets *);
int
sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
struct sctp_nets *net);
sctp_strreset_timer(struct sctp_inpcb *, struct sctp_tcb *);
int
sctp_asconf_timer(struct sctp_inpcb *, struct sctp_tcb *,

View File

@ -1939,7 +1939,7 @@ sctp_timeout_handler(void *t)
if ((stcb == NULL) || (inp == NULL)) {
break;
}
if (sctp_strreset_timer(inp, stcb, net)) {
if (sctp_strreset_timer(inp, stcb)) {
/* no need to unlock on tcb its gone */
goto out_decr;
}