Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
08f3e1d9
提交
08f3e1d9
authored
2月 20, 2020
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update usrsctp
上级
f0cc9662
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
202 行增加
和
52 行删除
+202
-52
sctp_bsd_addr.c
...r/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_bsd_addr.c
+3
-19
sctp_callout.c
...er/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_callout.c
+2
-0
sctp_constants.h
.../deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_constants.h
+7
-8
sctp_output.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_output.c
+34
-1
sctp_pcb.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.c
+1
-1
sctp_pcb.h
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.h
+2
-0
sctp_ss_functions.c
...ps/usrsctp/usrsctp/usrsctplib/netinet/sctp_ss_functions.c
+10
-1
sctp_usrreq.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_usrreq.c
+86
-15
sctputil.c
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctputil.c
+31
-6
sctp6_usrreq.c
...r/deps/usrsctp/usrsctp/usrsctplib/netinet6/sctp6_usrreq.c
+26
-1
没有找到文件。
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_bsd_addr.c
浏览文件 @
08f3e1d9
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 35
3480 2019-10-13 18:17:08
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 35
8080 2020-02-18 19:41:55
Z tuexen $"
);
#endif
#endif
#include <netinet/sctp_os.h>
#include <netinet/sctp_os.h>
...
@@ -203,6 +203,8 @@ sctp_startup_iterator(void)
...
@@ -203,6 +203,8 @@ sctp_startup_iterator(void)
#elif defined(__Userspace__)
#elif defined(__Userspace__)
if
(
sctp_userspace_thread_create
(
&
sctp_it_ctl
.
thread_proc
,
&
sctp_iterator_thread
))
{
if
(
sctp_userspace_thread_create
(
&
sctp_it_ctl
.
thread_proc
,
&
sctp_iterator_thread
))
{
SCTP_PRINTF
(
"ERROR: Creating sctp_iterator_thread failed.
\n
"
);
SCTP_PRINTF
(
"ERROR: Creating sctp_iterator_thread failed.
\n
"
);
}
else
{
SCTP_BASE_VAR
(
iterator_thread_started
)
=
1
;
}
}
#endif
#endif
}
}
...
@@ -745,24 +747,6 @@ void
...
@@ -745,24 +747,6 @@ void
sctp_addr_change_event_handler
(
void
*
arg
__unused
,
struct
ifaddr
*
ifa
,
int
cmd
)
{
sctp_addr_change_event_handler
(
void
*
arg
__unused
,
struct
ifaddr
*
ifa
,
int
cmd
)
{
sctp_addr_change
(
ifa
,
cmd
);
sctp_addr_change
(
ifa
,
cmd
);
}
}
void
sctp_add_or_del_interfaces
(
int
(
*
pred
)(
struct
ifnet
*
),
int
add
)
{
struct
ifnet
*
ifn
;
struct
ifaddr
*
ifa
;
IFNET_RLOCK
();
CK_STAILQ_FOREACH
(
ifn
,
&
MODULE_GLOBAL
(
ifnet
),
if_link
)
{
if
(
!
(
*
pred
)(
ifn
))
{
continue
;
}
CK_STAILQ_FOREACH
(
ifa
,
&
ifn
->
if_addrhead
,
ifa_link
)
{
sctp_addr_change
(
ifa
,
add
?
RTM_ADD
:
RTM_DELETE
);
}
}
IFNET_RUNLOCK
();
}
#endif
#endif
#if defined(__APPLE__)
#if defined(__APPLE__)
void
void
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_callout.c
浏览文件 @
08f3e1d9
...
@@ -227,6 +227,8 @@ sctp_start_timer(void)
...
@@ -227,6 +227,8 @@ sctp_start_timer(void)
rc
=
sctp_userspace_thread_create
(
&
SCTP_BASE_VAR
(
timer_thread
),
user_sctp_timer_iterate
);
rc
=
sctp_userspace_thread_create
(
&
SCTP_BASE_VAR
(
timer_thread
),
user_sctp_timer_iterate
);
if
(
rc
)
{
if
(
rc
)
{
SCTP_PRINTF
(
"ERROR; return code from sctp_thread_create() is %d
\n
"
,
rc
);
SCTP_PRINTF
(
"ERROR; return code from sctp_thread_create() is %d
\n
"
,
rc
);
}
else
{
SCTP_BASE_VAR
(
timer_thread_started
)
=
1
;
}
}
}
}
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_constants.h
浏览文件 @
08f3e1d9
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_constants.h 35
7500 2020-02-04 12:34:16
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_constants.h 35
8169 2020-02-20 15:37:44
Z tuexen $"
);
#endif
#endif
#ifndef _NETINET_SCTP_CONSTANTS_H_
#ifndef _NETINET_SCTP_CONSTANTS_H_
...
@@ -551,14 +551,13 @@ extern void getwintimeofday(struct timeval *tv);
...
@@ -551,14 +551,13 @@ extern void getwintimeofday(struct timeval *tv);
#define SCTP_TIMER_TYPE_ASCONF 10
#define SCTP_TIMER_TYPE_ASCONF 10
#define SCTP_TIMER_TYPE_SHUTDOWNGUARD 11
#define SCTP_TIMER_TYPE_SHUTDOWNGUARD 11
#define SCTP_TIMER_TYPE_AUTOCLOSE 12
#define SCTP_TIMER_TYPE_AUTOCLOSE 12
#define SCTP_TIMER_TYPE_EVENTWAKE 13
#define SCTP_TIMER_TYPE_STRRESET 13
#define SCTP_TIMER_TYPE_STRRESET 14
#define SCTP_TIMER_TYPE_INPKILL 14
#define SCTP_TIMER_TYPE_INPKILL 15
#define SCTP_TIMER_TYPE_ASOCKILL 15
#define SCTP_TIMER_TYPE_ASOCKILL 16
#define SCTP_TIMER_TYPE_ADDR_WQ 16
#define SCTP_TIMER_TYPE_ADDR_WQ 17
#define SCTP_TIMER_TYPE_PRIM_DELETED 17
#define SCTP_TIMER_TYPE_PRIM_DELETED 18
/* add new timers here - and increment LAST */
/* add new timers here - and increment LAST */
#define SCTP_TIMER_TYPE_LAST
19
#define SCTP_TIMER_TYPE_LAST
18
#define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \
#define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \
((t) < SCTP_TIMER_TYPE_LAST))
((t) < SCTP_TIMER_TYPE_LAST))
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_output.c
浏览文件 @
08f3e1d9
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_output.c 35
7705 2020-02-09 22:05:41
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_output.c 35
8083 2020-02-18 21:25:17
Z tuexen $"
);
#endif
#endif
#include <netinet/sctp_os.h>
#include <netinet/sctp_os.h>
...
@@ -13531,6 +13531,9 @@ sctp_lower_sosend(struct socket *so,
...
@@ -13531,6 +13531,9 @@ sctp_lower_sosend(struct socket *so,
#endif
#endif
)
)
{
{
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
ssize_t
sndlen
=
0
,
max_len
,
local_add_more
;
ssize_t
sndlen
=
0
,
max_len
,
local_add_more
;
int
error
,
len
;
int
error
,
len
;
struct
mbuf
*
top
=
NULL
;
struct
mbuf
*
top
=
NULL
;
...
@@ -14120,7 +14123,13 @@ sctp_lower_sosend(struct socket *so,
...
@@ -14120,7 +14123,13 @@ sctp_lower_sosend(struct socket *so,
atomic_add_int
(
&
stcb
->
asoc
.
refcnt
,
-
1
);
atomic_add_int
(
&
stcb
->
asoc
.
refcnt
,
-
1
);
free_cnt_applied
=
0
;
free_cnt_applied
=
0
;
/* release this lock, otherwise we hang on ourselves */
/* release this lock, otherwise we hang on ourselves */
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
mm
,
SCTP_SO_LOCKED
);
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
mm
,
SCTP_SO_LOCKED
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
/* now relock the stcb so everything is sane */
/* now relock the stcb so everything is sane */
hold_tcblock
=
0
;
hold_tcblock
=
0
;
stcb
=
NULL
;
stcb
=
NULL
;
...
@@ -14466,7 +14475,13 @@ skip_preblock:
...
@@ -14466,7 +14475,13 @@ skip_preblock:
/* a collision took us forward? */
/* a collision took us forward? */
queue_only
=
0
;
queue_only
=
0
;
}
else
{
}
else
{
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_send_initiate
(
inp
,
stcb
,
SCTP_SO_LOCKED
);
sctp_send_initiate
(
inp
,
stcb
,
SCTP_SO_LOCKED
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_COOKIE_WAIT
);
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_COOKIE_WAIT
);
queue_only
=
1
;
queue_only
=
1
;
}
}
...
@@ -14524,6 +14539,9 @@ skip_preblock:
...
@@ -14524,6 +14539,9 @@ skip_preblock:
* the input via the net is happening
* the input via the net is happening
* and I don't need to start output :-D
* and I don't need to start output :-D
*/
*/
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
if
(
hold_tcblock
==
0
)
{
if
(
hold_tcblock
==
0
)
{
if
(
SCTP_TCB_TRYLOCK
(
stcb
))
{
if
(
SCTP_TCB_TRYLOCK
(
stcb
))
{
hold_tcblock
=
1
;
hold_tcblock
=
1
;
...
@@ -14536,6 +14554,9 @@ skip_preblock:
...
@@ -14536,6 +14554,9 @@ skip_preblock:
stcb
,
stcb
,
SCTP_OUTPUT_FROM_USR_SEND
,
SCTP_SO_LOCKED
);
SCTP_OUTPUT_FROM_USR_SEND
,
SCTP_SO_LOCKED
);
}
}
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
}
}
if
(
hold_tcblock
==
1
)
{
if
(
hold_tcblock
==
1
)
{
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_TCB_UNLOCK
(
stcb
);
...
@@ -14735,8 +14756,14 @@ dataless_eof:
...
@@ -14735,8 +14756,14 @@ dataless_eof:
"%s:%d at %s"
,
__FILE__
,
__LINE__
,
__func__
);
"%s:%d at %s"
,
__FILE__
,
__LINE__
,
__func__
);
op_err
=
sctp_generate_cause
(
SCTP_BASE_SYSCTL
(
sctp_diag_info_code
),
op_err
=
sctp_generate_cause
(
SCTP_BASE_SYSCTL
(
sctp_diag_info_code
),
msg
);
msg
);
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
op_err
,
SCTP_SO_LOCKED
);
op_err
,
SCTP_SO_LOCKED
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
/* now relock the stcb so everything is sane */
/* now relock the stcb so everything is sane */
hold_tcblock
=
0
;
hold_tcblock
=
0
;
stcb
=
NULL
;
stcb
=
NULL
;
...
@@ -14807,6 +14834,9 @@ skip_out_eof:
...
@@ -14807,6 +14834,9 @@ skip_out_eof:
stcb
->
asoc
.
total_flight
,
stcb
->
asoc
.
total_flight
,
stcb
->
asoc
.
chunks_on_out_queue
,
stcb
->
asoc
.
total_flight_count
);
stcb
->
asoc
.
chunks_on_out_queue
,
stcb
->
asoc
.
total_flight_count
);
}
}
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
if
((
queue_only
==
0
)
&&
(
nagle_applies
==
0
)
&&
(
stcb
->
asoc
.
peers_rwnd
&&
un_sent
))
{
if
((
queue_only
==
0
)
&&
(
nagle_applies
==
0
)
&&
(
stcb
->
asoc
.
peers_rwnd
&&
un_sent
))
{
/* we can attempt to send too. */
/* we can attempt to send too. */
if
(
hold_tcblock
==
0
)
{
if
(
hold_tcblock
==
0
)
{
...
@@ -14839,6 +14869,9 @@ skip_out_eof:
...
@@ -14839,6 +14869,9 @@ skip_out_eof:
(
void
)
sctp_med_chunk_output
(
inp
,
stcb
,
&
stcb
->
asoc
,
&
num_out
,
(
void
)
sctp_med_chunk_output
(
inp
,
stcb
,
&
stcb
->
asoc
,
&
num_out
,
&
reason
,
1
,
1
,
&
now
,
&
now_filled
,
frag_point
,
SCTP_SO_LOCKED
);
&
reason
,
1
,
1
,
&
now
,
&
now_filled
,
frag_point
,
SCTP_SO_LOCKED
);
}
}
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
SCTPDBG
(
SCTP_DEBUG_OUTPUT1
,
"USR Send complete qo:%d prw:%d unsent:%d tf:%d cooq:%d toqs:%d err:%d
\n
"
,
SCTPDBG
(
SCTP_DEBUG_OUTPUT1
,
"USR Send complete qo:%d prw:%d unsent:%d tf:%d cooq:%d toqs:%d err:%d
\n
"
,
queue_only
,
stcb
->
asoc
.
peers_rwnd
,
un_sent
,
queue_only
,
stcb
->
asoc
.
peers_rwnd
,
un_sent
,
stcb
->
asoc
.
total_flight
,
stcb
->
asoc
.
chunks_on_out_queue
,
stcb
->
asoc
.
total_flight
,
stcb
->
asoc
.
chunks_on_out_queue
,
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.c
浏览文件 @
08f3e1d9
...
@@ -6871,7 +6871,7 @@ sctp_pcb_finish(void)
...
@@ -6871,7 +6871,7 @@ sctp_pcb_finish(void)
}
}
#endif
#endif
#if defined(__Userspace__)
#if defined(__Userspace__)
if
(
sctp_it_ctl
.
thread_proc
)
{
if
(
SCTP_BASE_VAR
(
iterator_thread_started
)
)
{
#if defined(__Userspace_os_Windows)
#if defined(__Userspace_os_Windows)
WaitForSingleObject
(
sctp_it_ctl
.
thread_proc
,
INFINITE
);
WaitForSingleObject
(
sctp_it_ctl
.
thread_proc
,
INFINITE
);
CloseHandle
(
sctp_it_ctl
.
thread_proc
);
CloseHandle
(
sctp_it_ctl
.
thread_proc
);
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_pcb.h
浏览文件 @
08f3e1d9
...
@@ -315,6 +315,8 @@ struct sctp_base_info {
...
@@ -315,6 +315,8 @@ struct sctp_base_info {
userland_mutex_t
timer_mtx
;
userland_mutex_t
timer_mtx
;
userland_thread_t
timer_thread
;
userland_thread_t
timer_thread
;
int
timer_thread_should_exit
;
int
timer_thread_should_exit
;
int
iterator_thread_started
;
int
timer_thread_started
;
#if !defined(__Userspace_os_Windows)
#if !defined(__Userspace_os_Windows)
pthread_mutexattr_t
mtx_attr
;
pthread_mutexattr_t
mtx_attr
;
#if defined(INET) || defined(INET6)
#if defined(INET) || defined(INET6)
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_ss_functions.c
浏览文件 @
08f3e1d9
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#ifdef __FreeBSD__
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_ss_functions.c 3
45505 2019-03-25 16:40:54
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_ss_functions.c 3
58028 2020-02-17 18:05:03
Z tuexen $"
);
#endif
#endif
#include <netinet/sctp_pcb.h>
#include <netinet/sctp_pcb.h>
...
@@ -521,6 +521,9 @@ sctp_ss_prio_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net,
...
@@ -521,6 +521,9 @@ sctp_ss_prio_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net,
{
{
struct
sctp_stream_out
*
strq
,
*
strqt
,
*
strqn
;
struct
sctp_stream_out
*
strq
,
*
strqt
,
*
strqn
;
if
(
asoc
->
ss_data
.
locked_on_sending
)
{
return
(
asoc
->
ss_data
.
locked_on_sending
);
}
strqt
=
asoc
->
ss_data
.
last_out_stream
;
strqt
=
asoc
->
ss_data
.
last_out_stream
;
prio_again:
prio_again:
/* Find the next stream to use */
/* Find the next stream to use */
...
@@ -697,6 +700,9 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net,
...
@@ -697,6 +700,9 @@ sctp_ss_fb_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net,
{
{
struct
sctp_stream_out
*
strq
=
NULL
,
*
strqt
;
struct
sctp_stream_out
*
strq
=
NULL
,
*
strqt
;
if
(
asoc
->
ss_data
.
locked_on_sending
)
{
return
(
asoc
->
ss_data
.
locked_on_sending
);
}
if
(
asoc
->
ss_data
.
last_out_stream
==
NULL
||
if
(
asoc
->
ss_data
.
last_out_stream
==
NULL
||
TAILQ_FIRST
(
&
asoc
->
ss_data
.
out
.
wheel
)
==
TAILQ_LAST
(
&
asoc
->
ss_data
.
out
.
wheel
,
sctpwheel_listhead
))
{
TAILQ_FIRST
(
&
asoc
->
ss_data
.
out
.
wheel
)
==
TAILQ_LAST
(
&
asoc
->
ss_data
.
out
.
wheel
,
sctpwheel_listhead
))
{
strqt
=
TAILQ_FIRST
(
&
asoc
->
ss_data
.
out
.
wheel
);
strqt
=
TAILQ_FIRST
(
&
asoc
->
ss_data
.
out
.
wheel
);
...
@@ -905,6 +911,9 @@ sctp_ss_fcfs_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net,
...
@@ -905,6 +911,9 @@ sctp_ss_fcfs_select(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net,
struct
sctp_stream_out
*
strq
;
struct
sctp_stream_out
*
strq
;
struct
sctp_stream_queue_pending
*
sp
;
struct
sctp_stream_queue_pending
*
sp
;
if
(
asoc
->
ss_data
.
locked_on_sending
)
{
return
(
asoc
->
ss_data
.
locked_on_sending
);
}
sp
=
TAILQ_FIRST
(
&
asoc
->
ss_data
.
out
.
list
);
sp
=
TAILQ_FIRST
(
&
asoc
->
ss_data
.
out
.
list
);
default_again:
default_again:
if
(
sp
!=
NULL
)
{
if
(
sp
!=
NULL
)
{
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctp_usrreq.c
浏览文件 @
08f3e1d9
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_usrreq.c 35
6270 2020-01-02 13:55:10
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctp_usrreq.c 35
8083 2020-02-18 21:25:17
Z tuexen $"
);
#endif
#endif
#include <netinet/sctp_os.h>
#include <netinet/sctp_os.h>
...
@@ -161,11 +161,14 @@ sctp_init(void)
...
@@ -161,11 +161,14 @@ sctp_init(void)
SCTP_BASE_VAR
(
conn_output
)
=
conn_output
;
SCTP_BASE_VAR
(
conn_output
)
=
conn_output
;
SCTP_BASE_VAR
(
debug_printf
)
=
debug_printf
;
SCTP_BASE_VAR
(
debug_printf
)
=
debug_printf
;
SCTP_BASE_VAR
(
crc32c_offloaded
)
=
0
;
SCTP_BASE_VAR
(
crc32c_offloaded
)
=
0
;
SCTP_BASE_VAR
(
iterator_thread_started
)
=
0
;
SCTP_BASE_VAR
(
timer_thread_started
)
=
0
;
#endif
#endif
#if defined(__Userspace__)
#if defined(__Userspace__)
sctp_pcb_init
(
start_threads
);
sctp_pcb_init
(
start_threads
);
if
(
start_threads
)
if
(
start_threads
)
{
sctp_start_timer
();
sctp_start_timer
();
}
#else
#else
sctp_pcb_init
();
sctp_pcb_init
();
#endif
#endif
...
@@ -252,12 +255,14 @@ sctp_finish(void)
...
@@ -252,12 +255,14 @@ sctp_finish(void)
}
}
#endif
#endif
atomic_cmpset_int
(
&
SCTP_BASE_VAR
(
timer_thread_should_exit
),
0
,
1
);
atomic_cmpset_int
(
&
SCTP_BASE_VAR
(
timer_thread_should_exit
),
0
,
1
);
if
(
SCTP_BASE_VAR
(
timer_thread_started
))
{
#if defined(__Userspace_os_Windows)
#if defined(__Userspace_os_Windows)
WaitForSingleObject
(
SCTP_BASE_VAR
(
timer_thread
),
INFINITE
);
WaitForSingleObject
(
SCTP_BASE_VAR
(
timer_thread
),
INFINITE
);
CloseHandle
(
SCTP_BASE_VAR
(
timer_thread
));
CloseHandle
(
SCTP_BASE_VAR
(
timer_thread
));
#else
#else
pthread_join
(
SCTP_BASE_VAR
(
timer_thread
),
NULL
);
pthread_join
(
SCTP_BASE_VAR
(
timer_thread
),
NULL
);
#endif
#endif
}
#endif
#endif
sctp_pcb_finish
();
sctp_pcb_finish
();
#if defined(__Windows__)
#if defined(__Windows__)
...
@@ -678,19 +683,22 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, getcred, CTLTYPE_OPAQUE | CTLFLAG_RW,
...
@@ -678,19 +683,22 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, getcred, CTLTYPE_OPAQUE | CTLFLAG_RW,
#ifdef INET
#ifdef INET
#if defined(__Panda__) || defined(__Windows__) || defined(__Userspace__)
#if defined(__Panda__) || defined(__Windows__) || defined(__Userspace__)
int
int
#elif defined(__FreeBSD__)
&& __FreeBSD_version > 690000
#elif defined(__FreeBSD__)
static
void
static
void
#else
#else
static
int
static
int
#endif
#endif
sctp_abort
(
struct
socket
*
so
)
sctp_abort
(
struct
socket
*
so
)
{
{
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
struct
sctp_inpcb
*
inp
;
struct
sctp_inpcb
*
inp
;
uint32_t
flags
;
uint32_t
flags
;
inp
=
(
struct
sctp_inpcb
*
)
so
->
so_pcb
;
inp
=
(
struct
sctp_inpcb
*
)
so
->
so_pcb
;
if
(
inp
==
NULL
)
{
if
(
inp
==
NULL
)
{
#if defined(__FreeBSD__)
&& __FreeBSD_version > 690000
#if defined(__FreeBSD__)
return
;
return
;
#else
#else
SCTP_LTRACE_ERR_RET
(
NULL
,
NULL
,
NULL
,
SCTP_FROM_SCTP_USRREQ
,
EINVAL
);
SCTP_LTRACE_ERR_RET
(
NULL
,
NULL
,
NULL
,
SCTP_FROM_SCTP_USRREQ
,
EINVAL
);
...
@@ -698,6 +706,9 @@ sctp_abort(struct socket *so)
...
@@ -698,6 +706,9 @@ sctp_abort(struct socket *so)
#endif
#endif
}
}
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_must_try_again:
sctp_must_try_again:
flags
=
inp
->
sctp_flags
;
flags
=
inp
->
sctp_flags
;
#ifdef SCTP_LOG_CLOSING
#ifdef SCTP_LOG_CLOSING
...
@@ -730,7 +741,8 @@ sctp_abort(struct socket *so)
...
@@ -730,7 +741,8 @@ sctp_abort(struct socket *so)
goto
sctp_must_try_again
;
goto
sctp_must_try_again
;
}
}
}
}
#if defined(__FreeBSD__) && __FreeBSD_version > 690000
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
return
;
return
;
#else
#else
return
(
0
);
return
(
0
);
...
@@ -891,6 +903,9 @@ sctpconn_bind(struct socket *so, struct sockaddr *addr)
...
@@ -891,6 +903,9 @@ sctpconn_bind(struct socket *so, struct sockaddr *addr)
void
void
sctp_close
(
struct
socket
*
so
)
sctp_close
(
struct
socket
*
so
)
{
{
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
struct
sctp_inpcb
*
inp
;
struct
sctp_inpcb
*
inp
;
uint32_t
flags
;
uint32_t
flags
;
...
@@ -901,6 +916,9 @@ sctp_close(struct socket *so)
...
@@ -901,6 +916,9 @@ sctp_close(struct socket *so)
/* Inform all the lower layer assoc that we
/* Inform all the lower layer assoc that we
* are done.
* are done.
*/
*/
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_must_try_again:
sctp_must_try_again:
flags
=
inp
->
sctp_flags
;
flags
=
inp
->
sctp_flags
;
#ifdef SCTP_LOG_CLOSING
#ifdef SCTP_LOG_CLOSING
...
@@ -948,6 +966,9 @@ sctp_close(struct socket *so)
...
@@ -948,6 +966,9 @@ sctp_close(struct socket *so)
goto
sctp_must_try_again
;
goto
sctp_must_try_again
;
}
}
}
}
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
return
;
return
;
}
}
...
@@ -1120,9 +1141,18 @@ connected_type:
...
@@ -1120,9 +1141,18 @@ connected_type:
* definitions) but this is not advisable. This code is used
* definitions) but this is not advisable. This code is used
* by FreeBSD when sending a file with sendfile() though.
* by FreeBSD when sending a file with sendfile() though.
*/
*/
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
int
ret
;
int
ret
;
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
ret
=
sctp_output
(
inp
,
inp
->
pkt
,
addr
,
inp
->
control
,
p
,
flags
);
ret
=
sctp_output
(
inp
,
inp
->
pkt
,
addr
,
inp
->
control
,
p
,
flags
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
inp
->
pkt
=
NULL
;
inp
->
pkt
=
NULL
;
inp
->
control
=
NULL
;
inp
->
control
=
NULL
;
return
(
ret
);
return
(
ret
);
...
@@ -1150,6 +1180,9 @@ sctp_disconnect(struct socket *so)
...
@@ -1150,6 +1180,9 @@ sctp_disconnect(struct socket *so)
SCTP_INP_RUNLOCK
(
inp
);
SCTP_INP_RUNLOCK
(
inp
);
return
(
0
);
return
(
0
);
}
else
{
}
else
{
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
struct
sctp_association
*
asoc
;
struct
sctp_association
*
asoc
;
struct
sctp_tcb
*
stcb
;
struct
sctp_tcb
*
stcb
;
...
@@ -1167,6 +1200,9 @@ sctp_disconnect(struct socket *so)
...
@@ -1167,6 +1200,9 @@ sctp_disconnect(struct socket *so)
SCTP_INP_RUNLOCK
(
inp
);
SCTP_INP_RUNLOCK
(
inp
);
return
(
0
);
return
(
0
);
}
}
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
#if defined(__Userspace__)
#if defined(__Userspace__)
if
(((
so
->
so_options
&
SCTP_SO_LINGER
)
&&
if
(((
so
->
so_options
&
SCTP_SO_LINGER
)
&&
(
so
->
so_linger
==
0
))
||
(
so
->
so_linger
==
0
))
||
...
@@ -1192,6 +1228,9 @@ sctp_disconnect(struct socket *so)
...
@@ -1192,6 +1228,9 @@ sctp_disconnect(struct socket *so)
(
void
)
sctp_free_assoc
(
inp
,
stcb
,
SCTP_NORMAL_PROC
,
(
void
)
sctp_free_assoc
(
inp
,
stcb
,
SCTP_NORMAL_PROC
,
SCTP_FROM_SCTP_USRREQ
+
SCTP_LOC_3
);
SCTP_FROM_SCTP_USRREQ
+
SCTP_LOC_3
);
/* No unlock tcb assoc is gone */
/* No unlock tcb assoc is gone */
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
return
(
0
);
return
(
0
);
}
}
if
(
TAILQ_EMPTY
(
&
asoc
->
send_queue
)
&&
if
(
TAILQ_EMPTY
(
&
asoc
->
send_queue
)
&&
...
@@ -1264,12 +1303,18 @@ sctp_disconnect(struct socket *so)
...
@@ -1264,12 +1303,18 @@ sctp_disconnect(struct socket *so)
SCTP_INP_RUNLOCK
(
inp
);
SCTP_INP_RUNLOCK
(
inp
);
(
void
)
sctp_free_assoc
(
inp
,
stcb
,
SCTP_NORMAL_PROC
,
(
void
)
sctp_free_assoc
(
inp
,
stcb
,
SCTP_NORMAL_PROC
,
SCTP_FROM_SCTP_USRREQ
+
SCTP_LOC_5
);
SCTP_FROM_SCTP_USRREQ
+
SCTP_LOC_5
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
return
(
0
);
return
(
0
);
}
else
{
}
else
{
sctp_chunk_output
(
inp
,
stcb
,
SCTP_OUTPUT_FROM_CLOSING
,
SCTP_SO_LOCKED
);
sctp_chunk_output
(
inp
,
stcb
,
SCTP_OUTPUT_FROM_CLOSING
,
SCTP_SO_LOCKED
);
}
}
}
}
soisdisconnecting
(
so
);
soisdisconnecting
(
so
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_INP_RUNLOCK
(
inp
);
SCTP_INP_RUNLOCK
(
inp
);
return
(
0
);
return
(
0
);
...
@@ -1368,6 +1413,9 @@ sctp_shutdown(struct socket *so)
...
@@ -1368,6 +1413,9 @@ sctp_shutdown(struct socket *so)
* a SHUT_WR or SHUT_RDWR.
* a SHUT_WR or SHUT_RDWR.
* This means we put the shutdown flag against it.
* This means we put the shutdown flag against it.
*/
*/
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
struct
sctp_tcb
*
stcb
;
struct
sctp_tcb
*
stcb
;
struct
sctp_association
*
asoc
;
struct
sctp_association
*
asoc
;
struct
sctp_nets
*
netp
;
struct
sctp_nets
*
netp
;
...
@@ -1406,6 +1454,9 @@ sctp_shutdown(struct socket *so)
...
@@ -1406,6 +1454,9 @@ sctp_shutdown(struct socket *so)
SCTP_INP_RUNLOCK
(
inp
);
SCTP_INP_RUNLOCK
(
inp
);
return
(
0
);
return
(
0
);
}
}
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
if
(
stcb
->
asoc
.
alternate
)
{
if
(
stcb
->
asoc
.
alternate
)
{
netp
=
stcb
->
asoc
.
alternate
;
netp
=
stcb
->
asoc
.
alternate
;
}
else
{
}
else
{
...
@@ -1444,6 +1495,9 @@ sctp_shutdown(struct socket *so)
...
@@ -1444,6 +1495,9 @@ sctp_shutdown(struct socket *so)
SCTP_INP_RUNLOCK
(
inp
);
SCTP_INP_RUNLOCK
(
inp
);
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
sctp_abort_an_association
(
stcb
->
sctp_ep
,
stcb
,
op_err
,
SCTP_SO_LOCKED
);
op_err
,
SCTP_SO_LOCKED
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
return
(
0
);
return
(
0
);
}
}
}
}
...
@@ -1452,6 +1506,9 @@ sctp_shutdown(struct socket *so)
...
@@ -1452,6 +1506,9 @@ sctp_shutdown(struct socket *so)
sctp_chunk_output
(
inp
,
stcb
,
SCTP_OUTPUT_FROM_CLOSING
,
SCTP_SO_LOCKED
);
sctp_chunk_output
(
inp
,
stcb
,
SCTP_OUTPUT_FROM_CLOSING
,
SCTP_SO_LOCKED
);
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_INP_RUNLOCK
(
inp
);
SCTP_INP_RUNLOCK
(
inp
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
return
(
0
);
return
(
0
);
}
}
}
}
...
@@ -7831,13 +7888,14 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
...
@@ -7831,13 +7888,14 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
int
int
sctp_ctloutput
(
struct
socket
*
so
,
struct
sockopt
*
sopt
)
sctp_ctloutput
(
struct
socket
*
so
,
struct
sockopt
*
sopt
)
{
{
void
*
optval
=
NULL
;
size_t
optsize
=
0
;
void
*
p
;
int
error
=
0
;
#if defined(__FreeBSD__)
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
struct
sctp_inpcb
*
inp
;
struct
sctp_inpcb
*
inp
;
#endif
#endif
void
*
optval
=
NULL
;
void
*
p
;
size_t
optsize
=
0
;
int
error
=
0
;
#if defined(__FreeBSD__)
#if defined(__FreeBSD__)
if
((
sopt
->
sopt_level
==
SOL_SOCKET
)
&&
if
((
sopt
->
sopt_level
==
SOL_SOCKET
)
&&
...
@@ -7890,7 +7948,13 @@ sctp_ctloutput(struct socket *so, struct sockopt *sopt)
...
@@ -7890,7 +7948,13 @@ sctp_ctloutput(struct socket *so, struct sockopt *sopt)
p
=
(
void
*
)
sopt
->
sopt_p
;
p
=
(
void
*
)
sopt
->
sopt_p
;
#endif
#endif
if
(
sopt
->
sopt_dir
==
SOPT_SET
)
{
if
(
sopt
->
sopt_dir
==
SOPT_SET
)
{
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
error
=
sctp_setopt
(
so
,
sopt
->
sopt_name
,
optval
,
optsize
,
p
);
error
=
sctp_setopt
(
so
,
sopt
->
sopt_name
,
optval
,
optsize
,
p
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
}
else
if
(
sopt
->
sopt_dir
==
SOPT_GET
)
{
}
else
if
(
sopt
->
sopt_dir
==
SOPT_GET
)
{
error
=
sctp_getopt
(
so
,
sopt
->
sopt_name
,
optval
,
&
optsize
,
p
);
error
=
sctp_getopt
(
so
,
sopt
->
sopt_name
,
optval
,
&
optsize
,
p
);
}
else
{
}
else
{
...
@@ -7935,6 +7999,9 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
...
@@ -7935,6 +7999,9 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
#endif
#endif
#endif
#endif
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
#ifdef SCTP_MVRF
#ifdef SCTP_MVRF
int
i
,
fnd
=
0
;
int
i
,
fnd
=
0
;
#endif
#endif
...
@@ -7956,7 +8023,7 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
...
@@ -7956,7 +8023,7 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
}
}
#if defined(__Userspace__)
#if defined(__Userspace__)
/* TODO __Userspace__ falls into this code for IPv6 stuff at the moment... */
/* TODO __Userspace__ falls into this code for IPv6 stuff at the moment... */
#endif
#endif
#if !defined(__Windows__) && !defined(__Userspace_os_Linux) && !defined(__Userspace_os_Windows)
#if !defined(__Windows__) && !defined(__Userspace_os_Linux) && !defined(__Userspace_os_Windows)
switch
(
addr
->
sa_family
)
{
switch
(
addr
->
sa_family
)
{
...
@@ -8012,7 +8079,9 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
...
@@ -8012,7 +8079,9 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
SCTP_INP_INCR_REF
(
inp
);
SCTP_INP_INCR_REF
(
inp
);
SCTP_ASOC_CREATE_LOCK
(
inp
);
SCTP_ASOC_CREATE_LOCK
(
inp
);
create_lock_on
=
1
;
create_lock_on
=
1
;
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
if
((
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_SOCKET_ALLGONE
)
||
if
((
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_SOCKET_ALLGONE
)
||
(
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_SOCKET_GONE
))
{
(
inp
->
sctp_flags
&
SCTP_PCB_FLAGS_SOCKET_GONE
))
{
...
@@ -8117,10 +8186,12 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
...
@@ -8117,10 +8186,12 @@ sctp_connect(struct socket *so, struct mbuf *nam, struct proc *p)
sctp_send_initiate
(
inp
,
stcb
,
SCTP_SO_LOCKED
);
sctp_send_initiate
(
inp
,
stcb
,
SCTP_SO_LOCKED
);
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_TCB_UNLOCK
(
stcb
);
out_now:
out_now:
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
if
(
create_lock_on
)
{
if
(
create_lock_on
)
{
SCTP_ASOC_CREATE_UNLOCK
(
inp
);
SCTP_ASOC_CREATE_UNLOCK
(
inp
);
}
}
SCTP_INP_DECR_REF
(
inp
);
SCTP_INP_DECR_REF
(
inp
);
return
(
error
);
return
(
error
);
}
}
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet/sctputil.c
浏览文件 @
08f3e1d9
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctputil.c 35
7775 2020-02-11 20:02:20
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet/sctputil.c 35
8083 2020-02-18 21:25:17
Z tuexen $"
);
#endif
#endif
#include <netinet/sctp_os.h>
#include <netinet/sctp_os.h>
...
@@ -1419,11 +1419,17 @@ sctp_expand_mapping_array(struct sctp_association *asoc, uint32_t needed)
...
@@ -1419,11 +1419,17 @@ sctp_expand_mapping_array(struct sctp_association *asoc, uint32_t needed)
static
void
static
void
sctp_iterator_work
(
struct
sctp_iterator
*
it
)
sctp_iterator_work
(
struct
sctp_iterator
*
it
)
{
{
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
struct
sctp_inpcb
*
tinp
;
int
iteration_count
=
0
;
int
iteration_count
=
0
;
int
inp_skip
=
0
;
int
inp_skip
=
0
;
int
first_in
=
1
;
int
first_in
=
1
;
struct
sctp_inpcb
*
tinp
;
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
SCTP_INP_INFO_RLOCK
();
SCTP_INP_INFO_RLOCK
();
SCTP_ITERATOR_LOCK
();
SCTP_ITERATOR_LOCK
();
sctp_it_ctl
.
cur_it
=
it
;
sctp_it_ctl
.
cur_it
=
it
;
...
@@ -1441,6 +1447,9 @@ done_with_iterator:
...
@@ -1441,6 +1447,9 @@ done_with_iterator:
(
*
it
->
function_atend
)
(
it
->
pointer
,
it
->
val
);
(
*
it
->
function_atend
)
(
it
->
pointer
,
it
->
val
);
}
}
SCTP_FREE
(
it
,
SCTP_M_ITER
);
SCTP_FREE
(
it
,
SCTP_M_ITER
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
return
;
return
;
}
}
select_a_new_ep:
select_a_new_ep:
...
@@ -1661,6 +1670,9 @@ sctp_handle_addr_wq(void)
...
@@ -1661,6 +1670,9 @@ sctp_handle_addr_wq(void)
void
void
sctp_timeout_handler
(
void
*
t
)
sctp_timeout_handler
(
void
*
t
)
{
{
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
struct
sctp_inpcb
*
inp
;
struct
sctp_inpcb
*
inp
;
struct
sctp_tcb
*
stcb
;
struct
sctp_tcb
*
stcb
;
struct
sctp_nets
*
net
;
struct
sctp_nets
*
net
;
...
@@ -1795,6 +1807,9 @@ sctp_timeout_handler(void *t)
...
@@ -1795,6 +1807,9 @@ sctp_timeout_handler(void *t)
/* record in stopped what t-o occurred */
/* record in stopped what t-o occurred */
tmr
->
stopped_from
=
type
;
tmr
->
stopped_from
=
type
;
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
/* mark as being serviced now */
/* mark as being serviced now */
if
(
SCTP_OS_TIMER_PENDING
(
&
tmr
->
timer
))
{
if
(
SCTP_OS_TIMER_PENDING
(
&
tmr
->
timer
))
{
/*
/*
...
@@ -1998,7 +2013,6 @@ sctp_timeout_handler(void *t)
...
@@ -1998,7 +2013,6 @@ sctp_timeout_handler(void *t)
sctp_abort_an_association
(
inp
,
stcb
,
op_err
,
SCTP_SO_NOT_LOCKED
);
sctp_abort_an_association
(
inp
,
stcb
,
op_err
,
SCTP_SO_NOT_LOCKED
);
/* no need to unlock on tcb its gone */
/* no need to unlock on tcb its gone */
goto
out_decr
;
goto
out_decr
;
case
SCTP_TIMER_TYPE_STRRESET
:
case
SCTP_TIMER_TYPE_STRRESET
:
if
((
stcb
==
NULL
)
||
(
inp
==
NULL
))
{
if
((
stcb
==
NULL
)
||
(
inp
==
NULL
))
{
break
;
break
;
...
@@ -2031,7 +2045,6 @@ sctp_timeout_handler(void *t)
...
@@ -2031,7 +2045,6 @@ sctp_timeout_handler(void *t)
sctp_delete_prim_timer
(
inp
,
stcb
,
net
);
sctp_delete_prim_timer
(
inp
,
stcb
,
net
);
SCTP_STAT_INCR
(
sctps_timodelprim
);
SCTP_STAT_INCR
(
sctps_timodelprim
);
break
;
break
;
case
SCTP_TIMER_TYPE_AUTOCLOSE
:
case
SCTP_TIMER_TYPE_AUTOCLOSE
:
if
((
stcb
==
NULL
)
||
(
inp
==
NULL
))
{
if
((
stcb
==
NULL
)
||
(
inp
==
NULL
))
{
break
;
break
;
...
@@ -2138,8 +2151,11 @@ out_decr:
...
@@ -2138,8 +2151,11 @@ out_decr:
out_no_decr:
out_no_decr:
SCTPDBG
(
SCTP_DEBUG_TIMER1
,
"Timer now complete (type = %d)
\n
"
,
type
);
SCTPDBG
(
SCTP_DEBUG_TIMER1
,
"Timer now complete (type = %d)
\n
"
,
type
);
#if defined(__FreeBSD__) && __FreeBSD_version >= 801000
#if defined(__FreeBSD__)
#if __FreeBSD_version >= 801000
CURVNET_RESTORE
();
CURVNET_RESTORE
();
#endif
NET_EPOCH_EXIT
(
et
);
#endif
#endif
}
}
...
@@ -5621,6 +5637,9 @@ sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock,
...
@@ -5621,6 +5637,9 @@ sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock,
uint32_t
rwnd_req
)
uint32_t
rwnd_req
)
{
{
/* User pulled some data, do we need a rwnd update? */
/* User pulled some data, do we need a rwnd update? */
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
int
r_unlocked
=
0
;
int
r_unlocked
=
0
;
uint32_t
dif
,
rwnd
;
uint32_t
dif
,
rwnd
;
struct
socket
*
so
=
NULL
;
struct
socket
*
so
=
NULL
;
...
@@ -5631,7 +5650,7 @@ sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock,
...
@@ -5631,7 +5650,7 @@ sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock,
atomic_add_int
(
&
stcb
->
asoc
.
refcnt
,
1
);
atomic_add_int
(
&
stcb
->
asoc
.
refcnt
,
1
);
if
((
SCTP_GET_STATE
(
stcb
)
==
SCTP_STATE_SHUTDOWN_ACK_SENT
)
||
if
((
SCTP_GET_STATE
(
stcb
)
==
SCTP_STATE_SHUTDOWN_ACK_SENT
)
||
(
stcb
->
asoc
.
state
&
(
SCTP_STATE_ABOUT_TO_BE_FREED
|
SCTP_STATE_SHUTDOWN_RECEIVED
)))
{
(
stcb
->
asoc
.
state
&
(
SCTP_STATE_ABOUT_TO_BE_FREED
|
SCTP_STATE_SHUTDOWN_RECEIVED
)))
{
/* Pre-check If we are freeing no update */
/* Pre-check If we are freeing no update */
goto
no_lock
;
goto
no_lock
;
}
}
...
@@ -5676,11 +5695,17 @@ sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock,
...
@@ -5676,11 +5695,17 @@ sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t *freed_so_far, int hold_rlock,
goto
out
;
goto
out
;
}
}
SCTP_STAT_INCR
(
sctps_wu_sacks_sent
);
SCTP_STAT_INCR
(
sctps_wu_sacks_sent
);
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_send_sack
(
stcb
,
SCTP_SO_LOCKED
);
sctp_send_sack
(
stcb
,
SCTP_SO_LOCKED
);
sctp_chunk_output
(
stcb
->
sctp_ep
,
stcb
,
sctp_chunk_output
(
stcb
->
sctp_ep
,
stcb
,
SCTP_OUTPUT_FROM_USR_RCVD
,
SCTP_SO_LOCKED
);
SCTP_OUTPUT_FROM_USR_RCVD
,
SCTP_SO_LOCKED
);
/* make sure no timer is running */
/* make sure no timer is running */
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
sctp_timer_stop
(
SCTP_TIMER_TYPE_RECV
,
stcb
->
sctp_ep
,
stcb
,
NULL
,
sctp_timer_stop
(
SCTP_TIMER_TYPE_RECV
,
stcb
->
sctp_ep
,
stcb
,
NULL
,
SCTP_FROM_SCTPUTIL
+
SCTP_LOC_6
);
SCTP_FROM_SCTPUTIL
+
SCTP_LOC_6
);
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_TCB_UNLOCK
(
stcb
);
...
...
worker/deps/usrsctp/usrsctp/usrsctplib/netinet6/sctp6_usrreq.c
浏览文件 @
08f3e1d9
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#ifdef __FreeBSD__
#ifdef __FreeBSD__
#include <sys/cdefs.h>
#include <sys/cdefs.h>
__FBSDID
(
"$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 35
5264 2019-12-01 16:14:44
Z tuexen $"
);
__FBSDID
(
"$FreeBSD: head/sys/netinet6/sctp6_usrreq.c 35
8083 2020-02-18 21:25:17
Z tuexen $"
);
#endif
#endif
#include <netinet/sctp_os.h>
#include <netinet/sctp_os.h>
...
@@ -710,6 +710,9 @@ static int
...
@@ -710,6 +710,9 @@ static int
#endif
#endif
sctp6_abort
(
struct
socket
*
so
)
sctp6_abort
(
struct
socket
*
so
)
{
{
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
struct
sctp_inpcb
*
inp
;
struct
sctp_inpcb
*
inp
;
uint32_t
flags
;
uint32_t
flags
;
...
@@ -722,6 +725,9 @@ sctp6_abort(struct socket *so)
...
@@ -722,6 +725,9 @@ sctp6_abort(struct socket *so)
return
(
EINVAL
);
return
(
EINVAL
);
#endif
#endif
}
}
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_must_try_again
:
sctp_must_try_again
:
flags
=
inp
->
sctp_flags
;
flags
=
inp
->
sctp_flags
;
#ifdef SCTP_LOG_CLOSING
#ifdef SCTP_LOG_CLOSING
...
@@ -754,6 +760,7 @@ sctp6_abort(struct socket *so)
...
@@ -754,6 +760,7 @@ sctp6_abort(struct socket *so)
}
}
}
}
#if (defined(__FreeBSD__) && __FreeBSD_version > 690000) || defined(__Windows__)
#if (defined(__FreeBSD__) && __FreeBSD_version > 690000) || defined(__Windows__)
NET_EPOCH_EXIT
(
et
);
return
;
return
;
#else
#else
return
(
0
);
return
(
0
);
...
@@ -1134,9 +1141,18 @@ connected_type:
...
@@ -1134,9 +1141,18 @@ connected_type:
* optionaly switch back to this code (by changing back the
* optionaly switch back to this code (by changing back the
* defininitions but this is not advisable.
* defininitions but this is not advisable.
*/
*/
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
int
ret
;
int
ret
;
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
ret
=
sctp_output
(
inp
,
inp
->
pkt
,
addr
,
inp
->
control
,
p
,
flags
);
ret
=
sctp_output
(
inp
,
inp
->
pkt
,
addr
,
inp
->
control
,
p
,
flags
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
inp
->
pkt
=
NULL
;
inp
->
pkt
=
NULL
;
inp
->
control
=
NULL
;
inp
->
control
=
NULL
;
return
(
ret
);
return
(
ret
);
...
@@ -1172,6 +1188,9 @@ static int
...
@@ -1172,6 +1188,9 @@ static int
sctp6_connect
(
struct
socket
*
so
,
struct
mbuf
*
nam
,
struct
proc
*
p
)
sctp6_connect
(
struct
socket
*
so
,
struct
mbuf
*
nam
,
struct
proc
*
p
)
{
{
struct
sockaddr
*
addr
=
mtod
(
nam
,
struct
sockaddr
*
);
struct
sockaddr
*
addr
=
mtod
(
nam
,
struct
sockaddr
*
);
#endif
#if defined(__FreeBSD__)
struct
epoch_tracker
et
;
#endif
#endif
uint32_t
vrf_id
;
uint32_t
vrf_id
;
int
error
=
0
;
int
error
=
0
;
...
@@ -1313,8 +1332,14 @@ sctp6_connect(struct socket *so, struct mbuf *nam, struct proc *p)
...
@@ -1313,8 +1332,14 @@ sctp6_connect(struct socket *so, struct mbuf *nam, struct proc *p)
}
}
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_COOKIE_WAIT
);
SCTP_SET_STATE
(
stcb
,
SCTP_STATE_COOKIE_WAIT
);
(
void
)
SCTP_GETTIME_TIMEVAL
(
&
stcb
->
asoc
.
time_entered
);
(
void
)
SCTP_GETTIME_TIMEVAL
(
&
stcb
->
asoc
.
time_entered
);
#if defined(__FreeBSD__)
NET_EPOCH_ENTER
(
et
);
#endif
sctp_send_initiate
(
inp
,
stcb
,
SCTP_SO_LOCKED
);
sctp_send_initiate
(
inp
,
stcb
,
SCTP_SO_LOCKED
);
SCTP_TCB_UNLOCK
(
stcb
);
SCTP_TCB_UNLOCK
(
stcb
);
#if defined(__FreeBSD__)
NET_EPOCH_EXIT
(
et
);
#endif
return
(
error
);
return
(
error
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论