зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1912983: Update libusrsctp to latest. r=ng
Differential Revision: https://phabricator.services.mozilla.com/D219188
This commit is contained in:
Родитель
3ff2374ec4
Коммит
fcbbcc6383
|
@ -10,8 +10,8 @@ origin:
|
|||
|
||||
url: https://github.com/sctplab/usrsctp/blob/master/Manual.md
|
||||
|
||||
release: 2952e9324299c5729ba9f03a87924f787868e494 (2023-11-05T13:52:04Z).
|
||||
revision: 2952e9324299c5729ba9f03a87924f787868e494
|
||||
release: 1330843b6ffd0c5c2d7483b07050049eedda8077 (2024-08-03T12:00:29Z).
|
||||
revision: 1330843b6ffd0c5c2d7483b07050049eedda8077
|
||||
|
||||
license: BSD-3-Clause
|
||||
|
||||
|
|
|
@ -32,14 +32,6 @@
|
|||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Needed for unified build so that rand_s is available to all unified
|
||||
// sources.
|
||||
#if !defined(_CRT_RAND_S) && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
||||
#define _CRT_RAND_S
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <netinet/sctp_os.h>
|
||||
#include <netinet/sctp_var.h>
|
||||
#include <netinet/sctp_sysctl.h>
|
||||
|
|
|
@ -299,7 +299,14 @@ sctp_is_vmware_interface(struct ifnet *ifn)
|
|||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(__Userspace__)
|
||||
#define SCTP_BSD_FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
||||
#ifdef MALLOC
|
||||
#undef MALLOC
|
||||
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
|
||||
#endif
|
||||
#ifdef FREE
|
||||
#undef FREE
|
||||
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
||||
#endif
|
||||
static void
|
||||
sctp_init_ifns_for_vrf(int vrfid)
|
||||
{
|
||||
|
@ -329,7 +336,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
/* Get actual adapter information */
|
||||
if ((Err = GetAdaptersAddresses(AF_INET, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
||||
SCTP_PRINTF("GetAdaptersV4Addresses() failed with error code %d\n", Err);
|
||||
SCTP_BSD_FREE(pAdapterAddrs);
|
||||
FREE(pAdapterAddrs);
|
||||
return;
|
||||
}
|
||||
/* Enumerate through each returned adapter and save its information */
|
||||
|
@ -354,7 +361,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
}
|
||||
}
|
||||
}
|
||||
SCTP_BSD_FREE(pAdapterAddrs);
|
||||
FREE(pAdapterAddrs);
|
||||
#endif
|
||||
#ifdef INET6
|
||||
AdapterAddrsSize = 0;
|
||||
|
@ -374,7 +381,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
/* Get actual adapter information */
|
||||
if ((Err = GetAdaptersAddresses(AF_INET6, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
||||
SCTP_PRINTF("GetAdaptersV6Addresses() failed with error code %d\n", Err);
|
||||
SCTP_BSD_FREE(pAdapterAddrs);
|
||||
FREE(pAdapterAddrs);
|
||||
return;
|
||||
}
|
||||
/* Enumerate through each returned adapter and save its information */
|
||||
|
@ -396,7 +403,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
|||
}
|
||||
}
|
||||
}
|
||||
SCTP_BSD_FREE(pAdapterAddrs);
|
||||
FREE(pAdapterAddrs);
|
||||
#endif
|
||||
}
|
||||
#elif defined(__Userspace__)
|
||||
|
|
|
@ -93,7 +93,7 @@ struct sctp_supported_addr_param {
|
|||
/* heartbeat info parameter */
|
||||
struct sctp_heartbeat_info_param {
|
||||
struct sctp_paramhdr ph;
|
||||
uint32_t time_value_1;
|
||||
time_t time_value_1;
|
||||
uint32_t time_value_2;
|
||||
uint32_t random_value1;
|
||||
uint32_t random_value2;
|
||||
|
|
|
@ -778,21 +778,6 @@ sctp_build_readq_entry_from_ctl(struct sctp_queued_to_read *nc, struct sctp_queu
|
|||
nc->do_not_ref_stcb = control->do_not_ref_stcb;
|
||||
}
|
||||
|
||||
static void
|
||||
sctp_reset_a_control(struct sctp_queued_to_read *control,
|
||||
struct sctp_inpcb *inp, uint32_t tsn)
|
||||
{
|
||||
control->fsn_included = tsn;
|
||||
if (control->on_read_q) {
|
||||
/*
|
||||
* We have to purge it from there,
|
||||
* hopefully this will work :-)
|
||||
*/
|
||||
TAILQ_REMOVE(&inp->read_queue, control, next);
|
||||
control->on_read_q = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
sctp_handle_old_unordered_data(struct sctp_tcb *stcb,
|
||||
struct sctp_association *asoc,
|
||||
|
@ -1375,7 +1360,7 @@ out:
|
|||
|
||||
/*
|
||||
* Dump onto the re-assembly queue, in its proper place. After dumping on the
|
||||
* queue, see if anthing can be delivered. If so pull it off (or as much as
|
||||
* queue, see if anything can be delivered. If so pull it off (or as much as
|
||||
* we can. If we run out of space then we must dump what we can and set the
|
||||
* appropriate flag to say we queued what we could.
|
||||
*/
|
||||
|
@ -1923,7 +1908,8 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
|||
SCTP_SNPRINTF(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid);
|
||||
goto err_out;
|
||||
} else {
|
||||
if ((tsn == control->fsn_included + 1) &&
|
||||
if ((control->first_frag_seen) &&
|
||||
(tsn == control->fsn_included + 1) &&
|
||||
(control->end_added == 0)) {
|
||||
SCTP_SNPRINTF(msg, sizeof(msg),
|
||||
"Illegal message sequence, missing end for MID: %8.8x",
|
||||
|
@ -5308,13 +5294,17 @@ sctp_update_acked(struct sctp_tcb *stcb, struct sctp_shutdown_chunk *cp, int *ab
|
|||
|
||||
static void
|
||||
sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
|
||||
struct sctp_stream_in *strmin)
|
||||
struct sctp_stream_in *strmin)
|
||||
{
|
||||
struct sctp_queued_to_read *control, *ncontrol;
|
||||
struct sctp_association *asoc;
|
||||
uint32_t mid;
|
||||
int need_reasm_check = 0;
|
||||
|
||||
KASSERT(stcb != NULL, ("stcb == NULL"));
|
||||
SCTP_TCB_LOCK_ASSERT(stcb);
|
||||
SCTP_INP_READ_LOCK_ASSERT(stcb->sctp_ep);
|
||||
|
||||
asoc = &stcb->asoc;
|
||||
mid = strmin->last_mid_delivered;
|
||||
/*
|
||||
|
@ -5352,11 +5342,9 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
|
|||
/* deliver it to at least the delivery-q */
|
||||
if (stcb->sctp_socket) {
|
||||
sctp_mark_non_revokable(asoc, control->sinfo_tsn);
|
||||
sctp_add_to_readq(stcb->sctp_ep, stcb,
|
||||
control,
|
||||
&stcb->sctp_socket->so_rcv,
|
||||
1, SCTP_READ_LOCK_HELD,
|
||||
SCTP_SO_NOT_LOCKED);
|
||||
sctp_add_to_readq(stcb->sctp_ep, stcb, control,
|
||||
&stcb->sctp_socket->so_rcv, 1,
|
||||
SCTP_READ_LOCK_HELD, SCTP_SO_NOT_LOCKED);
|
||||
}
|
||||
} else {
|
||||
/* Its a fragmented message */
|
||||
|
@ -5422,10 +5410,9 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
|
|||
strmin->last_mid_delivered = control->mid;
|
||||
if (stcb->sctp_socket) {
|
||||
sctp_mark_non_revokable(asoc, control->sinfo_tsn);
|
||||
sctp_add_to_readq(stcb->sctp_ep, stcb,
|
||||
control,
|
||||
&stcb->sctp_socket->so_rcv, 1,
|
||||
SCTP_READ_LOCK_HELD, SCTP_SO_NOT_LOCKED);
|
||||
sctp_add_to_readq(stcb->sctp_ep, stcb, control,
|
||||
&stcb->sctp_socket->so_rcv, 1,
|
||||
SCTP_READ_LOCK_HELD, SCTP_SO_NOT_LOCKED);
|
||||
}
|
||||
mid = strmin->last_mid_delivered + 1;
|
||||
} else {
|
||||
|
@ -5448,8 +5435,8 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
|
|||
|
||||
static void
|
||||
sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
|
||||
struct sctp_association *asoc, struct sctp_stream_in *strm,
|
||||
struct sctp_queued_to_read *control, int ordered, uint32_t cumtsn)
|
||||
struct sctp_association *asoc, struct sctp_stream_in *strm,
|
||||
struct sctp_queued_to_read *control, int ordered, uint32_t cumtsn)
|
||||
{
|
||||
struct sctp_tmit_chunk *chk, *nchk;
|
||||
|
||||
|
@ -5461,6 +5448,11 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
|
|||
* delivery function... to see if it can be delivered... But
|
||||
* for now we just dump everything on the queue.
|
||||
*/
|
||||
|
||||
KASSERT(stcb != NULL, ("stcb == NULL"));
|
||||
SCTP_TCB_LOCK_ASSERT(stcb);
|
||||
SCTP_INP_READ_LOCK_ASSERT(stcb->sctp_ep);
|
||||
|
||||
if (!asoc->idata_supported && !ordered &&
|
||||
control->first_frag_seen &&
|
||||
SCTP_TSN_GT(control->fsn_included, cumtsn)) {
|
||||
|
@ -5491,17 +5483,30 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
|
|||
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
|
||||
}
|
||||
if (!TAILQ_EMPTY(&control->reasm)) {
|
||||
/* This has to be old data, unordered */
|
||||
KASSERT(!asoc->idata_supported,
|
||||
("Reassembly queue not empty for I-DATA"));
|
||||
KASSERT(!ordered,
|
||||
("Reassembly queue not empty for ordered data"));
|
||||
if (control->data) {
|
||||
sctp_m_freem(control->data);
|
||||
control->data = NULL;
|
||||
}
|
||||
sctp_reset_a_control(control, stcb->sctp_ep, cumtsn);
|
||||
control->fsn_included = 0xffffffff;
|
||||
control->first_frag_seen = 0;
|
||||
control->last_frag_seen = 0;
|
||||
if (control->on_read_q) {
|
||||
/*
|
||||
* We have to purge it from there,
|
||||
* hopefully this will work :-)
|
||||
*/
|
||||
TAILQ_REMOVE(&stcb->sctp_ep->read_queue, control, next);
|
||||
control->on_read_q = 0;
|
||||
}
|
||||
chk = TAILQ_FIRST(&control->reasm);
|
||||
if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) {
|
||||
TAILQ_REMOVE(&control->reasm, chk, sctp_next);
|
||||
sctp_add_chk_to_control(control, strm, stcb, asoc,
|
||||
chk, SCTP_READ_LOCK_HELD);
|
||||
chk, SCTP_READ_LOCK_HELD);
|
||||
}
|
||||
sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_HELD);
|
||||
return;
|
||||
|
|
|
@ -422,7 +422,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
|
|||
op_err = sctp_arethere_unrecognized_parameters(m,
|
||||
(offset + sizeof(struct sctp_init_chunk)),
|
||||
&abort_flag, (struct sctp_chunkhdr *)cp,
|
||||
&nat_friendly, &cookie_found);
|
||||
&nat_friendly, &cookie_found, NULL);
|
||||
if (abort_flag) {
|
||||
/* Send an abort and notify peer */
|
||||
sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
|
||||
|
@ -2635,7 +2635,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
|
|||
}
|
||||
ep = &(*inp_p)->sctp_ep;
|
||||
/* which cookie is it? */
|
||||
if ((cookie->time_entered.tv_sec < (long)ep->time_of_secret_change) &&
|
||||
if ((cookie->time_entered.tv_sec < ep->time_of_secret_change) &&
|
||||
(ep->current_secret_number != ep->last_secret_number)) {
|
||||
/* it's the old cookie */
|
||||
(void)sctp_hmac_m(SCTP_HMAC,
|
||||
|
@ -2658,7 +2658,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
|
|||
/* compare the received digest with the computed digest */
|
||||
if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) {
|
||||
/* try the old cookie? */
|
||||
if ((cookie->time_entered.tv_sec == (long)ep->time_of_secret_change) &&
|
||||
if ((cookie->time_entered.tv_sec == ep->time_of_secret_change) &&
|
||||
(ep->current_secret_number != ep->last_secret_number)) {
|
||||
/* compute digest with old */
|
||||
(void)sctp_hmac_m(SCTP_HMAC,
|
||||
|
@ -4624,6 +4624,8 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp,
|
|||
SCTP_STAT_INCR(sctps_pdrpmbda);
|
||||
}
|
||||
} else {
|
||||
desc.tsn_ifany = htonl(0);
|
||||
memset(desc.data_bytes, 0, SCTP_NUM_DB_TO_VERIFY);
|
||||
if (pktdrp_flags & SCTP_FROM_MIDDLE_BOX) {
|
||||
SCTP_STAT_INCR(sctps_pdrpmbct);
|
||||
}
|
||||
|
|
|
@ -5370,7 +5370,8 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
|
|||
int param_offset, int *abort_processing,
|
||||
struct sctp_chunkhdr *cp,
|
||||
int *nat_friendly,
|
||||
int *cookie_found)
|
||||
int *cookie_found,
|
||||
uint32_t *edmid)
|
||||
{
|
||||
/*
|
||||
* Given a mbuf containing an INIT or INIT-ACK with the param_offset
|
||||
|
@ -5386,8 +5387,8 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
|
|||
* hoped that this routine may be reused in the future by new
|
||||
* features.
|
||||
*/
|
||||
struct sctp_zero_checksum_acceptable zero_chksum, *zero_chksum_p;
|
||||
struct sctp_paramhdr *phdr, params;
|
||||
|
||||
struct mbuf *mat, *m_tmp, *op_err, *op_err_last;
|
||||
int at, limit, pad_needed;
|
||||
uint16_t ptype, plen, padded_size;
|
||||
|
@ -5396,6 +5397,9 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
|
|||
if (cookie_found != NULL) {
|
||||
*cookie_found = 0;
|
||||
}
|
||||
if (edmid != NULL) {
|
||||
*edmid = SCTP_EDMID_NONE;
|
||||
}
|
||||
mat = in_initpkt;
|
||||
limit = ntohs(cp->chunk_length) - sizeof(struct sctp_init_chunk);
|
||||
at = param_offset;
|
||||
|
@ -5451,6 +5455,22 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
|
|||
}
|
||||
at += padded_size;
|
||||
break;
|
||||
case SCTP_ZERO_CHECKSUM_ACCEPTABLE:
|
||||
if (padded_size != sizeof(struct sctp_zero_checksum_acceptable)) {
|
||||
SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error checksum acceptable %d\n", plen);
|
||||
goto invalid_size;
|
||||
}
|
||||
if (edmid != NULL) {
|
||||
phdr = sctp_get_next_param(mat, at,
|
||||
(struct sctp_paramhdr *)&zero_chksum,
|
||||
sizeof(struct sctp_zero_checksum_acceptable));
|
||||
if (phdr != NULL) {
|
||||
zero_chksum_p = (struct sctp_zero_checksum_acceptable *)phdr;
|
||||
*edmid = ntohl(zero_chksum_p->edmid);
|
||||
}
|
||||
}
|
||||
at += padded_size;
|
||||
break;
|
||||
case SCTP_RANDOM:
|
||||
if (padded_size > (sizeof(struct sctp_auth_random) + SCTP_RANDOM_MAX_SIZE)) {
|
||||
SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error random %d\n", plen);
|
||||
|
@ -5491,11 +5511,16 @@ sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt,
|
|||
at += padded_size;
|
||||
break;
|
||||
case SCTP_HAS_NAT_SUPPORT:
|
||||
if (padded_size != sizeof(struct sctp_paramhdr)) {
|
||||
SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error nat support %d\n", plen);
|
||||
goto invalid_size;
|
||||
}
|
||||
*nat_friendly = 1;
|
||||
/* FALLTHROUGH */
|
||||
at += padded_size;
|
||||
break;
|
||||
case SCTP_PRSCTP_SUPPORTED:
|
||||
if (padded_size != sizeof(struct sctp_paramhdr)) {
|
||||
SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error prsctp/nat support %d\n", plen);
|
||||
SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error prsctp %d\n", plen);
|
||||
goto invalid_size;
|
||||
}
|
||||
at += padded_size;
|
||||
|
@ -5992,7 +6017,9 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
|||
int nat_friendly = 0;
|
||||
int error;
|
||||
struct socket *so;
|
||||
uint32_t edmid;
|
||||
uint16_t num_ext, chunk_len, padding_len, parameter_len;
|
||||
bool use_zero_crc;
|
||||
|
||||
if (stcb) {
|
||||
asoc = &stcb->asoc;
|
||||
|
@ -6036,7 +6063,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
|||
(offset + sizeof(struct sctp_init_chunk)),
|
||||
&abort_flag,
|
||||
(struct sctp_chunkhdr *)init_chk,
|
||||
&nat_friendly, NULL);
|
||||
&nat_friendly, NULL, &edmid);
|
||||
if (abort_flag) {
|
||||
do_a_abort:
|
||||
if (op_err == NULL) {
|
||||
|
@ -6716,6 +6743,12 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
|||
over_addr = NULL;
|
||||
}
|
||||
|
||||
if (asoc != NULL) {
|
||||
use_zero_crc = (asoc->rcv_edmid != SCTP_EDMID_NONE) && (asoc->rcv_edmid == edmid);
|
||||
} else {
|
||||
use_zero_crc = (inp->rcv_edmid != SCTP_EDMID_NONE) && (inp->rcv_edmid == edmid);
|
||||
}
|
||||
|
||||
if ((error = sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0,
|
||||
0, 0,
|
||||
inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag,
|
||||
|
@ -6723,7 +6756,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
|||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
mflowtype, mflowid,
|
||||
#endif
|
||||
false, /* XXXMT: Improve this! */
|
||||
use_zero_crc,
|
||||
SCTP_SO_NOT_LOCKED))) {
|
||||
SCTPDBG(SCTP_DEBUG_OUTPUT4, "Gak send error %d\n", error);
|
||||
if (error == ENOBUFS) {
|
||||
|
@ -7245,7 +7278,9 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,
|
|||
} else {
|
||||
m = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr),
|
||||
0, M_NOWAIT, 1, MT_DATA);
|
||||
SCTP_BUF_LEN(m) = sizeof(struct sctp_paramhdr);
|
||||
if (m != NULL) {
|
||||
SCTP_BUF_LEN(m) = sizeof(struct sctp_paramhdr);
|
||||
}
|
||||
}
|
||||
if (m != NULL) {
|
||||
struct sctp_paramhdr *ph;
|
||||
|
@ -7442,18 +7477,28 @@ static int
|
|||
sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
|
||||
struct sctp_nonpad_sndrcvinfo *srcv)
|
||||
{
|
||||
int ret;
|
||||
struct sctp_copy_all *ca;
|
||||
struct mbuf *mat;
|
||||
ssize_t sndlen;
|
||||
int ret;
|
||||
|
||||
if (uio != NULL) {
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
#if defined(APPLE_LEOPARD)
|
||||
if (uio->uio_resid > SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
|
||||
sndlen = uio->uio_resid;
|
||||
#else
|
||||
if (uio_resid(uio) > SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
|
||||
sndlen = uio_resid(uio);
|
||||
#endif
|
||||
#else
|
||||
if (uio->uio_resid > (ssize_t)SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
|
||||
sndlen = uio->uio_resid;
|
||||
#endif
|
||||
} else {
|
||||
sndlen = 0;
|
||||
for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
|
||||
sndlen += SCTP_BUF_LEN(mat);
|
||||
}
|
||||
}
|
||||
if (sndlen > (ssize_t)SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
|
||||
/* You must not be larger than the limit! */
|
||||
return (EMSGSIZE);
|
||||
}
|
||||
|
@ -7465,12 +7510,10 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
|
|||
return (ENOMEM);
|
||||
}
|
||||
memset(ca, 0, sizeof(struct sctp_copy_all));
|
||||
|
||||
ca->inp = inp;
|
||||
if (srcv != NULL) {
|
||||
memcpy(&ca->sndrcv, srcv, sizeof(struct sctp_nonpad_sndrcvinfo));
|
||||
}
|
||||
|
||||
/* Serialize. */
|
||||
SCTP_INP_WLOCK(inp);
|
||||
if ((inp->sctp_flags & SCTP_PCB_FLAGS_SND_ITERATOR_UP) != 0) {
|
||||
|
@ -7481,23 +7524,14 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
|
|||
}
|
||||
inp->sctp_flags |= SCTP_PCB_FLAGS_SND_ITERATOR_UP;
|
||||
SCTP_INP_WUNLOCK(inp);
|
||||
|
||||
/*
|
||||
* take off the sendall flag, it would be bad if we failed to do
|
||||
* this :-0
|
||||
*/
|
||||
ca->sndrcv.sinfo_flags &= ~SCTP_SENDALL;
|
||||
/* get length and mbuf chain */
|
||||
if (uio) {
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
#if defined(APPLE_LEOPARD)
|
||||
ca->sndlen = uio->uio_resid;
|
||||
#else
|
||||
ca->sndlen = uio_resid(uio);
|
||||
#endif
|
||||
#else
|
||||
ca->sndlen = uio->uio_resid;
|
||||
#endif
|
||||
ca->sndlen = sndlen;
|
||||
if (uio != NULL) {
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
SCTP_SOCKET_UNLOCK(SCTP_INP_SO(inp), 0);
|
||||
#endif
|
||||
|
@ -7515,20 +7549,14 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
|
|||
return (ENOMEM);
|
||||
}
|
||||
} else {
|
||||
/* Gather the length of the send */
|
||||
struct mbuf *mat;
|
||||
|
||||
ca->sndlen = 0;
|
||||
for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
|
||||
ca->sndlen += SCTP_BUF_LEN(mat);
|
||||
}
|
||||
ca->m = m;
|
||||
}
|
||||
ret = sctp_initiate_iterator(NULL, sctp_sendall_iterator, NULL,
|
||||
SCTP_PCB_ANY_FLAGS, SCTP_PCB_ANY_FEATURES,
|
||||
SCTP_ASOC_ANY_STATE,
|
||||
(void *)ca, 0,
|
||||
sctp_sendall_completes, inp, 1);
|
||||
if (ret) {
|
||||
SCTP_PCB_ANY_FLAGS, SCTP_PCB_ANY_FEATURES,
|
||||
SCTP_ASOC_ANY_STATE,
|
||||
(void *)ca, 0,
|
||||
sctp_sendall_completes, inp, 1);
|
||||
if (ret != 0) {
|
||||
SCTP_INP_WLOCK(inp);
|
||||
inp->sctp_flags &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UP;
|
||||
SCTP_INP_WUNLOCK(inp);
|
||||
|
@ -12166,7 +12194,7 @@ sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net,int so_locked)
|
|||
/* Fill out hb parameter */
|
||||
hb->heartbeat.hb_info.ph.param_type = htons(SCTP_HEARTBEAT_INFO);
|
||||
hb->heartbeat.hb_info.ph.param_length = htons(sizeof(struct sctp_heartbeat_info_param));
|
||||
hb->heartbeat.hb_info.time_value_1 = (uint32_t)now.tv_sec;
|
||||
hb->heartbeat.hb_info.time_value_1 = now.tv_sec;
|
||||
hb->heartbeat.hb_info.time_value_2 = now.tv_usec;
|
||||
/* Did our user request this one, put it in */
|
||||
hb->heartbeat.hb_info.addr_family = (uint8_t)net->ro._l_addr.sa.sa_family;
|
||||
|
|
|
@ -84,7 +84,9 @@ sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *,
|
|||
|
||||
struct mbuf *
|
||||
sctp_arethere_unrecognized_parameters(struct mbuf *, int, int *,
|
||||
struct sctp_chunkhdr *, int *, int *);
|
||||
struct sctp_chunkhdr *, int *, int *,
|
||||
uint32_t *);
|
||||
|
||||
void sctp_queue_op_err(struct sctp_tcb *, struct mbuf *);
|
||||
|
||||
int
|
||||
|
|
|
@ -2996,7 +2996,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
|
|||
|
||||
/* Setup the initial secret */
|
||||
(void)SCTP_GETTIME_TIMEVAL(&time);
|
||||
m->time_of_secret_change = (unsigned int)time.tv_sec;
|
||||
m->time_of_secret_change = time.tv_sec;
|
||||
|
||||
for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) {
|
||||
m->secret_key[0][i] = sctp_select_initial_TSN(m);
|
||||
|
@ -5303,7 +5303,7 @@ sctp_del_remote_addr(struct sctp_tcb *stcb, struct sockaddr *remaddr)
|
|||
}
|
||||
|
||||
static bool
|
||||
sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, uint32_t now)
|
||||
sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, time_t now)
|
||||
{
|
||||
struct sctpvtaghead *chain;
|
||||
struct sctp_tagblock *twait_block;
|
||||
|
@ -5325,7 +5325,7 @@ sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, uint32_t now)
|
|||
}
|
||||
|
||||
static void
|
||||
sctp_set_vtag_block(struct sctp_timewait *vtag_block, uint32_t time,
|
||||
sctp_set_vtag_block(struct sctp_timewait *vtag_block, time_t time,
|
||||
uint32_t tag, uint16_t lport, uint16_t rport)
|
||||
{
|
||||
vtag_block->tv_sec_at_expire = time;
|
||||
|
@ -5340,13 +5340,13 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint16_t lport, uint16_t rport)
|
|||
struct sctpvtaghead *chain;
|
||||
struct sctp_tagblock *twait_block;
|
||||
struct timeval now;
|
||||
uint32_t time;
|
||||
time_t time;
|
||||
int i;
|
||||
bool set;
|
||||
|
||||
SCTP_INP_INFO_WLOCK_ASSERT();
|
||||
(void)SCTP_GETTIME_TIMEVAL(&now);
|
||||
time = (uint32_t)now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait);
|
||||
time = now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait);
|
||||
chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
|
||||
set = false;
|
||||
LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
|
||||
|
@ -5358,7 +5358,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint16_t lport, uint16_t rport)
|
|||
continue;
|
||||
}
|
||||
if ((twait_block->vtag_block[i].v_tag != 0) &&
|
||||
(twait_block->vtag_block[i].tv_sec_at_expire < (uint32_t)now.tv_sec)) {
|
||||
(twait_block->vtag_block[i].tv_sec_at_expire < now.tv_sec)) {
|
||||
if (set) {
|
||||
/* Audit expires this guy */
|
||||
sctp_set_vtag_block(twait_block->vtag_block + i, 0, 0, 0, 0);
|
||||
|
@ -5621,7 +5621,9 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
|
|||
SOCKBUF_LOCK(&so->so_rcv);
|
||||
so->so_state &= ~(SS_ISCONNECTING |
|
||||
SS_ISDISCONNECTING |
|
||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
||||
SS_ISCONFIRMING |
|
||||
#endif
|
||||
SS_ISCONNECTED);
|
||||
so->so_state |= SS_ISDISCONNECTED;
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
|
@ -6513,6 +6515,13 @@ sctp_netisr_hdlr(struct mbuf *m, uintptr_t source)
|
|||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
#define VALIDATE_LOADER_TUNABLE(var_name, prefix) \
|
||||
if (SCTP_BASE_SYSCTL(var_name) < prefix##_MIN || \
|
||||
SCTP_BASE_SYSCTL(var_name) > prefix##_MAX) \
|
||||
SCTP_BASE_SYSCTL(var_name) = prefix##_DEFAULT
|
||||
|
||||
#endif
|
||||
void
|
||||
#if defined(__Userspace__)
|
||||
|
@ -6605,6 +6614,9 @@ sctp_pcb_init(void)
|
|||
TUNABLE_INT_FETCH("net.inet.sctp.tcbhashsize", &SCTP_BASE_SYSCTL(sctp_hashtblsize));
|
||||
TUNABLE_INT_FETCH("net.inet.sctp.pcbhashsize", &SCTP_BASE_SYSCTL(sctp_pcbtblsize));
|
||||
TUNABLE_INT_FETCH("net.inet.sctp.chunkscale", &SCTP_BASE_SYSCTL(sctp_chunkscale));
|
||||
VALIDATE_LOADER_TUNABLE(sctp_hashtblsize, SCTPCTL_TCBHASHSIZE);
|
||||
VALIDATE_LOADER_TUNABLE(sctp_pcbtblsize, SCTPCTL_PCBHASHSIZE);
|
||||
VALIDATE_LOADER_TUNABLE(sctp_chunkscale, SCTPCTL_CHUNKSCALE);
|
||||
#endif
|
||||
SCTP_BASE_INFO(sctp_asochash) = SCTP_HASH_INIT((SCTP_BASE_SYSCTL(sctp_hashtblsize) * 31),
|
||||
&SCTP_BASE_INFO(hashasocmark));
|
||||
|
@ -7748,7 +7760,7 @@ sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval *
|
|||
return (false);
|
||||
}
|
||||
}
|
||||
return (!sctp_is_in_timewait(tag, lport, rport, (uint32_t)now->tv_sec));
|
||||
return (!sctp_is_in_timewait(tag, lport, rport, now->tv_sec));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -131,10 +131,10 @@ struct sctp_block_entry {
|
|||
};
|
||||
|
||||
struct sctp_timewait {
|
||||
uint32_t tv_sec_at_expire; /* the seconds from boot to expire */
|
||||
uint32_t v_tag; /* the vtag that can not be reused */
|
||||
uint16_t lport; /* the local port used in vtag */
|
||||
uint16_t rport; /* the remote port used in vtag */
|
||||
time_t tv_sec_at_expire; /* the seconds from boot to expire */
|
||||
uint32_t v_tag; /* the vtag that can not be reused */
|
||||
uint16_t lport; /* the local port used in vtag */
|
||||
uint16_t rport; /* the remote port used in vtag */
|
||||
};
|
||||
|
||||
struct sctp_tagblock {
|
||||
|
@ -347,8 +347,8 @@ struct sctp_base_info {
|
|||
* access /dev/random.
|
||||
*/
|
||||
struct sctp_pcb {
|
||||
unsigned int time_of_secret_change; /* number of seconds from
|
||||
* timeval.tv_sec */
|
||||
time_t time_of_secret_change; /* number of seconds from
|
||||
* timeval.tv_sec */
|
||||
uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS];
|
||||
unsigned int size_of_a_cookie;
|
||||
|
||||
|
|
|
@ -1105,6 +1105,14 @@ sctp_sysctl_handle_trace_log_clear(SYSCTL_HANDLER_ARGS)
|
|||
#if (defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__Userspace__)
|
||||
#if defined(__FreeBSD__)
|
||||
#define SCTP_UINT_SYSCTL(mib_name, var_name, prefix) \
|
||||
SCTP_UINT_SYSCTL_FLAG(mib_name, var_name, prefix, \
|
||||
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW)
|
||||
|
||||
#define SCTP_UINT_SYSCTL_TUN(mib_name, var_name, prefix) \
|
||||
SCTP_UINT_SYSCTL_FLAG(mib_name, var_name, prefix, \
|
||||
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RWTUN|CTLFLAG_NOFETCH)
|
||||
|
||||
#define SCTP_UINT_SYSCTL_FLAG(mib_name, var_name, prefix, flags) \
|
||||
static int \
|
||||
sctp_sysctl_handle_##mib_name(SYSCTL_HANDLER_ARGS) \
|
||||
{ \
|
||||
|
@ -1123,9 +1131,14 @@ sctp_sysctl_handle_trace_log_clear(SYSCTL_HANDLER_ARGS)
|
|||
} \
|
||||
return (error); \
|
||||
} \
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mib_name, \
|
||||
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, NULL, 0, \
|
||||
sctp_sysctl_handle_##mib_name, "UI", prefix##_DESC);
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mib_name, flags, NULL, 0, \
|
||||
sctp_sysctl_handle_##mib_name, "UI", prefix##_DESC)
|
||||
|
||||
#define SCTP_UINT_SYSCTL_RDTUN(mib_name, var_name, prefix) \
|
||||
SYSCTL_UINT(_net_inet_sctp, OID_AUTO, mib_name, \
|
||||
CTLFLAG_VNET|CTLFLAG_RDTUN|CTLFLAG_NOFETCH, \
|
||||
&VNET_NAME(system_base_info.sctpsysctl.var_name), 0, \
|
||||
prefix##_DESC)
|
||||
#else
|
||||
#define SCTP_UINT_SYSCTL(mib_name, var_name, prefix) \
|
||||
static int \
|
||||
|
@ -1151,7 +1164,7 @@ sctp_sysctl_handle_trace_log_clear(SYSCTL_HANDLER_ARGS)
|
|||
} \
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mib_name, \
|
||||
CTLTYPE_INT | CTLFLAG_RW, NULL, 0, \
|
||||
sctp_sysctl_handle_##mib_name, "I", prefix##_DESC);
|
||||
sctp_sysctl_handle_##mib_name, "I", prefix##_DESC)
|
||||
#define CTLTYPE_UINT CTLTYPE_INT
|
||||
#define CTLFLAG_VNET 0
|
||||
#endif
|
||||
|
@ -1160,66 +1173,72 @@ sctp_sysctl_handle_trace_log_clear(SYSCTL_HANDLER_ARGS)
|
|||
* sysctl definitions
|
||||
*/
|
||||
|
||||
SCTP_UINT_SYSCTL(sendspace, sctp_sendspace, SCTPCTL_MAXDGRAM)
|
||||
SCTP_UINT_SYSCTL(recvspace, sctp_recvspace, SCTPCTL_RECVSPACE)
|
||||
SCTP_UINT_SYSCTL(auto_asconf, sctp_auto_asconf, SCTPCTL_AUTOASCONF)
|
||||
SCTP_UINT_SYSCTL(ecn_enable, sctp_ecn_enable, SCTPCTL_ECN_ENABLE)
|
||||
SCTP_UINT_SYSCTL(pr_enable, sctp_pr_enable, SCTPCTL_PR_ENABLE)
|
||||
SCTP_UINT_SYSCTL(sendspace, sctp_sendspace, SCTPCTL_MAXDGRAM);
|
||||
SCTP_UINT_SYSCTL(recvspace, sctp_recvspace, SCTPCTL_RECVSPACE);
|
||||
SCTP_UINT_SYSCTL(auto_asconf, sctp_auto_asconf, SCTPCTL_AUTOASCONF);
|
||||
SCTP_UINT_SYSCTL(ecn_enable, sctp_ecn_enable, SCTPCTL_ECN_ENABLE);
|
||||
SCTP_UINT_SYSCTL(pr_enable, sctp_pr_enable, SCTPCTL_PR_ENABLE);
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, auth_enable, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW,
|
||||
NULL, 0, sctp_sysctl_handle_auth, "IU", SCTPCTL_AUTH_ENABLE_DESC);
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, asconf_enable, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW,
|
||||
NULL, 0, sctp_sysctl_handle_asconf, "IU", SCTPCTL_ASCONF_ENABLE_DESC);
|
||||
SCTP_UINT_SYSCTL(reconfig_enable, sctp_reconfig_enable, SCTPCTL_RECONFIG_ENABLE)
|
||||
SCTP_UINT_SYSCTL(nrsack_enable, sctp_nrsack_enable, SCTPCTL_NRSACK_ENABLE)
|
||||
SCTP_UINT_SYSCTL(pktdrop_enable, sctp_pktdrop_enable, SCTPCTL_PKTDROP_ENABLE)
|
||||
SCTP_UINT_SYSCTL(reconfig_enable, sctp_reconfig_enable, SCTPCTL_RECONFIG_ENABLE);
|
||||
SCTP_UINT_SYSCTL(nrsack_enable, sctp_nrsack_enable, SCTPCTL_NRSACK_ENABLE);
|
||||
SCTP_UINT_SYSCTL(pktdrop_enable, sctp_pktdrop_enable, SCTPCTL_PKTDROP_ENABLE);
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
SCTP_UINT_SYSCTL(loopback_nocsum, sctp_no_csum_on_loopback, SCTPCTL_LOOPBACK_NOCSUM)
|
||||
SCTP_UINT_SYSCTL(loopback_nocsum, sctp_no_csum_on_loopback, SCTPCTL_LOOPBACK_NOCSUM);
|
||||
#endif
|
||||
SCTP_UINT_SYSCTL(peer_chkoh, sctp_peer_chunk_oh, SCTPCTL_PEER_CHKOH)
|
||||
SCTP_UINT_SYSCTL(maxburst, sctp_max_burst_default, SCTPCTL_MAXBURST)
|
||||
SCTP_UINT_SYSCTL(fr_maxburst, sctp_fr_max_burst_default, SCTPCTL_FRMAXBURST)
|
||||
SCTP_UINT_SYSCTL(maxchunks, sctp_max_chunks_on_queue, SCTPCTL_MAXCHUNKS)
|
||||
SCTP_UINT_SYSCTL(tcbhashsize, sctp_hashtblsize, SCTPCTL_TCBHASHSIZE)
|
||||
SCTP_UINT_SYSCTL(pcbhashsize, sctp_pcbtblsize, SCTPCTL_PCBHASHSIZE)
|
||||
SCTP_UINT_SYSCTL(min_split_point, sctp_min_split_point, SCTPCTL_MIN_SPLIT_POINT)
|
||||
SCTP_UINT_SYSCTL(chunkscale, sctp_chunkscale, SCTPCTL_CHUNKSCALE)
|
||||
SCTP_UINT_SYSCTL(delayed_sack_time, sctp_delayed_sack_time_default, SCTPCTL_DELAYED_SACK_TIME)
|
||||
SCTP_UINT_SYSCTL(sack_freq, sctp_sack_freq_default, SCTPCTL_SACK_FREQ)
|
||||
SCTP_UINT_SYSCTL(sys_resource, sctp_system_free_resc_limit, SCTPCTL_SYS_RESOURCE)
|
||||
SCTP_UINT_SYSCTL(asoc_resource, sctp_asoc_free_resc_limit, SCTPCTL_ASOC_RESOURCE)
|
||||
SCTP_UINT_SYSCTL(heartbeat_interval, sctp_heartbeat_interval_default, SCTPCTL_HEARTBEAT_INTERVAL)
|
||||
SCTP_UINT_SYSCTL(pmtu_raise_time, sctp_pmtu_raise_time_default, SCTPCTL_PMTU_RAISE_TIME)
|
||||
SCTP_UINT_SYSCTL(shutdown_guard_time, sctp_shutdown_guard_time_default, SCTPCTL_SHUTDOWN_GUARD_TIME)
|
||||
SCTP_UINT_SYSCTL(secret_lifetime, sctp_secret_lifetime_default, SCTPCTL_SECRET_LIFETIME)
|
||||
SCTP_UINT_SYSCTL(rto_max, sctp_rto_max_default, SCTPCTL_RTO_MAX)
|
||||
SCTP_UINT_SYSCTL(rto_min, sctp_rto_min_default, SCTPCTL_RTO_MIN)
|
||||
SCTP_UINT_SYSCTL(rto_initial, sctp_rto_initial_default, SCTPCTL_RTO_INITIAL)
|
||||
SCTP_UINT_SYSCTL(init_rto_max, sctp_init_rto_max_default, SCTPCTL_INIT_RTO_MAX)
|
||||
SCTP_UINT_SYSCTL(valid_cookie_life, sctp_valid_cookie_life_default, SCTPCTL_VALID_COOKIE_LIFE)
|
||||
SCTP_UINT_SYSCTL(init_rtx_max, sctp_init_rtx_max_default, SCTPCTL_INIT_RTX_MAX)
|
||||
SCTP_UINT_SYSCTL(assoc_rtx_max, sctp_assoc_rtx_max_default, SCTPCTL_ASSOC_RTX_MAX)
|
||||
SCTP_UINT_SYSCTL(path_rtx_max, sctp_path_rtx_max_default, SCTPCTL_PATH_RTX_MAX)
|
||||
SCTP_UINT_SYSCTL(path_pf_threshold, sctp_path_pf_threshold, SCTPCTL_PATH_PF_THRESHOLD)
|
||||
SCTP_UINT_SYSCTL(add_more_on_output, sctp_add_more_threshold, SCTPCTL_ADD_MORE_ON_OUTPUT)
|
||||
SCTP_UINT_SYSCTL(incoming_streams, sctp_nr_incoming_streams_default, SCTPCTL_INCOMING_STREAMS)
|
||||
SCTP_UINT_SYSCTL(outgoing_streams, sctp_nr_outgoing_streams_default, SCTPCTL_OUTGOING_STREAMS)
|
||||
SCTP_UINT_SYSCTL(cmt_on_off, sctp_cmt_on_off, SCTPCTL_CMT_ON_OFF)
|
||||
SCTP_UINT_SYSCTL(cmt_use_dac, sctp_cmt_use_dac, SCTPCTL_CMT_USE_DAC)
|
||||
SCTP_UINT_SYSCTL(cwnd_maxburst, sctp_use_cwnd_based_maxburst, SCTPCTL_CWND_MAXBURST)
|
||||
SCTP_UINT_SYSCTL(nat_friendly, sctp_nat_friendly, SCTPCTL_NAT_FRIENDLY)
|
||||
SCTP_UINT_SYSCTL(abc_l_var, sctp_L2_abc_variable, SCTPCTL_ABC_L_VAR)
|
||||
SCTP_UINT_SYSCTL(max_chained_mbufs, sctp_mbuf_threshold_count, SCTPCTL_MAX_CHAINED_MBUFS)
|
||||
SCTP_UINT_SYSCTL(do_sctp_drain, sctp_do_drain, SCTPCTL_DO_SCTP_DRAIN)
|
||||
SCTP_UINT_SYSCTL(hb_max_burst, sctp_hb_maxburst, SCTPCTL_HB_MAX_BURST)
|
||||
SCTP_UINT_SYSCTL(abort_at_limit, sctp_abort_if_one_2_one_hits_limit, SCTPCTL_ABORT_AT_LIMIT)
|
||||
SCTP_UINT_SYSCTL(min_residual, sctp_min_residual, SCTPCTL_MIN_RESIDUAL)
|
||||
SCTP_UINT_SYSCTL(max_retran_chunk, sctp_max_retran_chunk, SCTPCTL_MAX_RETRAN_CHUNK)
|
||||
SCTP_UINT_SYSCTL(log_level, sctp_logging_level, SCTPCTL_LOGGING_LEVEL)
|
||||
SCTP_UINT_SYSCTL(default_cc_module, sctp_default_cc_module, SCTPCTL_DEFAULT_CC_MODULE)
|
||||
SCTP_UINT_SYSCTL(default_ss_module, sctp_default_ss_module, SCTPCTL_DEFAULT_SS_MODULE)
|
||||
SCTP_UINT_SYSCTL(default_frag_interleave, sctp_default_frag_interleave, SCTPCTL_DEFAULT_FRAG_INTERLEAVE)
|
||||
SCTP_UINT_SYSCTL(mobility_base, sctp_mobility_base, SCTPCTL_MOBILITY_BASE)
|
||||
SCTP_UINT_SYSCTL(mobility_fasthandoff, sctp_mobility_fasthandoff, SCTPCTL_MOBILITY_FASTHANDOFF)
|
||||
SCTP_UINT_SYSCTL(peer_chkoh, sctp_peer_chunk_oh, SCTPCTL_PEER_CHKOH);
|
||||
SCTP_UINT_SYSCTL(maxburst, sctp_max_burst_default, SCTPCTL_MAXBURST);
|
||||
SCTP_UINT_SYSCTL(fr_maxburst, sctp_fr_max_burst_default, SCTPCTL_FRMAXBURST);
|
||||
SCTP_UINT_SYSCTL(maxchunks, sctp_max_chunks_on_queue, SCTPCTL_MAXCHUNKS);
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
SCTP_UINT_SYSCTL_RDTUN(tcbhashsize, sctp_hashtblsize, SCTPCTL_TCBHASHSIZE);
|
||||
SCTP_UINT_SYSCTL_TUN(pcbhashsize, sctp_pcbtblsize, SCTPCTL_PCBHASHSIZE);
|
||||
SCTP_UINT_SYSCTL_RDTUN(chunkscale, sctp_chunkscale, SCTPCTL_CHUNKSCALE);
|
||||
#else
|
||||
SCTP_UINT_SYSCTL(tcbhashsize, sctp_hashtblsize, SCTPCTL_TCBHASHSIZE);
|
||||
SCTP_UINT_SYSCTL(pcbhashsize, sctp_pcbtblsize, SCTPCTL_PCBHASHSIZE);
|
||||
SCTP_UINT_SYSCTL(chunkscale, sctp_chunkscale, SCTPCTL_CHUNKSCALE);
|
||||
#endif
|
||||
SCTP_UINT_SYSCTL(min_split_point, sctp_min_split_point, SCTPCTL_MIN_SPLIT_POINT);
|
||||
SCTP_UINT_SYSCTL(delayed_sack_time, sctp_delayed_sack_time_default, SCTPCTL_DELAYED_SACK_TIME);
|
||||
SCTP_UINT_SYSCTL(sack_freq, sctp_sack_freq_default, SCTPCTL_SACK_FREQ);
|
||||
SCTP_UINT_SYSCTL(sys_resource, sctp_system_free_resc_limit, SCTPCTL_SYS_RESOURCE);
|
||||
SCTP_UINT_SYSCTL(asoc_resource, sctp_asoc_free_resc_limit, SCTPCTL_ASOC_RESOURCE);
|
||||
SCTP_UINT_SYSCTL(heartbeat_interval, sctp_heartbeat_interval_default, SCTPCTL_HEARTBEAT_INTERVAL);
|
||||
SCTP_UINT_SYSCTL(pmtu_raise_time, sctp_pmtu_raise_time_default, SCTPCTL_PMTU_RAISE_TIME);
|
||||
SCTP_UINT_SYSCTL(shutdown_guard_time, sctp_shutdown_guard_time_default, SCTPCTL_SHUTDOWN_GUARD_TIME);
|
||||
SCTP_UINT_SYSCTL(secret_lifetime, sctp_secret_lifetime_default, SCTPCTL_SECRET_LIFETIME);
|
||||
SCTP_UINT_SYSCTL(rto_max, sctp_rto_max_default, SCTPCTL_RTO_MAX);
|
||||
SCTP_UINT_SYSCTL(rto_min, sctp_rto_min_default, SCTPCTL_RTO_MIN);
|
||||
SCTP_UINT_SYSCTL(rto_initial, sctp_rto_initial_default, SCTPCTL_RTO_INITIAL);
|
||||
SCTP_UINT_SYSCTL(init_rto_max, sctp_init_rto_max_default, SCTPCTL_INIT_RTO_MAX);
|
||||
SCTP_UINT_SYSCTL(valid_cookie_life, sctp_valid_cookie_life_default, SCTPCTL_VALID_COOKIE_LIFE);
|
||||
SCTP_UINT_SYSCTL(init_rtx_max, sctp_init_rtx_max_default, SCTPCTL_INIT_RTX_MAX);
|
||||
SCTP_UINT_SYSCTL(assoc_rtx_max, sctp_assoc_rtx_max_default, SCTPCTL_ASSOC_RTX_MAX);
|
||||
SCTP_UINT_SYSCTL(path_rtx_max, sctp_path_rtx_max_default, SCTPCTL_PATH_RTX_MAX);
|
||||
SCTP_UINT_SYSCTL(path_pf_threshold, sctp_path_pf_threshold, SCTPCTL_PATH_PF_THRESHOLD);
|
||||
SCTP_UINT_SYSCTL(add_more_on_output, sctp_add_more_threshold, SCTPCTL_ADD_MORE_ON_OUTPUT);
|
||||
SCTP_UINT_SYSCTL(incoming_streams, sctp_nr_incoming_streams_default, SCTPCTL_INCOMING_STREAMS);
|
||||
SCTP_UINT_SYSCTL(outgoing_streams, sctp_nr_outgoing_streams_default, SCTPCTL_OUTGOING_STREAMS);
|
||||
SCTP_UINT_SYSCTL(cmt_on_off, sctp_cmt_on_off, SCTPCTL_CMT_ON_OFF);
|
||||
SCTP_UINT_SYSCTL(cmt_use_dac, sctp_cmt_use_dac, SCTPCTL_CMT_USE_DAC);
|
||||
SCTP_UINT_SYSCTL(cwnd_maxburst, sctp_use_cwnd_based_maxburst, SCTPCTL_CWND_MAXBURST);
|
||||
SCTP_UINT_SYSCTL(nat_friendly, sctp_nat_friendly, SCTPCTL_NAT_FRIENDLY);
|
||||
SCTP_UINT_SYSCTL(abc_l_var, sctp_L2_abc_variable, SCTPCTL_ABC_L_VAR);
|
||||
SCTP_UINT_SYSCTL(max_chained_mbufs, sctp_mbuf_threshold_count, SCTPCTL_MAX_CHAINED_MBUFS);
|
||||
SCTP_UINT_SYSCTL(do_sctp_drain, sctp_do_drain, SCTPCTL_DO_SCTP_DRAIN);
|
||||
SCTP_UINT_SYSCTL(hb_max_burst, sctp_hb_maxburst, SCTPCTL_HB_MAX_BURST);
|
||||
SCTP_UINT_SYSCTL(abort_at_limit, sctp_abort_if_one_2_one_hits_limit, SCTPCTL_ABORT_AT_LIMIT);
|
||||
SCTP_UINT_SYSCTL(min_residual, sctp_min_residual, SCTPCTL_MIN_RESIDUAL);
|
||||
SCTP_UINT_SYSCTL(max_retran_chunk, sctp_max_retran_chunk, SCTPCTL_MAX_RETRAN_CHUNK);
|
||||
SCTP_UINT_SYSCTL(log_level, sctp_logging_level, SCTPCTL_LOGGING_LEVEL);
|
||||
SCTP_UINT_SYSCTL(default_cc_module, sctp_default_cc_module, SCTPCTL_DEFAULT_CC_MODULE);
|
||||
SCTP_UINT_SYSCTL(default_ss_module, sctp_default_ss_module, SCTPCTL_DEFAULT_SS_MODULE);
|
||||
SCTP_UINT_SYSCTL(default_frag_interleave, sctp_default_frag_interleave, SCTPCTL_DEFAULT_FRAG_INTERLEAVE);
|
||||
SCTP_UINT_SYSCTL(mobility_base, sctp_mobility_base, SCTPCTL_MOBILITY_BASE);
|
||||
SCTP_UINT_SYSCTL(mobility_fasthandoff, sctp_mobility_fasthandoff, SCTPCTL_MOBILITY_FASTHANDOFF);
|
||||
#if defined(SCTP_LOCAL_TRACE_BUF)
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, log, CTLFLAG_VNET|CTLTYPE_STRUCT|CTLFLAG_RD,
|
||||
NULL, 0, sctp_sysctl_handle_trace_log, "S,sctplog", "SCTP logging (struct sctp_log)");
|
||||
|
@ -1228,32 +1247,32 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, clear_trace, CTLFLAG_VNET|CTLTYPE_UINT | C
|
|||
#endif
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, udp_tunneling_port, CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW,
|
||||
NULL, 0, sctp_sysctl_handle_udp_tunneling, "IU", SCTPCTL_UDP_TUNNELING_PORT_DESC);
|
||||
SCTP_UINT_SYSCTL(enable_sack_immediately, sctp_enable_sack_immediately, SCTPCTL_SACK_IMMEDIATELY_ENABLE)
|
||||
SCTP_UINT_SYSCTL(nat_friendly_init, sctp_inits_include_nat_friendly, SCTPCTL_NAT_FRIENDLY_INITS)
|
||||
SCTP_UINT_SYSCTL(vtag_time_wait, sctp_vtag_time_wait, SCTPCTL_TIME_WAIT)
|
||||
SCTP_UINT_SYSCTL(buffer_splitting, sctp_buffer_splitting, SCTPCTL_BUFFER_SPLITTING)
|
||||
SCTP_UINT_SYSCTL(initial_cwnd, sctp_initial_cwnd, SCTPCTL_INITIAL_CWND)
|
||||
SCTP_UINT_SYSCTL(rttvar_bw, sctp_rttvar_bw, SCTPCTL_RTTVAR_BW)
|
||||
SCTP_UINT_SYSCTL(rttvar_rtt, sctp_rttvar_rtt, SCTPCTL_RTTVAR_RTT)
|
||||
SCTP_UINT_SYSCTL(rttvar_eqret, sctp_rttvar_eqret, SCTPCTL_RTTVAR_EQRET)
|
||||
SCTP_UINT_SYSCTL(rttvar_steady_step, sctp_steady_step, SCTPCTL_RTTVAR_STEADYS)
|
||||
SCTP_UINT_SYSCTL(use_dcccecn, sctp_use_dccc_ecn, SCTPCTL_RTTVAR_DCCCECN)
|
||||
SCTP_UINT_SYSCTL(blackhole, sctp_blackhole, SCTPCTL_BLACKHOLE)
|
||||
SCTP_UINT_SYSCTL(sendall_limit, sctp_sendall_limit, SCTPCTL_SENDALL_LIMIT)
|
||||
SCTP_UINT_SYSCTL(diag_info_code, sctp_diag_info_code, SCTPCTL_DIAG_INFO_CODE)
|
||||
SCTP_UINT_SYSCTL(ootb_with_zero_cksum, sctp_ootb_with_zero_cksum, SCTPCTL_OOTB_WITH_ZERO_CKSUM)
|
||||
SCTP_UINT_SYSCTL(enable_sack_immediately, sctp_enable_sack_immediately, SCTPCTL_SACK_IMMEDIATELY_ENABLE);
|
||||
SCTP_UINT_SYSCTL(nat_friendly_init, sctp_inits_include_nat_friendly, SCTPCTL_NAT_FRIENDLY_INITS);
|
||||
SCTP_UINT_SYSCTL(vtag_time_wait, sctp_vtag_time_wait, SCTPCTL_TIME_WAIT);
|
||||
SCTP_UINT_SYSCTL(buffer_splitting, sctp_buffer_splitting, SCTPCTL_BUFFER_SPLITTING);
|
||||
SCTP_UINT_SYSCTL(initial_cwnd, sctp_initial_cwnd, SCTPCTL_INITIAL_CWND);
|
||||
SCTP_UINT_SYSCTL(rttvar_bw, sctp_rttvar_bw, SCTPCTL_RTTVAR_BW);
|
||||
SCTP_UINT_SYSCTL(rttvar_rtt, sctp_rttvar_rtt, SCTPCTL_RTTVAR_RTT);
|
||||
SCTP_UINT_SYSCTL(rttvar_eqret, sctp_rttvar_eqret, SCTPCTL_RTTVAR_EQRET);
|
||||
SCTP_UINT_SYSCTL(rttvar_steady_step, sctp_steady_step, SCTPCTL_RTTVAR_STEADYS);
|
||||
SCTP_UINT_SYSCTL(use_dcccecn, sctp_use_dccc_ecn, SCTPCTL_RTTVAR_DCCCECN);
|
||||
SCTP_UINT_SYSCTL(blackhole, sctp_blackhole, SCTPCTL_BLACKHOLE);
|
||||
SCTP_UINT_SYSCTL(sendall_limit, sctp_sendall_limit, SCTPCTL_SENDALL_LIMIT);
|
||||
SCTP_UINT_SYSCTL(diag_info_code, sctp_diag_info_code, SCTPCTL_DIAG_INFO_CODE);
|
||||
SCTP_UINT_SYSCTL(ootb_with_zero_cksum, sctp_ootb_with_zero_cksum, SCTPCTL_OOTB_WITH_ZERO_CKSUM);
|
||||
#ifdef SCTP_DEBUG
|
||||
SCTP_UINT_SYSCTL(debug, sctp_debug_on, SCTPCTL_DEBUG)
|
||||
SCTP_UINT_SYSCTL(debug, sctp_debug_on, SCTPCTL_DEBUG);
|
||||
#endif
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
SCTP_UINT_SYSCTL(main_timer, sctp_main_timer, SCTPCTL_MAIN_TIMER)
|
||||
SCTP_UINT_SYSCTL(main_timer, sctp_main_timer, SCTPCTL_MAIN_TIMER);
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, ignore_vmware_interfaces, CTLTYPE_UINT|CTLFLAG_RW,
|
||||
NULL, 0, sctp_sysctl_handle_vmware_interfaces, "IU", SCTPCTL_IGNORE_VMWARE_INTERFACES_DESC);
|
||||
SCTP_UINT_SYSCTL(addr_watchdog_limit, sctp_addr_watchdog_limit, SCTPCTL_ADDR_WATCHDOG_LIMIT)
|
||||
SCTP_UINT_SYSCTL(vtag_watchdog_limit, sctp_vtag_watchdog_limit, SCTPCTL_VTAG_WATCHDOG_LIMIT)
|
||||
SCTP_UINT_SYSCTL(addr_watchdog_limit, sctp_addr_watchdog_limit, SCTPCTL_ADDR_WATCHDOG_LIMIT);
|
||||
SCTP_UINT_SYSCTL(vtag_watchdog_limit, sctp_vtag_watchdog_limit, SCTPCTL_VTAG_WATCHDOG_LIMIT);
|
||||
#endif
|
||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||
SCTP_UINT_SYSCTL(output_unlocked, sctp_output_unlocked, SCTPCTL_OUTPUT_UNLOCKED)
|
||||
SCTP_UINT_SYSCTL(output_unlocked, sctp_output_unlocked, SCTPCTL_OUTPUT_UNLOCKED);
|
||||
#endif
|
||||
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_VNET|CTLTYPE_STRUCT|CTLFLAG_RW,
|
||||
NULL, 0, sctp_sysctl_handle_stats, "S,sctpstat", "SCTP statistics (struct sctp_stat)");
|
||||
|
|
|
@ -1312,7 +1312,9 @@ sctp_flush(struct socket *so, int how)
|
|||
}
|
||||
sctp_free_a_readq(stcb, control);
|
||||
} else {
|
||||
stcb->asoc.size_on_all_streams += control->length;
|
||||
if (stcb != NULL) {
|
||||
stcb->asoc.size_on_all_streams += control->length;
|
||||
}
|
||||
}
|
||||
}
|
||||
SOCK_UNLOCK(so);
|
||||
|
|
|
@ -2021,7 +2021,7 @@ sctp_timeout_handler(void *t)
|
|||
type, inp, stcb, net));
|
||||
SCTP_STAT_INCR(sctps_timosecret);
|
||||
(void)SCTP_GETTIME_TIMEVAL(&tv);
|
||||
inp->sctp_ep.time_of_secret_change = (unsigned int)tv.tv_sec;
|
||||
inp->sctp_ep.time_of_secret_change = tv.tv_sec;
|
||||
inp->sctp_ep.last_secret_number =
|
||||
inp->sctp_ep.current_secret_number;
|
||||
inp->sctp_ep.current_secret_number++;
|
||||
|
@ -2393,19 +2393,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
|||
} else {
|
||||
to_ticks = net->RTO;
|
||||
}
|
||||
rndval = sctp_select_initial_TSN(&inp->sctp_ep);
|
||||
jitter = rndval % to_ticks;
|
||||
if (to_ticks > 1) {
|
||||
to_ticks >>= 1;
|
||||
}
|
||||
if (jitter < (UINT32_MAX - to_ticks)) {
|
||||
to_ticks += jitter;
|
||||
} else {
|
||||
to_ticks = UINT32_MAX;
|
||||
}
|
||||
if (!((net->dest_state & SCTP_ADDR_UNCONFIRMED) &&
|
||||
(net->dest_state & SCTP_ADDR_REACHABLE)) &&
|
||||
((net->dest_state & SCTP_ADDR_PF) == 0)) {
|
||||
if (to_ticks > 1) {
|
||||
rndval = sctp_select_initial_TSN(&inp->sctp_ep);
|
||||
jitter = rndval % to_ticks;
|
||||
to_ticks >>= 1;
|
||||
if (jitter < (UINT32_MAX - to_ticks)) {
|
||||
to_ticks += jitter;
|
||||
} else {
|
||||
to_ticks = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) {
|
||||
to_ticks += net->heart_beat_delay;
|
||||
} else {
|
||||
|
@ -6268,7 +6268,9 @@ sctp_sorecvmsg(struct socket *so,
|
|||
}
|
||||
so->so_state &= ~(SS_ISCONNECTING |
|
||||
SS_ISDISCONNECTING |
|
||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
||||
SS_ISCONFIRMING |
|
||||
#endif
|
||||
SS_ISCONNECTED);
|
||||
if (error == 0) {
|
||||
if ((inp->sctp_flags & SCTP_PCB_FLAGS_WAS_CONNECTED) == 0) {
|
||||
|
|
|
@ -648,7 +648,7 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d)
|
|||
#endif
|
||||
|
||||
/*
|
||||
* this routine can probably be collasped into the one in sctp_userreq.c
|
||||
* this routine can probably be collapsed into the one in sctp_userreq.c
|
||||
* since they do the same thing and now we lookup with a sockaddr
|
||||
*/
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
|
@ -1104,8 +1104,8 @@ connected_type:
|
|||
* note with the current version this code will only be used
|
||||
* by OpenBSD, NetBSD and FreeBSD have methods for
|
||||
* re-defining sosend() to use sctp_sosend(). One can
|
||||
* optionaly switch back to this code (by changing back the
|
||||
* defininitions but this is not advisable.
|
||||
* optionally switch back to this code (by changing back the
|
||||
* definitions but this is not advisable.
|
||||
*/
|
||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||
struct epoch_tracker et;
|
||||
|
|
|
@ -30,15 +30,6 @@
|
|||
|
||||
#ifndef _USER_ENVIRONMENT_H_
|
||||
#define _USER_ENVIRONMENT_H_
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Needed for unified build so that rand_s is available to all unified
|
||||
// sources.
|
||||
#if !defined(_CRT_RAND_S) && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
||||
#define _CRT_RAND_S
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* __Userspace__ */
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
|
@ -404,15 +404,25 @@ void sofree(struct socket *so);
|
|||
#define soref(so) do { \
|
||||
SOCK_LOCK_ASSERT(so); \
|
||||
++(so)->so_count; \
|
||||
SCTPDBG(SCTP_DEBUG_USR, "soref(%p) -> %d, %s:%s:%d\n", \
|
||||
(so), (so)->so_count, \
|
||||
__func__, __FILE__, __LINE__) \
|
||||
} while (0)
|
||||
|
||||
#define sorele(so) do { \
|
||||
ACCEPT_LOCK_ASSERT(); \
|
||||
SOCK_LOCK_ASSERT(so); \
|
||||
KASSERT((so)->so_count > 0, ("sorele")); \
|
||||
if (--(so)->so_count == 0) \
|
||||
if (--(so)->so_count == 0) { \
|
||||
SCTPDBG(SCTP_DEBUG_USR, "sorele(%p) -> %d, %s:%s:%d\n", \
|
||||
(so), (so)->so_count, \
|
||||
__func__, __FILE__, __LINE__) \
|
||||
sofree(so); \
|
||||
} \
|
||||
else { \
|
||||
SCTPDBG(SCTP_DEBUG_USR, "sorele(%p) -> %d, %s:%s:%d\n", \
|
||||
(so), (so)->so_count, \
|
||||
__func__, __FILE__, __LINE__) \
|
||||
SOCK_UNLOCK(so); \
|
||||
ACCEPT_UNLOCK(); \
|
||||
} \
|
||||
|
|
Загрузка…
Ссылка в новой задаче