Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
64eb1e5f
提交
64eb1e5f
authored
4月 05, 2020
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Really update usrsctp
上级
99fe3bb1
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
256 行增加
和
207 行删除
+256
-207
CHANGELOG.md
CHANGELOG.md
+5
-0
CMakeLists.txt
worker/deps/usrsctp/usrsctp/CMakeLists.txt
+2
-1
ekr_loop.c
worker/deps/usrsctp/usrsctp/programs/ekr_loop.c
+12
-0
programs_helper.c
worker/deps/usrsctp/usrsctp/programs/programs_helper.c
+15
-1
CMakeLists.txt
worker/deps/usrsctp/usrsctp/usrsctplib/CMakeLists.txt
+9
-3
sctp_asconf.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_asconf.c
+5
-6
sctp_asconf.h
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_asconf.h
+2
-2
sctp_auth.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_auth.c
+5
-5
sctp_callout.c
...er/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_callout.c
+2
-1
sctp_cc_functions.c
...ps/usrsctp/usrsctp/usrsctplib/netinet/sctp_cc_functions.c
+3
-3
sctp_constants.h
.../deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_constants.h
+1
-11
sctp_indata.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_indata.c
+3
-3
sctp_input.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_input.c
+13
-15
sctp_lock_userspace.h
.../usrsctp/usrsctp/usrsctplib/netinet/sctp_lock_userspace.h
+3
-5
sctp_output.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_output.c
+15
-9
sctp_pcb.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.c
+40
-42
sctp_pcb.h
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.h
+7
-7
sctp_process_lock.h
...ps/usrsctp/usrsctp/usrsctplib/netinet/sctp_process_lock.h
+12
-2
sctp_structs.h
...er/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_structs.h
+8
-8
sctp_timer.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_timer.c
+31
-36
sctp_timer.h
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_timer.h
+8
-9
sctp_usrreq.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_usrreq.c
+49
-37
sctputil.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctputil.c
+0
-0
sctputil.h
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctputil.h
+6
-1
没有找到文件。
CHANGELOG.md
浏览文件 @
64eb1e5f
# Changelog
### 3.5.7 (WIP)
*
Update
`usrsctp`
library.
### 3.5.6
*
`SeqManager.cpp`
: Fix video lag after a long time.
...
...
worker/deps/usrsctp/usrsctp/CMakeLists.txt
浏览文件 @
64eb1e5f
...
...
@@ -259,8 +259,9 @@ elseif (CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Appl
endif
()
if
(
sctp_build_fuzzer
)
set
(
CMAKE_BUILD_TYPE
"DEBUG"
)
add_definitions
(
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-fsanitize=fuzzer-no-link"
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-
O1 -
fsanitize=fuzzer-no-link"
)
endif
()
endif
()
...
...
worker/deps/usrsctp/usrsctp/programs/ekr_loop.c
浏览文件 @
64eb1e5f
...
...
@@ -263,6 +263,7 @@ main(int argc, char *argv[])
{
struct
sockaddr_in
sin_s
,
sin_c
;
struct
sockaddr_conn
sconn
;
struct
sctp_paddrparams
paddrparams
;
#ifdef _WIN32
SOCKET
fd_c
,
fd_s
;
#else
...
...
@@ -413,6 +414,17 @@ main(int argc, char *argv[])
exit
(
EXIT_FAILURE
);
}
debug_printf
(
"to %d.
\n
"
,
cur_buf_size
);
memset
(
&
paddrparams
,
0
,
sizeof
(
struct
sctp_paddrparams
));
paddrparams
.
spp_address
.
ss_family
=
AF_CONN
;
#ifdef HAVE_SCONN_LEN
paddrparams
.
spp_address
.
ss_len
=
sizeof
(
struct
sockaddr_conn
);
#endif
paddrparams
.
spp_flags
=
SPP_PMTUD_DISABLE
;
paddrparams
.
spp_pathmtu
=
9000
;
if
(
usrsctp_setsockopt
(
s_c
,
IPPROTO_SCTP
,
SCTP_PEER_ADDR_PARAMS
,
&
paddrparams
,
sizeof
(
struct
sctp_paddrparams
))
<
0
)
{
perror
(
"usrsctp_setsockopt"
);
exit
(
EXIT_FAILURE
);
}
if
((
s_l
=
usrsctp_socket
(
AF_CONN
,
SOCK_STREAM
,
IPPROTO_SCTP
,
receive_cb
,
NULL
,
0
,
&
fd_s
))
==
NULL
)
{
perror
(
"usrsctp_socket"
);
exit
(
EXIT_FAILURE
);
...
...
worker/deps/usrsctp/usrsctp/programs/programs_helper.c
浏览文件 @
64eb1e5f
...
...
@@ -52,10 +52,24 @@ void
debug_printf_stack
(
const
char
*
format
,
...)
{
va_list
ap
;
char
charbuf
[
1024
];
static
struct
timeval
time_main
;
struct
timeval
time_now
;
struct
timeval
time_delta
;
if
(
time_main
.
tv_sec
==
0
&&
time_main
.
tv_usec
==
0
)
{
gettimeofday
(
&
time_main
,
NULL
);
}
gettimeofday
(
&
time_now
,
NULL
);
timersub
(
&
time_now
,
&
time_main
,
&
time_delta
);
va_start
(
ap
,
format
);
vprintf
(
format
,
ap
);
//vfprintf(stderr, format, ap);
vsnprintf
(
charbuf
,
1024
,
format
,
ap
);
va_end
(
ap
);
fprintf
(
stderr
,
"[S][%u.%03u] %s"
,
(
unsigned
int
)
time_delta
.
tv_sec
,
(
unsigned
int
)
time_delta
.
tv_usec
/
1000
,
charbuf
);
}
static
void
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/CMakeLists.txt
浏览文件 @
64eb1e5f
...
...
@@ -43,6 +43,8 @@ set(includedir ${prefix}/include/usrsctp)
set
(
CMAKE_REQUIRED_INCLUDES
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
CMAKE_MACOSX_RPATH 1
)
include
(
CheckCCompilerFlag
)
add_definitions
(
-D__Userspace__
)
add_definitions
(
-D__Userspace_os_
${
CMAKE_SYSTEM_NAME
}
)
add_definitions
(
-DSCTP_SIMPLE_ALLOCATOR
)
...
...
@@ -53,11 +55,16 @@ add_definitions(-DSCTP_PROCESS_LEVEL_LOCKS)
# OS DEPENDENT
#################################################
check_c_compiler_flag
(
-Wno-address-of-packed-member has_wno_address_of_packe
t
_member
)
if
(
has_wno_address_of_packe
t
_member
)
check_c_compiler_flag
(
-Wno-address-of-packed-member has_wno_address_of_packe
d
_member
)
if
(
has_wno_address_of_packe
d
_member
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-address-of-packed-member"
)
endif
()
check_c_compiler_flag
(
-Wno-deprecated-declarations has_wno_deprecated_declarations
)
if
(
has_wno_deprecated_declarations
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-deprecated-declarations"
)
endif
()
if
(
CMAKE_SYSTEM_NAME MATCHES
"Linux"
)
add_definitions
(
-D_GNU_SOURCE
)
endif
()
...
...
@@ -69,7 +76,6 @@ endif ()
if
(
CMAKE_SYSTEM_NAME MATCHES
"Darwin"
)
add_definitions
(
-U__APPLE__
)
add_definitions
(
-D__APPLE_USE_RFC_2292
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wno-deprecated-declarations"
)
endif
()
if
(
CMAKE_SYSTEM_NAME MATCHES
"DragonFly"
)
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_asconf.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_asconf.c 35
7197 2020-01-28 10:09:05
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_asconf.c 35
9195 2020-03-21 16:12:19
Z tuexen $"
);
#endif
#include <netinet/sctp_os.h>
...
...
@@ -602,8 +602,7 @@ sctp_process_asconf_set_primary(struct sockaddr *src,
sctp_move_chunks_from_net
(
stcb
,
stcb
->
asoc
.
deleted_primary
);
}
sctp_delete_prim_timer
(
stcb
->
sctp_ep
,
stcb
,
stcb
->
asoc
.
deleted_primary
);
sctp_delete_prim_timer
(
stcb
->
sctp_ep
,
stcb
);
}
}
else
{
/* couldn't set the requested primary address! */
...
...
@@ -955,12 +954,12 @@ sctp_addr_match(struct sctp_paramhdr *ph, struct sockaddr *sa)
* Cleanup for non-responded/OP ERR'd ASCONF
*/
void
sctp_asconf_cleanup
(
struct
sctp_tcb
*
stcb
,
struct
sctp_nets
*
net
)
sctp_asconf_cleanup
(
struct
sctp_tcb
*
stcb
)
{
/*
* clear out any existing asconfs going out
*/
sctp_timer_stop
(
SCTP_TIMER_TYPE_ASCONF
,
stcb
->
sctp_ep
,
stcb
,
net
,
sctp_timer_stop
(
SCTP_TIMER_TYPE_ASCONF
,
stcb
->
sctp_ep
,
stcb
,
NULL
,
SCTP_FROM_SCTP_ASCONF
+
SCTP_LOC_2
);
stcb
->
asoc
.
asconf_seq_out_acked
=
stcb
->
asoc
.
asconf_seq_out
;
/* remove the old ASCONF on our outbound queue */
...
...
@@ -1739,7 +1738,7 @@ sctp_handle_asconf_ack(struct mbuf *m, int offset,
if
(
serial_num
==
asoc
->
asconf_seq_out
-
1
)
{
/* stop our timer */
sctp_timer_stop
(
SCTP_TIMER_TYPE_ASCONF
,
stcb
->
sctp_ep
,
stcb
,
net
,
sctp_timer_stop
(
SCTP_TIMER_TYPE_ASCONF
,
stcb
->
sctp_ep
,
stcb
,
NULL
,
SCTP_FROM_SCTP_ASCONF
+
SCTP_LOC_5
);
}
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_asconf.h
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_asconf.h 3
24056 2017-09-27 13:05:23
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_asconf.h 3
59152 2020-03-19 21:01:16
Z tuexen $"
);
#endif
#ifndef _NETINET_SCTP_ASCONF_H_
...
...
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD: head/sys/netinet/sctp_asconf.h 324056 2017-09-27 13:05:23Z t
/*
* function prototypes
*/
extern
void
sctp_asconf_cleanup
(
struct
sctp_tcb
*
,
struct
sctp_nets
*
);
extern
void
sctp_asconf_cleanup
(
struct
sctp_tcb
*
);
extern
struct
mbuf
*
sctp_compose_asconf
(
struct
sctp_tcb
*
,
int
*
,
int
);
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_auth.c
浏览文件 @
64eb1e5f
...
...
@@ -1650,6 +1650,11 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *auth,
"SCTP AUTH Chunk: shared key %u, HMAC id %u
\n
"
,
shared_key_id
,
hmac_id
);
#if defined(__Userspace__)
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
return
(
0
);
#endif
#endif
/* is the indicated HMAC supported? */
if
(
!
sctp_auth_is_supported_hmac
(
stcb
->
asoc
.
local_hmacs
,
hmac_id
))
{
struct
mbuf
*
op_err
;
...
...
@@ -1730,11 +1735,6 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *auth,
(
void
)
sctp_compute_hmac_m
(
hmac_id
,
stcb
->
asoc
.
authinfo
.
recv_key
,
m
,
offset
,
computed_digest
);
#if defined(__Userspace__)
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
return
(
0
);
#endif
#endif
/* compare the computed digest with the one in the AUTH chunk */
if
(
timingsafe_bcmp
(
digest
,
computed_digest
,
digestlen
)
!=
0
)
{
SCTP_STAT_INCR
(
sctps_recvauthfailed
);
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_callout.c
浏览文件 @
64eb1e5f
...
...
@@ -54,6 +54,7 @@
#include <netinet/sctp_callout.h>
#include <netinet/sctp_pcb.h>
#endif
#include <netinet/sctputil.h>
/*
* Callout/Timer routines for OS that doesn't have them
...
...
@@ -210,7 +211,7 @@ user_sctp_timer_iterate(void *arg)
if
(
atomic_cmpset_int
(
&
SCTP_BASE_VAR
(
timer_thread_should_exit
),
1
,
1
))
{
break
;
}
sctp_handle_tick
(
MSEC_TO_TICKS
(
TIMEOUT_INTERVAL
));
sctp_handle_tick
(
sctp_msecs_to_ticks
(
TIMEOUT_INTERVAL
));
}
return
(
NULL
);
}
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_cc_functions.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_cc_functions.c 35
6660 2020-01-12 15:45:27
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_cc_functions.c 35
9405 2020-03-28 20:25:45
Z tuexen $"
);
#endif
#include <netinet/sctp_os.h>
...
...
@@ -2000,7 +2000,7 @@ measure_rtt(struct sctp_nets *net)
if
(
net
->
fast_retran_ip
==
0
&&
net
->
ssthresh
<
0xFFFF
&&
htcp_ccount
(
&
net
->
cc_mod
.
htcp_ca
)
>
3
)
{
if
(
net
->
cc_mod
.
htcp_ca
.
maxRTT
<
net
->
cc_mod
.
htcp_ca
.
minRTT
)
net
->
cc_mod
.
htcp_ca
.
maxRTT
=
net
->
cc_mod
.
htcp_ca
.
minRTT
;
if
(
net
->
cc_mod
.
htcp_ca
.
maxRTT
<
srtt
&&
srtt
<=
net
->
cc_mod
.
htcp_ca
.
maxRTT
+
MSEC_TO_TICKS
(
20
))
if
(
net
->
cc_mod
.
htcp_ca
.
maxRTT
<
srtt
&&
srtt
<=
net
->
cc_mod
.
htcp_ca
.
maxRTT
+
sctp_msecs_to_ticks
(
20
))
net
->
cc_mod
.
htcp_ca
.
maxRTT
=
srtt
;
}
}
...
...
@@ -2060,7 +2060,7 @@ htcp_beta_update(struct htcp *ca, uint32_t minRTT, uint32_t maxRTT)
}
}
if
(
ca
->
modeswitch
&&
minRTT
>
(
uint32_t
)
MSEC_TO_TICKS
(
10
)
&&
maxRTT
)
{
if
(
ca
->
modeswitch
&&
minRTT
>
sctp_msecs_to_ticks
(
10
)
&&
maxRTT
)
{
ca
->
beta
=
(
minRTT
<<
7
)
/
maxRTT
;
if
(
ca
->
beta
<
BETA_MIN
)
ca
->
beta
=
BETA_MIN
;
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_constants.h
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_constants.h 35
8169 2020-02-20 15:37:44
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_constants.h 35
9405 2020-03-28 20:25:45
Z tuexen $"
);
#endif
#ifndef _NETINET_SCTP_CONSTANTS_H_
...
...
@@ -593,16 +593,6 @@ extern void getwintimeofday(struct timeval *tv);
#endif
/* The conversion from time to ticks and vice versa is done by rounding
* upwards. This way we can test in the code the time to be positive and
* know that this corresponds to a positive number of ticks.
*/
#define MSEC_TO_TICKS(x) ((hz == 1000) ? x : ((((x) * hz) + 999) / 1000))
#define TICKS_TO_MSEC(x) ((hz == 1000) ? x : ((((x) * 1000) + (hz - 1)) / hz))
#define SEC_TO_TICKS(x) ((x) * hz)
#define TICKS_TO_SEC(x) (((x) + (hz - 1)) / hz)
/*
* Basically the minimum amount of time before I do a early FR. Making this
* value to low will cause duplicate retransmissions.
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_indata.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_indata.c 35
7705 2020-02-09 22:05:41
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_indata.c 35
9152 2020-03-19 21:01:16
Z tuexen $"
);
#endif
#include <netinet/sctp_os.h>
...
...
@@ -4378,7 +4378,7 @@ again:
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWN
,
stcb
->
sctp_ep
,
stcb
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
netp
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
}
else
if
((
SCTP_GET_STATE
(
stcb
)
==
SCTP_STATE_SHUTDOWN_RECEIVED
)
&&
(
asoc
->
stream_queue_cnt
==
0
))
{
struct
sctp_nets
*
netp
;
...
...
@@ -5094,7 +5094,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWN
,
stcb
->
sctp_ep
,
stcb
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
netp
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
return
;
}
else
if
((
SCTP_GET_STATE
(
stcb
)
==
SCTP_STATE_SHUTDOWN_RECEIVED
)
&&
(
asoc
->
stream_queue_cnt
==
0
))
{
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_input.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_input.c 35
5135 2019-11-27 19:32:29
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_input.c 35
9405 2020-03-28 20:25:45
Z tuexen $"
);
#endif
#include <netinet/sctp_os.h>
...
...
@@ -778,8 +778,7 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp,
sctp_move_chunks_from_net
(
stcb
,
stcb
->
asoc
.
deleted_primary
);
}
sctp_delete_prim_timer
(
stcb
->
sctp_ep
,
stcb
,
stcb
->
asoc
.
deleted_primary
);
sctp_delete_prim_timer
(
stcb
->
sctp_ep
,
stcb
);
}
}
}
...
...
@@ -895,7 +894,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort,
error
=
0
;
}
/* stop any receive timers */
sctp_timer_stop
(
SCTP_TIMER_TYPE_RECV
,
stcb
->
sctp_ep
,
stcb
,
net
,
sctp_timer_stop
(
SCTP_TIMER_TYPE_RECV
,
stcb
->
sctp_ep
,
stcb
,
NULL
,
SCTP_FROM_SCTP_INPUT
+
SCTP_LOC_7
);
/* notify user of the abort and clean up... */
sctp_abort_notification
(
stcb
,
1
,
error
,
abort
,
SCTP_SO_NOT_LOCKED
);
...
...
@@ -1178,13 +1177,12 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp SCTP_UNUSED,
}
static
void
sctp_process_unrecog_chunk
(
struct
sctp_tcb
*
stcb
,
uint8_t
chunk_type
,
struct
sctp_nets
*
net
)
sctp_process_unrecog_chunk
(
struct
sctp_tcb
*
stcb
,
uint8_t
chunk_type
)
{
switch
(
chunk_type
)
{
case
SCTP_ASCONF_ACK
:
case
SCTP_ASCONF
:
sctp_asconf_cleanup
(
stcb
,
net
);
sctp_asconf_cleanup
(
stcb
);
break
;
case
SCTP_IFORWARD_CUM_TSN
:
case
SCTP_FORWARD_CUM_TSN
:
...
...
@@ -1362,7 +1360,7 @@ sctp_handle_error(struct sctp_chunkhdr *ch,
struct
sctp_error_unrecognized_chunk
*
unrec_chunk
;
unrec_chunk
=
(
struct
sctp_error_unrecognized_chunk
*
)
cause
;
sctp_process_unrecog_chunk
(
stcb
,
unrec_chunk
->
ch
.
chunk_type
,
net
);
sctp_process_unrecog_chunk
(
stcb
,
unrec_chunk
->
ch
.
chunk_type
);
}
break
;
case
SCTP_CAUSE_UNRECOG_PARAM
:
...
...
@@ -1731,7 +1729,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_OPEN
);
if
(
asoc
->
state
&
SCTP_STATE_SHUTDOWN_PENDING
)
{
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
}
SCTP_STAT_INCR_GAUGE32
(
sctps_currestab
);
sctp_stop_all_cookie_timers
(
stcb
);
...
...
@@ -1971,7 +1969,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_OPEN
);
if
(
asoc
->
state
&
SCTP_STATE_SHUTDOWN_PENDING
)
{
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
}
sctp_stop_all_cookie_timers
(
stcb
);
sctp_toss_old_cookies
(
stcb
,
asoc
);
...
...
@@ -2042,7 +2040,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
if
(
asoc
->
state
&
SCTP_STATE_SHUTDOWN_PENDING
)
{
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_OPEN
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
}
else
if
(
SCTP_GET_STATE
(
stcb
)
!=
SCTP_STATE_SHUTDOWN_SENT
)
{
/* move to OPEN state, if not in SHUTDOWN_SENT */
...
...
@@ -2471,7 +2469,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_OPEN
);
if
(
asoc
->
state
&
SCTP_STATE_SHUTDOWN_PENDING
)
{
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
}
sctp_stop_all_cookie_timers
(
stcb
);
SCTP_STAT_INCR_COUNTER32
(
sctps_passiveestab
);
...
...
@@ -2726,7 +2724,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
*/
(
void
)
SCTP_GETTIME_TIMEVAL
(
&
now
);
/* Expire time is in Ticks, so we convert to seconds */
time_expires
.
tv_sec
=
cookie
->
time_entered
.
tv_sec
+
TICKS_TO_SEC
(
cookie
->
cookie_life
);
time_expires
.
tv_sec
=
cookie
->
time_entered
.
tv_sec
+
sctp_ticks_to_secs
(
cookie
->
cookie_life
);
time_expires
.
tv_usec
=
cookie
->
time_entered
.
tv_usec
;
#ifndef __FreeBSD__
if
(
timercmp
(
&
now
,
&
time_expires
,
>
))
...
...
@@ -3166,7 +3164,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED,
sctp_start_net_timers
(
stcb
);
if
(
asoc
->
state
&
SCTP_STATE_SHUTDOWN_PENDING
)
{
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
}
/* update RTO */
...
...
@@ -3838,7 +3836,7 @@ sctp_clean_up_stream_reset(struct sctp_tcb *stcb)
}
asoc
->
str_reset
=
NULL
;
sctp_timer_stop
(
SCTP_TIMER_TYPE_STRRESET
,
stcb
->
sctp_ep
,
stcb
,
chk
->
whoTo
,
SCTP_FROM_SCTP_INPUT
+
SCTP_LOC_28
);
NULL
,
SCTP_FROM_SCTP_INPUT
+
SCTP_LOC_28
);
TAILQ_REMOVE
(
&
asoc
->
control_send_queue
,
chk
,
sctp_next
);
asoc
->
ctrl_queue_cnt
--
;
if
(
chk
->
data
)
{
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_lock_userspace.h
浏览文件 @
64eb1e5f
...
...
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
#define SCTP_WQ_ADDR_DESTROY()
#define SCTP_WQ_ADDR_LOCK()
#define SCTP_WQ_ADDR_UNLOCK()
#define SCTP_WQ_ADDR_LOCK_ASSERT()
#define SCTP_IPI_ADDR_INIT()
#define SCTP_IPI_ADDR_DESTROY()
...
...
@@ -82,14 +82,11 @@ __FBSDID("$FreeBSD$");
#define SCTP_IPI_ITERATOR_WQ_LOCK()
#define SCTP_IPI_ITERATOR_WQ_UNLOCK()
#define SCTP_IP_PKTLOG_INIT()
#define SCTP_IP_PKTLOG_LOCK()
#define SCTP_IP_PKTLOG_UNLOCK()
#define SCTP_IP_PKTLOG_DESTROY()
#define SCTP_INP_READ_INIT(_inp)
#define SCTP_INP_READ_DESTROY(_inp)
#define SCTP_INP_READ_LOCK(_inp)
...
...
@@ -100,9 +97,10 @@ __FBSDID("$FreeBSD$");
#define SCTP_INP_LOCK_DESTROY(_inp)
#define SCTP_ASOC_CREATE_LOCK_DESTROY(_inp)
#define SCTP_INP_RLOCK(_inp)
#define SCTP_INP_WLOCK(_inp)
#define SCTP_INP_RLOCK_ASSERT(_inp)
#define SCTP_INP_WLOCK_ASSERT(_inp)
#define SCTP_INP_LOCK_CONTENDED(_inp) (0)
/* Don't know if this is possible */
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_output.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_output.c 35
8083 2020-02-18 21:25:17
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_output.c 35
9156 2020-03-19 23:07:52
Z tuexen $"
);
#endif
#include <netinet/sctp_os.h>
...
...
@@ -7222,7 +7222,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWN
,
stcb
->
sctp_ep
,
stcb
,
net
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
NULL
);
added_control
=
1
;
do_chunk_output
=
0
;
}
...
...
@@ -7262,7 +7262,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,
goto
no_chunk_output
;
}
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
NULL
);
}
}
...
...
@@ -8961,7 +8961,7 @@ again_one_more_time:
/* turn off the timer */
if
(
SCTP_OS_TIMER_PENDING
(
&
stcb
->
asoc
.
dack_timer
.
timer
))
{
sctp_timer_stop
(
SCTP_TIMER_TYPE_RECV
,
inp
,
stcb
,
net
,
inp
,
stcb
,
NULL
,
SCTP_FROM_SCTP_OUTPUT
+
SCTP_LOC_1
);
}
}
...
...
@@ -14128,7 +14128,7 @@ sctp_lower_sosend(struct socket *so,
#endif
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
mm
,
SCTP_SO_LOCKED
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
NET_EPOCH_EXIT
(
et
);
#endif
/* now relock the stcb so everything is sane */
hold_tcblock
=
0
;
...
...
@@ -14717,7 +14717,7 @@ dataless_eof:
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWN
,
stcb
->
sctp_ep
,
stcb
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
NULL
);
}
}
else
{
/*-
...
...
@@ -14757,12 +14757,12 @@ dataless_eof:
op_err
=
sctp_generate_cause
(
SCTP_BASE_SYSCTL
(
sctp_diag_info_code
),
msg
);
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
NET_EPOCH_ENTER
(
et
);
#endif
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
op_err
,
SCTP_SO_LOCKED
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
NET_EPOCH_EXIT
(
et
);
#endif
/* now relock the stcb so everything is sane */
hold_tcblock
=
0
;
...
...
@@ -14770,7 +14770,7 @@ dataless_eof:
goto
out
;
}
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
asoc
->
primary_destination
);
NULL
);
sctp_feature_off
(
inp
,
SCTP_PCB_FLAGS_NODELAY
);
}
}
...
...
@@ -14788,7 +14788,13 @@ skip_out_eof:
/* a collision took us forward? */
queue_only
=
0
;
}
else
{
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_send_initiate
(
inp
,
stcb
,
SCTP_SO_LOCKED
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_COOKIE_WAIT
);
queue_only
=
1
;
}
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_pcb.c 35
7830 2020-02-12 17:05:10
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_pcb.c 35
9405 2020-03-28 20:25:45
Z tuexen $"
);
#endif
#include <netinet/sctp_os.h>
...
...
@@ -3000,13 +3000,13 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
m
=
&
inp
->
sctp_ep
;
/* setup the base timeout information */
m
->
sctp_timeoutticks
[
SCTP_TIMER_SEND
]
=
SEC_TO_TICKS
(
SCTP_SEND_SEC
);
/* needed ? */
m
->
sctp_timeoutticks
[
SCTP_TIMER_INIT
]
=
SEC_TO_TICKS
(
SCTP_INIT_SEC
);
/* needed ? */
m
->
sctp_timeoutticks
[
SCTP_TIMER_RECV
]
=
MSEC_TO_TICKS
(
SCTP_BASE_SYSCTL
(
sctp_delayed_sack_time_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]
=
MSEC_TO_TICKS
(
SCTP_BASE_SYSCTL
(
sctp_heartbeat_interval_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_PMTU
]
=
SEC_TO_TICKS
(
SCTP_BASE_SYSCTL
(
sctp_pmtu_raise_time_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_MAXSHUTDOWN
]
=
SEC_TO_TICKS
(
SCTP_BASE_SYSCTL
(
sctp_shutdown_guard_time_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_SIGNATURE
]
=
SEC_TO_TICKS
(
SCTP_BASE_SYSCTL
(
sctp_secret_lifetime_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_SEND
]
=
sctp_secs_to_ticks
(
SCTP_SEND_SEC
);
/* needed ? */
m
->
sctp_timeoutticks
[
SCTP_TIMER_INIT
]
=
sctp_secs_to_ticks
(
SCTP_INIT_SEC
);
/* needed ? */
m
->
sctp_timeoutticks
[
SCTP_TIMER_RECV
]
=
sctp_msecs_to_ticks
(
SCTP_BASE_SYSCTL
(
sctp_delayed_sack_time_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]
=
sctp_msecs_to_ticks
(
SCTP_BASE_SYSCTL
(
sctp_heartbeat_interval_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_PMTU
]
=
sctp_secs_to_ticks
(
SCTP_BASE_SYSCTL
(
sctp_pmtu_raise_time_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_MAXSHUTDOWN
]
=
sctp_secs_to_ticks
(
SCTP_BASE_SYSCTL
(
sctp_shutdown_guard_time_default
));
m
->
sctp_timeoutticks
[
SCTP_TIMER_SIGNATURE
]
=
sctp_secs_to_ticks
(
SCTP_BASE_SYSCTL
(
sctp_secret_lifetime_default
));
/* all max/min max are in ms */
m
->
sctp_maxrto
=
SCTP_BASE_SYSCTL
(
sctp_rto_max_default
);
m
->
sctp_minrto
=
SCTP_BASE_SYSCTL
(
sctp_rto_min_default
);
...
...
@@ -3054,7 +3054,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
sctp_timer_start
(
SCTP_TIMER_TYPE_NEWCOOKIE
,
inp
,
NULL
,
NULL
);
/* How long is a cookie good for ? */
m
->
def_cookie_life
=
MSEC_TO_TICKS
(
SCTP_BASE_SYSCTL
(
sctp_valid_cookie_life_default
));
m
->
def_cookie_life
=
sctp_msecs_to_ticks
(
SCTP_BASE_SYSCTL
(
sctp_valid_cookie_life_default
));
/*
* Initialize authentication parameters
*/
...
...
@@ -4030,15 +4030,13 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
sctp_send_shutdown
(
asoc
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWN
,
asoc
->
sctp_ep
,
asoc
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
asoc
->
sctp_ep
,
asoc
,
asoc
->
asoc
.
primary_destination
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
asoc
->
sctp_ep
,
asoc
,
NULL
);
sctp_chunk_output
(
inp
,
asoc
,
SCTP_OUTPUT_FROM_SHUT_TMR
,
SCTP_SO_LOCKED
);
}
}
else
{
/* mark into shutdown pending */
SCTP_ADD_SUBSTATE
(
asoc
,
SCTP_STATE_SHUTDOWN_PENDING
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
asoc
->
sctp_ep
,
asoc
,
asoc
->
asoc
.
primary_destination
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
asoc
->
sctp_ep
,
asoc
,
NULL
);
if
((
*
asoc
->
asoc
.
ss_functions
.
sctp_ss_is_user_msgs_incomplete
)(
asoc
,
&
asoc
->
asoc
))
{
SCTP_ADD_SUBSTATE
(
asoc
,
SCTP_STATE_PARTIAL_MSG_LEFT
);
}
...
...
@@ -5511,35 +5509,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
else
so
=
inp
->
sctp_socket
;
if
((
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_TCPTYPE
)
||
(
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_IN_TCPPOOL
))
{
/*
* For TCP type we need special handling when we are
* connected. We also include the peel'ed off ones to.
*/
if
(
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_CONNECTED
)
{
inp
->
sctp_flags
&=
~
SCTP_PCB_FLAGS_CONNECTED
;
inp
->
sctp_flags
|=
SCTP_PCB_FLAGS_WAS_CONNECTED
;
if
(
so
)
{
SOCKBUF_LOCK
(
&
so
->
so_rcv
);
so
->
so_state
&=
~
(
SS_ISCONNECTING
|
SS_ISDISCONNECTING
|
SS_ISCONFIRMING
|
SS_ISCONNECTED
);
so
->
so_state
|=
SS_ISDISCONNECTED
;
#if defined(__APPLE__)
socantrcvmore
(
so
);
#else
socantrcvmore_locked
(
so
);
#endif
socantsendmore
(
so
);
sctp_sowwakeup
(
inp
,
so
);
sctp_sorwakeup
(
inp
,
so
);
SCTP_SOWAKEUP
(
so
);
}
}
}
/*
* We used timer based freeing if a reader or writer is in the way.
* So we first check if we are actually being called from a timer,
...
...
@@ -5665,6 +5634,35 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
/* nothing around */
so
=
NULL
;
if
((
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_TCPTYPE
)
||
(
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_IN_TCPPOOL
))
{
/*
* For TCP type we need special handling when we are
* connected. We also include the peel'ed off ones to.
*/
if
(
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_CONNECTED
)
{
inp
->
sctp_flags
&=
~
SCTP_PCB_FLAGS_CONNECTED
;
inp
->
sctp_flags
|=
SCTP_PCB_FLAGS_WAS_CONNECTED
;
if
(
so
)
{
SOCKBUF_LOCK
(
&
so
->
so_rcv
);
so
->
so_state
&=
~
(
SS_ISCONNECTING
|
SS_ISDISCONNECTING
|
SS_ISCONFIRMING
|
SS_ISCONNECTED
);
so
->
so_state
|=
SS_ISDISCONNECTED
;
#if defined(__APPLE__)
socantrcvmore
(
so
);
#else
socantrcvmore_locked
(
so
);
#endif
socantsendmore
(
so
);
sctp_sowwakeup
(
inp
,
so
);
sctp_sorwakeup
(
inp
,
so
);
SCTP_SOWAKEUP
(
so
);
}
}
}
/* Make it invalid too, that way if its
* about to run it will abort and return.
*/
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.h
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_pcb.h 35
4018 2019-10-24 09:22:23
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_pcb.h 35
9379 2020-03-27 21:48:52
Z tuexen $"
);
#endif
#ifndef _NETINET_SCTP_PCB_H_
...
...
@@ -363,11 +363,11 @@ struct sctp_pcb {
uint32_t
secret_key
[
SCTP_HOW_MANY_SECRETS
][
SCTP_NUMBER_OF_SECRETS
];
unsigned
int
size_of_a_cookie
;
u
nsigned
in
t
sctp_timeoutticks
[
SCTP_NUM_TMRS
];
u
nsigned
in
t
sctp_minrto
;
u
nsigned
in
t
sctp_maxrto
;
u
nsigned
in
t
initial_rto
;
in
t
initial_init_rto_max
;
u
int32_
t
sctp_timeoutticks
[
SCTP_NUM_TMRS
];
u
int32_
t
sctp_minrto
;
u
int32_
t
sctp_maxrto
;
u
int32_
t
initial_rto
;
uint32_
t
initial_init_rto_max
;
unsigned
int
sctp_sack_freq
;
uint32_t
sctp_sws_sender
;
...
...
@@ -410,7 +410,7 @@ struct sctp_pcb {
uint32_t
def_cookie_life
;
/* defaults to 0 */
in
t
auto_close_time
;
uint32_
t
auto_close_time
;
uint32_t
initial_sequence_debug
;
uint32_t
adaptation_layer_indicator
;
uint8_t
adaptation_layer_indicator_provided
;
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_process_lock.h
浏览文件 @
64eb1e5f
...
...
@@ -86,7 +86,9 @@
#define SCTP_INP_RLOCK(_inp)
#define SCTP_INP_RUNLOCK(_inp)
#define SCTP_INP_WLOCK(_inp)
#define SCTP_INP_WUNLOCK(_inep)
#define SCTP_INP_WUNLOCK(_inp)
#define SCTP_INP_RLOCK_ASSERT(_inp)
#define SCTP_INP_WLOCK_ASSERT(_inp)
#define SCTP_INP_INCR_REF(_inp)
#define SCTP_INP_DECR_REF(_inp)
...
...
@@ -124,7 +126,7 @@
EnterCriticalSection(&SCTP_BASE_INFO(wq_addr_mtx))
#define SCTP_WQ_ADDR_UNLOCK() \
LeaveCriticalSection(&SCTP_BASE_INFO(wq_addr_mtx))
#define SCTP_WQ_ADDR_LOCK_ASSERT()
#define SCTP_INP_INFO_LOCK_INIT() \
InitializeCriticalSection(&SCTP_BASE_INFO(ipi_ep_mtx))
...
...
@@ -185,6 +187,8 @@
#define SCTP_INP_WLOCK(_inp) \
EnterCriticalSection(&(_inp)->inp_mtx)
#endif
#define SCTP_INP_RLOCK_ASSERT(_tcb)
#define SCTP_INP_WLOCK_ASSERT(_tcb)
#define SCTP_TCB_SEND_LOCK_INIT(_tcb) \
InitializeCriticalSection(&(_tcb)->tcb_send_mtx)
...
...
@@ -263,6 +267,8 @@
#define SCTP_WQ_ADDR_UNLOCK() \
(void)pthread_mutex_unlock(&SCTP_BASE_INFO(wq_addr_mtx))
#endif
#define SCTP_WQ_ADDR_LOCK_ASSERT() \
KASSERT(pthread_mutex_trylock(&SCTP_BASE_INFO(wq_addr_mtx)) == EBUSY, ("%s: wq_addr_mtx not locked", __func__))
#define SCTP_INP_INFO_LOCK_INIT() \
(void)pthread_mutex_init(&SCTP_BASE_INFO(ipi_ep_mtx), &SCTP_BASE_VAR(mtx_attr))
...
...
@@ -377,6 +383,10 @@
#define SCTP_INP_WUNLOCK(_inp) \
(void)pthread_mutex_unlock(&(_inp)->inp_mtx)
#endif
#define SCTP_INP_RLOCK_ASSERT(_inp) \
KASSERT(pthread_mutex_trylock(&(_inp)->inp_mtx) == EBUSY, ("%s: inp_mtx not locked", __func__))
#define SCTP_INP_WLOCK_ASSERT(_inp) \
KASSERT(pthread_mutex_trylock(&(_inp)->inp_mtx) == EBUSY, ("%s: inp_mtx not locked", __func__))
#define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1)
#define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1)
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_structs.h
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_structs.h 35
7501 2020-02-04 14:01:07
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_structs.h 35
9379 2020-03-27 21:48:52
Z tuexen $"
);
#endif
#ifndef _NETINET_SCTP_STRUCTS_H_
...
...
@@ -334,7 +334,7 @@ struct sctp_nets {
int
lastsa
;
int
lastsv
;
uint64_t
rtt
;
/* last measured rtt value in us */
u
nsigned
in
t
RTO
;
u
int32_
t
RTO
;
/* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */
struct
sctp_timer
rxt_timer
;
...
...
@@ -1121,7 +1121,7 @@ struct sctp_association {
uint32_t
heart_beat_delay
;
/* autoclose */
u
nsigned
in
t
sctp_autoclose_ticks
;
u
int32_
t
sctp_autoclose_ticks
;
/* how many preopen streams we have */
unsigned
int
pre_open_streams
;
...
...
@@ -1130,7 +1130,7 @@ struct sctp_association {
unsigned
int
max_inbound_streams
;
/* the cookie life I award for any cookie, in seconds */
u
nsigned
in
t
cookie_life
;
u
int32_
t
cookie_life
;
/* time to delay acks for */
unsigned
int
delayed_ack
;
unsigned
int
old_delayed_ack
;
...
...
@@ -1139,10 +1139,10 @@ struct sctp_association {
unsigned
int
numduptsns
;
int
dup_tsns
[
SCTP_MAX_DUP_TSNS
];
u
nsigned
in
t
initial_init_rto_max
;
/* initial RTO for INIT's */
u
nsigned
in
t
initial_rto
;
/* initial send RTO */
u
nsigned
in
t
minrto
;
/* per assoc RTO-MIN */
u
nsigned
in
t
maxrto
;
/* per assoc RTO-MAX */
u
int32_
t
initial_init_rto_max
;
/* initial RTO for INIT's */
u
int32_
t
initial_rto
;
/* initial send RTO */
u
int32_
t
minrto
;
/* per assoc RTO-MIN */
u
int32_
t
maxrto
;
/* per assoc RTO-MAX */
/* authentication fields */
sctp_auth_chklist_t
*
local_auth_chunks
;
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_timer.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_timer.c 3
38134 2018-08-21 13:25:32
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_timer.c 3
59405 2020-03-28 20:25:45
Z tuexen $"
);
#endif
#define _IP_VHL
...
...
@@ -1108,10 +1108,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
)
{
...
...
@@ -1122,9 +1121,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
);
}
...
...
@@ -1132,9 +1131,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
);
...
...
@@ -1159,6 +1157,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
);
...
...
@@ -1166,7 +1166,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
);
}
...
...
@@ -1191,8 +1191,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
);
...
...
@@ -1205,17 +1206,16 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
* Mark this peer as ASCONF incapable and cleanup.
*/
SCTPDBG
(
SCTP_DEBUG_TIMER1
,
"asconf_timer: Peer has not responded to our repeated ASCONFs
\n
"
);
sctp_asconf_cleanup
(
stcb
,
net
);
sctp_asconf_cleanup
(
stcb
);
return
(
0
);
}
/*
* 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
);
}
...
...
@@ -1252,6 +1252,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
);
...
...
@@ -1266,8 +1268,7 @@ sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
/* Mobility adaptation */
void
sctp_delete_prim_timer
(
struct
sctp_inpcb
*
inp
,
struct
sctp_tcb
*
stcb
,
struct
sctp_nets
*
net
SCTP_UNUSED
)
sctp_delete_prim_timer
(
struct
sctp_inpcb
*
inp
,
struct
sctp_tcb
*
stcb
)
{
if
(
stcb
->
asoc
.
deleted_primary
==
NULL
)
{
SCTPDBG
(
SCTP_DEBUG_ASCONF1
,
"delete_prim_timer: deleted_primary is not stored...
\n
"
);
...
...
@@ -1538,16 +1539,14 @@ sctp_pathmtu_timer(struct sctp_inpcb *inp,
}
void
sctp_autoclose_timer
(
struct
sctp_inpcb
*
inp
,
struct
sctp_tcb
*
stcb
,
struct
sctp_nets
*
net
)
sctp_autoclose_timer
(
struct
sctp_inpcb
*
inp
,
struct
sctp_tcb
*
stcb
)
{
struct
timeval
tn
,
*
tim_touse
;
struct
sctp_association
*
asoc
;
in
t
ticks_gone_by
;
uint32_
t
ticks_gone_by
;
(
void
)
SCTP_GETTIME_TIMEVAL
(
&
tn
);
if
(
stcb
->
asoc
.
sctp_autoclose_ticks
&&
if
(
stcb
->
asoc
.
sctp_autoclose_ticks
>
0
&&
sctp_is_feature_on
(
inp
,
SCTP_PCB_FLAGS_AUTOCLOSE
))
{
/* Auto close is on */
asoc
=
&
stcb
->
asoc
;
...
...
@@ -1559,9 +1558,8 @@ sctp_autoclose_timer(struct sctp_inpcb *inp,
tim_touse
=
&
asoc
->
time_last_sent
;
}
/* Now has long enough transpired to autoclose? */
ticks_gone_by
=
SEC_TO_TICKS
(
tn
.
tv_sec
-
tim_touse
->
tv_sec
);
if
((
ticks_gone_by
>
0
)
&&
(
ticks_gone_by
>=
(
int
)
asoc
->
sctp_autoclose_ticks
))
{
ticks_gone_by
=
sctp_secs_to_ticks
((
uint32_t
)(
tn
.
tv_sec
-
tim_touse
->
tv_sec
));
if
(
ticks_gone_by
>=
asoc
->
sctp_autoclose_ticks
)
{
/*
* autoclose time has hit, call the output routine,
* which should do nothing just to be SURE we don't
...
...
@@ -1579,7 +1577,7 @@ sctp_autoclose_timer(struct sctp_inpcb *inp,
*/
if
(
SCTP_GET_STATE
(
stcb
)
!=
SCTP_STATE_SHUTDOWN_SENT
)
{
/* only send SHUTDOWN 1st time thru */
struct
sctp_nets
*
net
p
;
struct
sctp_nets
*
net
;
if
((
SCTP_GET_STATE
(
stcb
)
==
SCTP_STATE_OPEN
)
||
(
SCTP_GET_STATE
(
stcb
)
==
SCTP_STATE_SHUTDOWN_RECEIVED
))
{
...
...
@@ -1588,17 +1586,15 @@ sctp_autoclose_timer(struct sctp_inpcb *inp,
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_SHUTDOWN_SENT
);
sctp_stop_timers_for_shutdown
(
stcb
);
if
(
stcb
->
asoc
.
alternate
)
{
net
p
=
stcb
->
asoc
.
alternate
;
net
=
stcb
->
asoc
.
alternate
;
}
else
{
net
p
=
stcb
->
asoc
.
primary_destination
;
net
=
stcb
->
asoc
.
primary_destination
;
}
sctp_send_shutdown
(
stcb
,
net
p
);
sctp_send_shutdown
(
stcb
,
net
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWN
,
stcb
->
sctp_ep
,
stcb
,
netp
);
stcb
->
sctp_ep
,
stcb
,
net
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
netp
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
}
}
}
else
{
...
...
@@ -1606,13 +1602,12 @@ sctp_autoclose_timer(struct sctp_inpcb *inp,
* No auto close at this time, reset t-o to check
* later
*/
in
t
tmp
;
uint32_
t
tmp
;
/* fool the timer startup to use the time left */
tmp
=
asoc
->
sctp_autoclose_ticks
;
asoc
->
sctp_autoclose_ticks
-=
ticks_gone_by
;
sctp_timer_start
(
SCTP_TIMER_TYPE_AUTOCLOSE
,
inp
,
stcb
,
net
);
sctp_timer_start
(
SCTP_TIMER_TYPE_AUTOCLOSE
,
inp
,
stcb
,
NULL
);
/* restore the real tick value */
asoc
->
sctp_autoclose_ticks
=
tmp
;
}
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_timer.h
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_timer.h
295709 2016-02-17 18:04:22
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_timer.h
359195 2020-03-21 16:12:19
Z tuexen $"
);
#endif
#ifndef _NETINET_SCTP_TIMER_H_
...
...
@@ -46,18 +46,20 @@ __FBSDID("$FreeBSD: head/sys/netinet/sctp_timer.h 295709 2016-02-17 18:04:22Z tu
#define SCTP_RTT_VAR_SHIFT 2
struct
sctp_nets
*
sctp_find_alternate_net
(
struct
sctp_tcb
*
,
struct
sctp_nets
*
,
int
mode
);
sctp_find_alternate_net
(
struct
sctp_tcb
*
,
struct
sctp_nets
*
,
int
);
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
*
);
...
...
@@ -74,20 +76,17 @@ 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
*
,
struct
sctp_nets
*
);
void
sctp_delete_prim_timer
(
struct
sctp_inpcb
*
,
struct
sctp_tcb
*
,
struct
sctp_nets
*
);
sctp_delete_prim_timer
(
struct
sctp_inpcb
*
,
struct
sctp_tcb
*
);
void
sctp_autoclose_timer
(
struct
sctp_inpcb
*
,
struct
sctp_tcb
*
,
struct
sctp_nets
*
net
);
sctp_autoclose_timer
(
struct
sctp_inpcb
*
,
struct
sctp_tcb
*
);
void
sctp_audit_retranmission_queue
(
struct
sctp_association
*
);
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_usrreq.c
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_usrreq.c 35
8083 2020-02-18 21:25:17
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_usrreq.c 35
9410 2020-03-28 22:35:04
Z tuexen $"
);
#endif
#include <netinet/sctp_os.h>
...
...
@@ -675,8 +675,10 @@ out:
return
(
error
);
}
SYSCTL_PROC
(
_net_inet_sctp
,
OID_AUTO
,
getcred
,
CTLTYPE_OPAQUE
|
CTLFLAG_RW
,
0
,
0
,
sctp_getcred
,
"S,ucred"
,
"Get the ucred of a SCTP connection"
);
SYSCTL_PROC
(
_net_inet_sctp
,
OID_AUTO
,
getcred
,
CTLTYPE_OPAQUE
|
CTLFLAG_RW
|
CTLFLAG_NEEDGIANT
,
0
,
0
,
sctp_getcred
,
"S,ucred"
,
"Get the ucred of a SCTP connection"
);
#endif
/* #if defined(__FreeBSD__) */
...
...
@@ -1258,9 +1260,9 @@ sctp_disconnect(struct socket *so)
}
sctp_send_shutdown
(
stcb
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWN
,
stcb
->
sctp_ep
,
stcb
,
netp
);
stcb
->
sctp_ep
,
stcb
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
netp
);
stcb
->
sctp_ep
,
stcb
,
NULL
);
sctp_chunk_output
(
stcb
->
sctp_ep
,
stcb
,
SCTP_OUTPUT_FROM_T3
,
SCTP_SO_LOCKED
);
}
}
else
{
...
...
@@ -1274,16 +1276,8 @@ sctp_disconnect(struct socket *so)
* we will allow user data to be sent first
* and move to SHUTDOWN-PENDING
*/
struct
sctp_nets
*
netp
;
if
(
stcb
->
asoc
.
alternate
)
{
netp
=
stcb
->
asoc
.
alternate
;
}
else
{
netp
=
stcb
->
asoc
.
primary_destination
;
}
SCTP_ADD_SUBSTATE
(
stcb
,
SCTP_STATE_SHUTDOWN_PENDING
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
NULL
);
if
((
*
asoc
->
ss_functions
.
sctp_ss_is_user_msgs_incomplete
)(
stcb
,
asoc
))
{
SCTP_ADD_SUBSTATE
(
stcb
,
SCTP_STATE_PARTIAL_MSG_LEFT
);
}
...
...
@@ -1501,7 +1495,7 @@ sctp_shutdown(struct socket *so)
return
(
0
);
}
}
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
netp
);
sctp_timer_start
(
SCTP_TIMER_TYPE_SHUTDOWNGUARD
,
stcb
->
sctp_ep
,
stcb
,
NULL
);
/* XXX: Why do this in the case where we have still data queued? */
sctp_chunk_output
(
inp
,
stcb
,
SCTP_OUTPUT_FROM_CLOSING
,
SCTP_SO_LOCKED
);
SCTP_TCB_UNLOCK
(
stcb
);
...
...
@@ -2270,7 +2264,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
break
;
case
SCTP_AUTOCLOSE
:
if
(
sctp_is_feature_on
(
inp
,
SCTP_PCB_FLAGS_AUTOCLOSE
))
val
=
TICKS_TO_SEC
(
inp
->
sctp_ep
.
auto_close_time
);
val
=
sctp_ticks_to_secs
(
inp
->
sctp_ep
.
auto_close_time
);
else
val
=
0
;
break
;
...
...
@@ -2700,7 +2694,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
((
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_UDPTYPE
)
&&
(
sack
->
sack_assoc_id
==
SCTP_FUTURE_ASSOC
)))
{
SCTP_INP_RLOCK
(
inp
);
sack
->
sack_delay
=
TICKS_TO_MSEC
(
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_RECV
]);
sack
->
sack_delay
=
sctp_ticks_to_msecs
(
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_RECV
]);
sack
->
sack_freq
=
inp
->
sctp_ep
.
sctp_sack_freq
;
SCTP_INP_RUNLOCK
(
inp
);
}
else
{
...
...
@@ -3221,7 +3215,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
/* Use endpoint defaults */
SCTP_INP_RLOCK
(
inp
);
paddrp
->
spp_pathmaxrxt
=
inp
->
sctp_ep
.
def_net_failure
;
paddrp
->
spp_hbinterval
=
TICKS_TO_MSEC
(
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]);
paddrp
->
spp_hbinterval
=
sctp_ticks_to_msecs
(
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]);
paddrp
->
spp_assoc_id
=
SCTP_FUTURE_ASSOC
;
/* get inp's default */
if
(
inp
->
sctp_ep
.
default_dscp
&
0x01
)
{
...
...
@@ -3389,17 +3383,33 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
if
(
net
!=
NULL
)
{
#ifdef HAVE_SA_LEN
memcpy
(
&
sstat
->
sstat_primary
.
spinfo_address
,
&
stcb
->
asoc
.
primary_destination
->
ro
.
_l_addr
,
((
struct
sockaddr
*
)(
&
stcb
->
asoc
.
primary_destination
->
ro
.
_l_addr
))
->
sa_len
);
&
net
->
ro
.
_l_addr
,
((
struct
sockaddr
*
)(
&
net
->
ro
.
_l_addr
))
->
sa_len
);
#else
if
(
stcb
->
asoc
.
primary_destination
->
ro
.
_l_addr
.
sa
.
sa_family
==
AF_INET
)
{
switch
(
stcb
->
asoc
.
primary_destination
->
ro
.
_l_addr
.
sa
.
sa_family
)
{
#if defined(INET)
case
AF_INET
:
memcpy
(
&
sstat
->
sstat_primary
.
spinfo_address
,
&
stcb
->
asoc
.
primary_destination
->
ro
.
_l_addr
,
&
net
->
ro
.
_l_addr
,
sizeof
(
struct
sockaddr_in
));
}
else
{
break
;
#endif
#if defined(INET6)
case
AF_INET6
:
memcpy
(
&
sstat
->
sstat_primary
.
spinfo_address
,
&
stcb
->
asoc
.
primary_destination
->
ro
.
_l_addr
,
&
net
->
ro
.
_l_addr
,
sizeof
(
struct
sockaddr_in6
));
break
;
#endif
#if defined(__Userspace__)
case
AF_CONN
:
memcpy
(
&
sstat
->
sstat_primary
.
spinfo_address
,
&
net
->
ro
.
_l_addr
,
sizeof
(
struct
sockaddr_conn
));
break
;
#endif
default:
break
;
}
#endif
((
struct
sockaddr_in
*
)
&
sstat
->
sstat_primary
.
spinfo_address
)
->
sin_port
=
stcb
->
rport
;
...
...
@@ -3511,7 +3521,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
SCTP_FIND_STCB
(
inp
,
stcb
,
sasoc
->
sasoc_assoc_id
);
if
(
stcb
)
{
sasoc
->
sasoc_cookie_life
=
TICKS_TO_MSEC
(
stcb
->
asoc
.
cookie_life
);
sasoc
->
sasoc_cookie_life
=
sctp_ticks_to_msecs
(
stcb
->
asoc
.
cookie_life
);
sasoc
->
sasoc_asocmaxrxt
=
stcb
->
asoc
.
max_send_times
;
sasoc
->
sasoc_number_peer_destinations
=
stcb
->
asoc
.
numnets
;
sasoc
->
sasoc_peer_rwnd
=
stcb
->
asoc
.
peers_rwnd
;
...
...
@@ -3523,7 +3533,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
((
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_UDPTYPE
)
&&
(
sasoc
->
sasoc_assoc_id
==
SCTP_FUTURE_ASSOC
)))
{
SCTP_INP_RLOCK
(
inp
);
sasoc
->
sasoc_cookie_life
=
TICKS_TO_MSEC
(
inp
->
sctp_ep
.
def_cookie_life
);
sasoc
->
sasoc_cookie_life
=
sctp_ticks_to_msecs
(
inp
->
sctp_ep
.
def_cookie_life
);
sasoc
->
sasoc_asocmaxrxt
=
inp
->
sctp_ep
.
max_send_times
;
sasoc
->
sasoc_number_peer_destinations
=
0
;
sasoc
->
sasoc_peer_rwnd
=
0
;
...
...
@@ -4644,7 +4654,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
* The value is in ticks. Note this does not effect
* old associations, only new ones.
*/
inp
->
sctp_ep
.
auto_close_time
=
SEC_TO_TICKS
(
*
mopt
);
inp
->
sctp_ep
.
auto_close_time
=
sctp_secs_to_ticks
(
*
mopt
);
break
;
}
SCTP_INP_WLOCK
(
inp
);
...
...
@@ -5146,10 +5156,12 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
SCTP_CHECK_AND_CAST
(
sack
,
optval
,
struct
sctp_sack_info
,
optsize
);
SCTP_FIND_STCB
(
inp
,
stcb
,
sack
->
sack_assoc_id
);
if
(
sack
->
sack_delay
)
{
if
(
sack
->
sack_delay
>
SCTP_MAX_SACK_DELAY
)
sack
->
sack_delay
=
SCTP_MAX_SACK_DELAY
;
if
(
MSEC_TO_TICKS
(
sack
->
sack_delay
)
<
1
)
{
sack
->
sack_delay
=
TICKS_TO_MSEC
(
1
);
if
(
sack
->
sack_delay
>
SCTP_MAX_SACK_DELAY
)
{
error
=
EINVAL
;
if
(
stcb
!=
NULL
)
{
SCTP_TCB_UNLOCK
(
stcb
);
}
break
;
}
}
if
(
stcb
)
{
...
...
@@ -5168,7 +5180,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
(
sack
->
sack_assoc_id
==
SCTP_ALL_ASSOC
))))
{
SCTP_INP_WLOCK
(
inp
);
if
(
sack
->
sack_delay
)
{
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_RECV
]
=
MSEC_TO_TICKS
(
sack
->
sack_delay
);
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_RECV
]
=
sctp_msecs_to_ticks
(
sack
->
sack_delay
);
}
if
(
sack
->
sack_freq
)
{
inp
->
sctp_ep
.
sctp_sack_freq
=
sack
->
sack_freq
;
...
...
@@ -5222,7 +5234,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
if
(
sca
->
sca_keylength
==
0
)
{
size
=
optsize
-
sizeof
(
struct
sctp_authkey
);
}
else
{
if
(
sca
->
sca_keylength
+
sizeof
(
struct
sctp_authkey
)
<=
optsize
)
{
if
(
sca
->
sca_keylength
+
sizeof
(
struct
sctp_authkey
)
<=
optsize
)
{
size
=
sca
->
sca_keylength
;
}
else
{
SCTP_LTRACE_ERR_RET
(
inp
,
NULL
,
NULL
,
SCTP_FROM_SCTP_USRREQ
,
EINVAL
);
...
...
@@ -6539,14 +6551,14 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
else
if
(
paddrp
->
spp_hbinterval
!=
0
)
{
if
(
paddrp
->
spp_hbinterval
>
SCTP_MAX_HB_INTERVAL
)
paddrp
->
spp_hbinterval
=
SCTP_MAX_HB_INTERVAL
;
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]
=
MSEC_TO_TICKS
(
paddrp
->
spp_hbinterval
);
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]
=
sctp_msecs_to_ticks
(
paddrp
->
spp_hbinterval
);
}
if
(
paddrp
->
spp_flags
&
SPP_HB_ENABLE
)
{
if
(
paddrp
->
spp_flags
&
SPP_HB_TIME_IS_ZERO
)
{
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]
=
0
;
}
else
if
(
paddrp
->
spp_hbinterval
)
{
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]
=
MSEC_TO_TICKS
(
paddrp
->
spp_hbinterval
);
inp
->
sctp_ep
.
sctp_timeoutticks
[
SCTP_TIMER_HEARTBEAT
]
=
sctp_msecs_to_ticks
(
paddrp
->
spp_hbinterval
);
}
sctp_feature_off
(
inp
,
SCTP_PCB_FLAGS_DONOT_HEARTBEAT
);
}
else
if
(
paddrp
->
spp_flags
&
SPP_HB_DISABLE
)
{
...
...
@@ -6661,7 +6673,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
if
(
sasoc
->
sasoc_asocmaxrxt
)
stcb
->
asoc
.
max_send_times
=
sasoc
->
sasoc_asocmaxrxt
;
if
(
sasoc
->
sasoc_cookie_life
)
{
stcb
->
asoc
.
cookie_life
=
MSEC_TO_TICKS
(
sasoc
->
sasoc_cookie_life
);
stcb
->
asoc
.
cookie_life
=
sctp_msecs_to_ticks
(
sasoc
->
sasoc_cookie_life
);
}
SCTP_TCB_UNLOCK
(
stcb
);
}
else
{
...
...
@@ -6673,7 +6685,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
if
(
sasoc
->
sasoc_asocmaxrxt
)
inp
->
sctp_ep
.
max_send_times
=
sasoc
->
sasoc_asocmaxrxt
;
if
(
sasoc
->
sasoc_cookie_life
)
{
inp
->
sctp_ep
.
def_cookie_life
=
MSEC_TO_TICKS
(
sasoc
->
sasoc_cookie_life
);
inp
->
sctp_ep
.
def_cookie_life
=
sctp_msecs_to_ticks
(
sasoc
->
sasoc_cookie_life
);
}
SCTP_INP_WUNLOCK
(
inp
);
}
else
{
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctputil.c
浏览文件 @
64eb1e5f
差异被折叠。
点击展开。
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctputil.h
浏览文件 @
64eb1e5f
...
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctputil.h 35
7775 2020-02-11 20:02:20
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctputil.h 35
9405 2020-03-28 20:25:45
Z tuexen $"
);
#endif
#ifndef _NETINET_SCTP_UTIL_H_
...
...
@@ -430,5 +430,10 @@ uint32_t sctp_hc_get_mtu(union sctp_sockstore *, uint16_t);
#endif
void
sctp_set_state
(
struct
sctp_tcb
*
,
int
);
void
sctp_add_substate
(
struct
sctp_tcb
*
,
int
);
uint32_t
sctp_ticks_to_msecs
(
uint32_t
);
uint32_t
sctp_msecs_to_ticks
(
uint32_t
);
uint32_t
sctp_ticks_to_secs
(
uint32_t
);
uint32_t
sctp_secs_to_ticks
(
uint32_t
);
#endif
/* _KERNEL */
#endif
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论