提交 ec053510 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Update usrsctp

上级 71446614
# Changelog # Changelog
### 3.6.19 (WIP)
* Update `usrsctp` dependency.
* Update Node deps.
### 3.6.18 ### 3.6.18
* Fix `ortc.getConsumerRtpParameters()` RTX codec comparison issue (PR #453). * Fix `ortc.getConsumerRtpParameters()` RTX codec comparison issue (PR #453).
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
"@typescript-eslint/parser": "^3.10.1", "@typescript-eslint/parser": "^3.10.1",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"eslint": "^7.8.1", "eslint": "^7.8.1",
"eslint-plugin-jest": "^23.20.0", "eslint-plugin-jest": "^24.0.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-clang-format": "^1.0.27", "gulp-clang-format": "^1.0.27",
"jest": "^26.4.2", "jest": "^26.4.2",
......
...@@ -753,7 +753,11 @@ extern void getwintimeofday(struct timeval *tv); ...@@ -753,7 +753,11 @@ extern void getwintimeofday(struct timeval *tv);
#define SCTP_DEFAULT_SPLIT_POINT_MIN 2904 #define SCTP_DEFAULT_SPLIT_POINT_MIN 2904
/* Maximum length of diagnostic information in error causes */ /* Maximum length of diagnostic information in error causes */
#if defined(__Userspace__)
#define SCTP_DIAG_INFO_LEN 256
#else
#define SCTP_DIAG_INFO_LEN 128 #define SCTP_DIAG_INFO_LEN 128
#endif
/* ABORT CODES and other tell-tale location /* ABORT CODES and other tell-tale location
* codes are generated by adding the below * codes are generated by adding the below
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 363194 2020-07-14 20:32:50Z tuexen $"); __FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 364268 2020-08-16 11:50:37Z tuexen $");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -906,7 +906,6 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, ...@@ -906,7 +906,6 @@ sctp_handle_abort(struct sctp_abort_chunk *abort,
SCTP_TCB_LOCK(stcb); SCTP_TCB_LOCK(stcb);
atomic_subtract_int(&stcb->asoc.refcnt, 1); atomic_subtract_int(&stcb->asoc.refcnt, 1);
#endif #endif
SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED);
(void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC,
SCTP_FROM_SCTP_INPUT + SCTP_LOC_8); SCTP_FROM_SCTP_INPUT + SCTP_LOC_8);
#if defined(__APPLE__) && !defined(__Userspace__) #if defined(__APPLE__) && !defined(__Userspace__)
...@@ -2068,7 +2067,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, ...@@ -2068,7 +2067,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
/* send up all the data */ /* send up all the data */
SCTP_TCB_SEND_LOCK(stcb); SCTP_TCB_SEND_LOCK(stcb);
sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_LOCKED); sctp_report_all_outbound(stcb, 0, SCTP_SO_LOCKED);
for (i = 0; i < stcb->asoc.streamoutcnt; i++) { for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
stcb->asoc.strmout[i].chunks_on_queues = 0; stcb->asoc.strmout[i].chunks_on_queues = 0;
#if defined(SCTP_DETAILED_STR_STATS) #if defined(SCTP_DETAILED_STR_STATS)
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 362178 2020-06-14 16:05:08Z tuexen $"); __FBSDID("$FreeBSD: head/sys/netinet/sctp_output.c 364937 2020-08-28 20:05:18Z tuexen $");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -14164,11 +14164,10 @@ skip_preblock: ...@@ -14164,11 +14164,10 @@ skip_preblock:
error = EINVAL; error = EINVAL;
goto out; goto out;
} }
SCTP_TCB_SEND_UNLOCK(stcb);
strm = &stcb->asoc.strmout[srcv->sinfo_stream]; strm = &stcb->asoc.strmout[srcv->sinfo_stream];
if (strm->last_msg_incomplete == 0) { if (strm->last_msg_incomplete == 0) {
do_a_copy_in: do_a_copy_in:
SCTP_TCB_SEND_UNLOCK(stcb);
sp = sctp_copy_it_in(stcb, asoc, srcv, uio, net, max_len, user_marks_eor, &error); sp = sctp_copy_it_in(stcb, asoc, srcv, uio, net, max_len, user_marks_eor, &error);
if (error) { if (error) {
goto out; goto out;
...@@ -14193,13 +14192,11 @@ skip_preblock: ...@@ -14193,13 +14192,11 @@ skip_preblock:
if (sinfo_flags & SCTP_UNORDERED) { if (sinfo_flags & SCTP_UNORDERED) {
SCTP_STAT_INCR(sctps_sends_with_unord); SCTP_STAT_INCR(sctps_sends_with_unord);
} }
sp->processing = 1;
TAILQ_INSERT_TAIL(&strm->outqueue, sp, next); TAILQ_INSERT_TAIL(&strm->outqueue, sp, next);
stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1); stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1);
SCTP_TCB_SEND_UNLOCK(stcb);
} else { } else {
SCTP_TCB_SEND_LOCK(stcb);
sp = TAILQ_LAST(&strm->outqueue, sctp_streamhead); sp = TAILQ_LAST(&strm->outqueue, sctp_streamhead);
SCTP_TCB_SEND_UNLOCK(stcb);
if (sp == NULL) { if (sp == NULL) {
/* ???? Huh ??? last msg is gone */ /* ???? Huh ??? last msg is gone */
#ifdef INVARIANTS #ifdef INVARIANTS
...@@ -14211,7 +14208,16 @@ skip_preblock: ...@@ -14211,7 +14208,16 @@ skip_preblock:
goto do_a_copy_in; goto do_a_copy_in;
} }
if (sp->processing) {
SCTP_TCB_SEND_UNLOCK(stcb);
SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL);
error = EINVAL;
goto out;
} else {
sp->processing = 1;
}
} }
SCTP_TCB_SEND_UNLOCK(stcb);
#if defined(__APPLE__) && !defined(__Userspace__) #if defined(__APPLE__) && !defined(__Userspace__)
#if defined(APPLE_LEOPARD) #if defined(APPLE_LEOPARD)
while (uio->uio_resid > 0) { while (uio->uio_resid > 0) {
...@@ -14262,19 +14268,28 @@ skip_preblock: ...@@ -14262,19 +14268,28 @@ skip_preblock:
if (mm) { if (mm) {
sctp_m_freem(mm); sctp_m_freem(mm);
} }
SCTP_TCB_SEND_LOCK(stcb);
if (sp != NULL) {
sp->processing = 0;
}
SCTP_TCB_SEND_UNLOCK(stcb);
goto out; goto out;
} }
/* Update the mbuf and count */ /* Update the mbuf and count */
SCTP_TCB_SEND_LOCK(stcb); SCTP_TCB_SEND_LOCK(stcb);
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) ||
(stcb->asoc.state & SCTP_STATE_WAS_ABORTED)) {
/* we need to get out. /* we need to get out.
* Peer probably aborted. * Peer probably aborted.
*/ */
sctp_m_freem(mm); sctp_m_freem(mm);
if (stcb->asoc.state & SCTP_PCB_FLAGS_WAS_ABORTED) { if (stcb->asoc.state & SCTP_STATE_WAS_ABORTED) {
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET);
error = ECONNRESET; error = ECONNRESET;
} }
if (sp != NULL) {
sp->processing = 0;
}
SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_SEND_UNLOCK(stcb);
goto out; goto out;
} }
...@@ -14347,6 +14362,11 @@ skip_preblock: ...@@ -14347,6 +14362,11 @@ skip_preblock:
/* wait for space now */ /* wait for space now */
if (non_blocking) { if (non_blocking) {
/* Non-blocking io in place out */ /* Non-blocking io in place out */
SCTP_TCB_SEND_LOCK(stcb);
if (sp != NULL) {
sp->processing = 0;
}
SCTP_TCB_SEND_UNLOCK(stcb);
goto skip_out_eof; goto skip_out_eof;
} }
/* What about the INIT, send it maybe */ /* What about the INIT, send it maybe */
...@@ -14497,6 +14517,11 @@ skip_preblock: ...@@ -14497,6 +14517,11 @@ skip_preblock:
} }
} }
SOCKBUF_UNLOCK(&so->so_snd); SOCKBUF_UNLOCK(&so->so_snd);
SCTP_TCB_SEND_LOCK(stcb);
if (sp != NULL) {
sp->processing = 0;
}
SCTP_TCB_SEND_UNLOCK(stcb);
goto out_unlocked; goto out_unlocked;
} }
...@@ -14509,12 +14534,19 @@ skip_preblock: ...@@ -14509,12 +14534,19 @@ skip_preblock:
} }
} }
SOCKBUF_UNLOCK(&so->so_snd); SOCKBUF_UNLOCK(&so->so_snd);
SCTP_TCB_SEND_LOCK(stcb);
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
if (sp != NULL) {
sp->processing = 0;
}
SCTP_TCB_SEND_UNLOCK(stcb);
goto out_unlocked; goto out_unlocked;
} }
SCTP_TCB_SEND_UNLOCK(stcb);
} }
SCTP_TCB_SEND_LOCK(stcb); SCTP_TCB_SEND_LOCK(stcb);
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) ||
(stcb->asoc.state & SCTP_STATE_WAS_ABORTED)) {
SCTP_TCB_SEND_UNLOCK(stcb); SCTP_TCB_SEND_UNLOCK(stcb);
goto out_unlocked; goto out_unlocked;
} }
...@@ -14530,6 +14562,7 @@ skip_preblock: ...@@ -14530,6 +14562,7 @@ skip_preblock:
strm->last_msg_incomplete = 0; strm->last_msg_incomplete = 0;
asoc->stream_locked = 0; asoc->stream_locked = 0;
} }
sp->processing = 0;
} else { } else {
SCTP_PRINTF("Huh no sp TSNH?\n"); SCTP_PRINTF("Huh no sp TSNH?\n");
strm->last_msg_incomplete = 0; strm->last_msg_incomplete = 0;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 363456 2020-07-23 19:43:49Z tuexen $"); __FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 364268 2020-08-16 11:50:37Z tuexen $");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -5467,6 +5467,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5467,6 +5467,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
/* there is no asoc, really TSNH :-0 */ /* there is no asoc, really TSNH :-0 */
return (1); return (1);
} }
SCTP_TCB_SEND_LOCK(stcb);
if (stcb->asoc.alternate) { if (stcb->asoc.alternate) {
sctp_free_remote_addr(stcb->asoc.alternate); sctp_free_remote_addr(stcb->asoc.alternate);
stcb->asoc.alternate = NULL; stcb->asoc.alternate = NULL;
...@@ -5503,6 +5504,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5503,6 +5504,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
/* nope, reader or writer in the way */ /* nope, reader or writer in the way */
sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL); sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL);
/* no asoc destroyed */ /* no asoc destroyed */
SCTP_TCB_SEND_UNLOCK(stcb);
SCTP_TCB_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb);
#ifdef SCTP_LOG_CLOSING #ifdef SCTP_LOG_CLOSING
sctp_log_closing(inp, stcb, 8); sctp_log_closing(inp, stcb, 8);
...@@ -5564,6 +5566,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5564,6 +5566,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
SCTP_CLEAR_SUBSTATE(stcb, SCTP_STATE_IN_ACCEPT_QUEUE); SCTP_CLEAR_SUBSTATE(stcb, SCTP_STATE_IN_ACCEPT_QUEUE);
sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL); sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL);
} }
SCTP_TCB_SEND_UNLOCK(stcb);
SCTP_TCB_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb);
if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE))
...@@ -5602,10 +5605,12 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5602,10 +5605,12 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
if (from_inpcbfree == SCTP_NORMAL_PROC) { if (from_inpcbfree == SCTP_NORMAL_PROC) {
atomic_add_int(&stcb->asoc.refcnt, 1); atomic_add_int(&stcb->asoc.refcnt, 1);
SCTP_TCB_SEND_UNLOCK(stcb);
SCTP_TCB_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb);
SCTP_INP_INFO_WLOCK(); SCTP_INP_INFO_WLOCK();
SCTP_INP_WLOCK(inp); SCTP_INP_WLOCK(inp);
SCTP_TCB_LOCK(stcb); SCTP_TCB_LOCK(stcb);
SCTP_TCB_SEND_LOCK(stcb);
} }
/* Double check the GONE flag */ /* Double check the GONE flag */
if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
...@@ -5656,6 +5661,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5656,6 +5661,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
SCTP_INP_INFO_WUNLOCK(); SCTP_INP_INFO_WUNLOCK();
SCTP_INP_WUNLOCK(inp); SCTP_INP_WUNLOCK(inp);
} }
SCTP_TCB_SEND_UNLOCK(stcb);
SCTP_TCB_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb);
return (0); return (0);
} }
...@@ -5687,7 +5693,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5687,7 +5693,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
* in case. * in case.
*/ */
/* anything on the wheel needs to be removed */ /* anything on the wheel needs to be removed */
SCTP_TCB_SEND_LOCK(stcb);
for (i = 0; i < asoc->streamoutcnt; i++) { for (i = 0; i < asoc->streamoutcnt; i++) {
struct sctp_stream_out *outs; struct sctp_stream_out *outs;
...@@ -5718,7 +5723,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5718,7 +5723,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED); sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED);
} }
} }
SCTP_TCB_SEND_UNLOCK(stcb);
/*sa_ignore FREED_MEMORY*/ /*sa_ignore FREED_MEMORY*/
TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) { TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) {
TAILQ_REMOVE(&asoc->resetHead, strrst, next_resp); TAILQ_REMOVE(&asoc->resetHead, strrst, next_resp);
...@@ -5920,6 +5924,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre ...@@ -5920,6 +5924,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
/* Insert new items here :> */ /* Insert new items here :> */
/* Get rid of LOCK */ /* Get rid of LOCK */
SCTP_TCB_SEND_UNLOCK(stcb);
SCTP_TCB_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb);
SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_LOCK_DESTROY(stcb);
SCTP_TCB_SEND_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_structs.h 362106 2020-06-12 16:31:13Z tuexen $"); __FBSDID("$FreeBSD: head/sys/netinet/sctp_structs.h 364268 2020-08-16 11:50:37Z tuexen $");
#endif #endif
#ifndef _NETINET_SCTP_STRUCTS_H_ #ifndef _NETINET_SCTP_STRUCTS_H_
...@@ -584,6 +584,7 @@ struct sctp_stream_queue_pending { ...@@ -584,6 +584,7 @@ struct sctp_stream_queue_pending {
uint8_t sender_all_done; uint8_t sender_all_done;
uint8_t put_last_out; uint8_t put_last_out;
uint8_t discard_rest; uint8_t discard_rest;
uint8_t processing;
}; };
/* /*
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 363275 2020-07-17 15:09:49Z tuexen $"); __FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 364353 2020-08-18 19:25:03Z tuexen $");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -1585,7 +1585,7 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp, ...@@ -1585,7 +1585,7 @@ sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp,
if (actual + sizeof(struct sockaddr_in6) > limit) { if (actual + sizeof(struct sockaddr_in6) > limit) {
return (actual); return (actual);
} }
in6_sin_2_v4mapsin6(sin, (struct sockaddr_in6 *)&addr); in6_sin_2_v4mapsin6(sin, (struct sockaddr_in6 *)addr);
((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport; ((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport;
addr = (struct sockaddr *)((caddr_t)addr + sizeof(struct sockaddr_in6)); addr = (struct sockaddr *)((caddr_t)addr + sizeof(struct sockaddr_in6));
actual += sizeof(struct sockaddr_in6); actual += sizeof(struct sockaddr_in6);
...@@ -2868,7 +2868,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize, ...@@ -2868,7 +2868,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
(net->ro._l_addr.sa.sa_family == AF_INET)) { (net->ro._l_addr.sa.sa_family == AF_INET)) {
/* Must map the address */ /* Must map the address */
in6_sin_2_v4mapsin6(&net->ro._l_addr.sin, in6_sin_2_v4mapsin6(&net->ro._l_addr.sin,
(struct sockaddr_in6 *)&addr); (struct sockaddr_in6 *)addr);
} else { } else {
memcpy(addr, &net->ro._l_addr, cpsz); memcpy(addr, &net->ro._l_addr, cpsz);
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 363323 2020-07-19 12:34:19Z tuexen $"); __FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 364268 2020-08-16 11:50:37Z tuexen $");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -1795,6 +1795,7 @@ sctp_timeout_handler(void *t) ...@@ -1795,6 +1795,7 @@ sctp_timeout_handler(void *t)
net = (struct sctp_nets *)tmr->net; net = (struct sctp_nets *)tmr->net;
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
CURVNET_SET((struct vnet *)tmr->vnet); CURVNET_SET((struct vnet *)tmr->vnet);
NET_EPOCH_ENTER(et);
#endif #endif
did_output = 1; did_output = 1;
released_asoc_reference = false; released_asoc_reference = false;
...@@ -1855,9 +1856,6 @@ sctp_timeout_handler(void *t) ...@@ -1855,9 +1856,6 @@ sctp_timeout_handler(void *t)
/* Record in stopped_from which timeout occurred. */ /* Record in stopped_from which timeout occurred. */
tmr->stopped_from = type; tmr->stopped_from = type;
#if defined(__FreeBSD__) && !defined(__Userspace__)
NET_EPOCH_ENTER(et);
#endif
/* mark as being serviced now */ /* mark as being serviced now */
if (SCTP_OS_TIMER_PENDING(&tmr->timer)) { if (SCTP_OS_TIMER_PENDING(&tmr->timer)) {
/* /*
...@@ -4445,7 +4443,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, ...@@ -4445,7 +4443,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb,
} }
void void
sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked) sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int so_locked)
{ {
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_stream_out *outs; struct sctp_stream_out *outs;
...@@ -4474,9 +4472,6 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, ...@@ -4474,9 +4472,6 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock,
return; return;
} }
/* now through all the gunk freeing chunks */ /* now through all the gunk freeing chunks */
if (holds_lock == 0) {
SCTP_TCB_SEND_LOCK(stcb);
}
/* sent queue SHOULD be empty */ /* sent queue SHOULD be empty */
TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) { TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) {
TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
...@@ -4553,10 +4548,6 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, ...@@ -4553,10 +4548,6 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock,
/*sa_ignore FREED_MEMORY*/ /*sa_ignore FREED_MEMORY*/
} }
} }
if (holds_lock == 0) {
SCTP_TCB_SEND_UNLOCK(stcb);
}
} }
void void
...@@ -4583,8 +4574,11 @@ sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error ...@@ -4583,8 +4574,11 @@ sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error
(stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
return; return;
} }
SCTP_TCB_SEND_LOCK(stcb);
SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED);
/* Tell them we lost the asoc */ /* Tell them we lost the asoc */
sctp_report_all_outbound(stcb, error, 0, so_locked); sctp_report_all_outbound(stcb, error, so_locked);
SCTP_TCB_SEND_UNLOCK(stcb);
if (from_peer) { if (from_peer) {
sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked); sctp_ulp_notify(SCTP_NOTIFY_ASSOC_REM_ABORTED, stcb, error, abort, so_locked);
} else { } else {
...@@ -4620,7 +4614,6 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -4620,7 +4614,6 @@ sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
if (stcb != NULL) { if (stcb != NULL) {
/* We have a TCB to abort, send notification too */ /* We have a TCB to abort, send notification too */
sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED);
SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED);
/* Ok, now lets free it */ /* Ok, now lets free it */
#if defined(__APPLE__) && !defined(__Userspace__) #if defined(__APPLE__) && !defined(__Userspace__)
so = SCTP_INP_SO(inp); so = SCTP_INP_SO(inp);
...@@ -4742,8 +4735,6 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -4742,8 +4735,6 @@ sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
} }
} }
return; return;
} else {
SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED);
} }
/* notify the peer */ /* notify the peer */
sctp_send_abort_tcb(stcb, op_err, so_locked); sctp_send_abort_tcb(stcb, op_err, so_locked);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctputil.h 363323 2020-07-19 12:34:19Z tuexen $"); __FBSDID("$FreeBSD: head/sys/netinet/sctputil.h 364268 2020-08-16 11:50:37Z tuexen $");
#endif #endif
#ifndef _NETINET_SCTP_UTIL_H_ #ifndef _NETINET_SCTP_UTIL_H_
...@@ -179,7 +179,7 @@ void sctp_stop_timers_for_shutdown(struct sctp_tcb *); ...@@ -179,7 +179,7 @@ void sctp_stop_timers_for_shutdown(struct sctp_tcb *);
/* Stop all timers for association and remote addresses. */ /* Stop all timers for association and remote addresses. */
void sctp_stop_association_timers(struct sctp_tcb *, bool); void sctp_stop_association_timers(struct sctp_tcb *, bool);
void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int); void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int);
int sctp_expand_mapping_array(struct sctp_association *, uint32_t); int sctp_expand_mapping_array(struct sctp_association *, uint32_t);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论