1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-25 04:51:04 +02:00

Better detect SCTP protocol (#1016)

turnserver includes support for SCTP and tries to initialize listener
sockets with SCTP protocol. On machines where SCTP definitions exist but
the protocol is not provided - socket() returns error which shows up as
`socket: protocol not supported`

This change improves a few related pieces of code:
- Log error instead of perror
- config script detect sctp.h and if not present - defines TURN_NO_SCTP
- CMake fully disables SCTP (for now - requires custom module to detect
SCTP presence)

Fixes #492
This commit is contained in:
Pavel Punsky 2022-10-12 01:52:31 -07:00 committed by GitHub
parent 13ecb7d012
commit 1467a5bd14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

2
configure vendored
View File

@ -1015,6 +1015,8 @@ if [ -z "${TURN_NO_SCTP}" ] ; then
if [ -z "${TURN_SCTP_INCLUDE}" ] ; then
if [ -f /usr/include/netinet/sctp.h ] ; then
TURN_SCTP_INCLUDE="-DTURN_SCTP_INCLUDE=\"</usr/include/netinet/sctp.h>\""
else
TURN_NO_SCTP="-DTURN_NO_SCTP"
fi
else
TURN_SCTP_INCLUDE="-DTURN_SCTP_INCLUDE=\"\\\"${TURN_SCTP_INCLUDE}\\\"\""

View File

@ -93,6 +93,8 @@ else()
list(APPEND turnserver_DEFINED TURN_NO_PROMETHEUS)
endif()
list(APPEND turnserver_DEFINED TURN_NO_SCTP)
add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${HEAD_FILES})
target_link_libraries(${PROJECT_NAME} PRIVATE turn_server ${turnserver_LIBS})
target_include_directories(${PROJECT_NAME} PRIVATE ${turnserver_include_dirs})

View File

@ -273,7 +273,7 @@ static int sctp_create_server_listener(tls_listener_relay_server_type* server) {
tls_listen_fd = socket(server->addr.ss.sa_family, SCTP_CLIENT_STREAM_SOCKET_TYPE, SCTP_CLIENT_STREAM_SOCKET_PROTOCOL);
if (tls_listen_fd < 0) {
perror("socket");
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR,"Cannot create SCTP socket listener\n");
return -1;
}