1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

Fix an issue with MAC OS locking and also optimize the case

where we are sending back a stream-reset and a sack timer is running, in
that case we should just send the SACK.

MFC after:	3 weeks
This commit is contained in:
Randall Stewart 2015-07-24 14:09:03 +00:00
parent 24ef74209a
commit c616859963
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285837
4 changed files with 16 additions and 9 deletions

View File

@ -3764,7 +3764,7 @@ sctp_handle_stream_reset_response(struct sctp_tcb *stcb,
} }
} }
if (asoc->stream_reset_outstanding == 0) { if (asoc->stream_reset_outstanding == 0) {
sctp_send_stream_reset_out_if_possible(stcb); sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED);
} }
return (0); return (0);
} }
@ -3832,7 +3832,7 @@ sctp_handle_str_reset_request_in(struct sctp_tcb *stcb,
} else { } else {
sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO);
} }
sctp_send_stream_reset_out_if_possible(stcb); sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED);
} }
static int static int
@ -3957,6 +3957,7 @@ sctp_handle_str_reset_request_out(struct sctp_tcb *stcb,
memcpy(&liste->list_of_streams, req->list_of_streams, number_entries * sizeof(uint16_t)); memcpy(&liste->list_of_streams, req->list_of_streams, number_entries * sizeof(uint16_t));
TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp); TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp);
asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_IN_PROGRESS; asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_IN_PROGRESS;
x
} }
sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]);
asoc->str_reset_seq_in++; asoc->str_reset_seq_in++;

View File

@ -10104,7 +10104,7 @@ sctp_chunk_output(struct sctp_inpcb *inp,
sctp_fix_ecn_echo(asoc); sctp_fix_ecn_echo(asoc);
if (stcb->asoc.trigger_reset) { if (stcb->asoc.trigger_reset) {
if (sctp_send_stream_reset_out_if_possible(stcb) == 0) { if (sctp_send_stream_reset_out_if_possible(stcb, so_locked) == 0) {
goto do_it_again; goto do_it_again;
} }
} }
@ -11839,7 +11839,7 @@ sctp_add_an_in_stream(struct sctp_tmit_chunk *chk,
} }
int int
sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb) sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb, int so_locked)
{ {
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_tmit_chunk *chk; struct sctp_tmit_chunk *chk;
@ -11865,7 +11865,7 @@ sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb)
chk->book_size_scale = 0; chk->book_size_scale = 0;
chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA);
if (chk->data == NULL) { if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); sctp_free_a_chunk(stcb, chk, so_locked);
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
return (ENOMEM); return (ENOMEM);
} }
@ -11892,7 +11892,7 @@ sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb)
} else { } else {
m_freem(chk->data); m_freem(chk->data);
chk->data = NULL; chk->data = NULL;
sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); sctp_free_a_chunk(stcb, chk, so_locked);
return (ENOENT); return (ENOENT);
} }
asoc->str_reset = chk; asoc->str_reset = chk;
@ -11901,6 +11901,10 @@ sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb)
chk, chk,
sctp_next); sctp_next);
asoc->ctrl_queue_cnt++; asoc->ctrl_queue_cnt++;
if (stcb->asoc.send_sack) {
sctp_send_sack(stcb, so_locked);
}
sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo); sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
return (0); return (0);
} }
@ -12101,6 +12105,9 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
chk, chk,
sctp_next); sctp_next);
asoc->ctrl_queue_cnt++; asoc->ctrl_queue_cnt++;
if (stcb->asoc.send_sack) {
sctp_send_sack(stcb, SCTP_SO_LOCKED);
}
sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo); sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo);
return (0); return (0);
} }

View File

@ -181,7 +181,7 @@ void
sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *, sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *,
uint32_t, uint32_t, uint32_t, uint32_t); uint32_t, uint32_t, uint32_t, uint32_t);
int int
sctp_send_stream_reset_out_if_possible(struct sctp_tcb *); sctp_send_stream_reset_out_if_possible(struct sctp_tcb *, int);
int int
sctp_send_str_reset_req(struct sctp_tcb *, uint16_t, uint16_t *, sctp_send_str_reset_req(struct sctp_tcb *, uint16_t, uint16_t *,

View File

@ -4689,8 +4689,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
strrst->srs_stream_list, strrst->srs_stream_list,
send_in, 0, 0, 0, 0, 0); send_in, 0, 0, 0, 0, 0);
} else } else
error = sctp_send_stream_reset_out_if_possible(stcb); error = sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_LOCKED);
if (!error) if (!error)
sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);