Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Modify udp_recvfrom. Raplace recvmsg with WSARecvMsg in windows #1324

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KangLin
Copy link
Contributor

@KangLin KangLin commented Nov 22, 2023

@KangLin KangLin changed the title Windows: Modify udp_recvfrom. Raplace recvmsg with WSARecvMsg Refactor: Modify udp_recvfrom. Raplace recvmsg with WSARecvMsg in windows Nov 22, 2023
@KangLin KangLin force-pushed the noblock branch 4 times, most recently from da57486 to 525eb41 Compare November 23, 2023 03:22
…dows

- Because of getsockopt is not support IPV6_TCLASS in windows.
  it need WSARecvMsg get IPV6_TCLASS. and it must called after bind().
- Because of no recvmsg in windows.  Raplace recvmsg with WSARecvMsg

see:
  - https://learn.microsoft.com/windows/win32/winsock/ipproto-ipv6-socket-options
  - https://learn.microsoft.com/windows/win32/api/mswsock/nc-mswsock-lpfn_wsarecvmsg
@KangLin
Copy link
Contributor Author

KangLin commented Nov 23, 2023

Test environment:

  • Server:

    • IP: 192.168.11.49
    • OS: windows 10
    • Compiler:
      • MSVC
      • MinGW
  • peer:

    • IP: 192.168.11.30
    • OS: ubuntu
  • uclient:

    • IP: 192.168.11.30
    • OS: ubuntu

Test results

Consistent with the projected results

Log

turnutils_peer #1314

l@l:/home/build-coturn-Desktop_Qt_5_12_12_GCC_64bit-Debug/bin$ ./turnutils_peer  -L 192.168.11.30 -v
0: (16559): INFO: 192.168.11.30:3480 start
0: (16559): INFO: 192.168.11.30:3481 start
32: (16559): DEBUG: Received 100 bytes data 192.168.11.30:3480 from 192.168.11.49:56487. total received: 100 bytes
34: (16559): DEBUG: Received 100 bytes data 192.168.11.30:3481 from 192.168.11.49:56436. total received: 100 bytes
153: (16559): DEBUG: Received 100 bytes data 192.168.11.30:3480 from 192.168.11.49:62125. total received: 200 bytes
154: (16559): DEBUG: Received 100 bytes data 192.168.11.30:3481 from 192.168.11.49:50182. total received: 200 bytes

turnutils_uclient

l@l:/home/build-coturn-Desktop_Qt_5_12_12_GCC_64bit-Debug/bin$ ./turnutils_uclient -e 192.168.11.30 -n 1 192.168.11.49
0: (16581): INFO: Total connect time is 1
0: (16581): INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: (16581): INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: (16581): INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: (16581): INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: (16581): INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
4: (16581): INFO: start_mclient: tot_send_msgs=2, tot_recv_msgs=2
4: (16581): INFO: start_mclient: tot_send_bytes ~ 200, tot_recv_bytes ~ 200
4: (16581): INFO: Total transmit time is 4
4: (16581): INFO: Total lost packets 0 (0.000000%), total send dropped 0 (0.000000%)
4: (16581): INFO: Average round trip delay 0.000000 ms; min = 0 ms, max = 0 ms
4: (16581): INFO: Average jitter 0.000000 ms; min = 4294967295 ms, max = 0 ms

turnserver

MSVC

D:\coturn\build> turnserver.exe -v
0: DEBUG: DomainForestName is NULL
0: INFO: log file opened: turn_40444_2023-11-23.log
0: DEBUG: DomainNameDns is NULL
0: DEBUG: DomainNameFlat: WORKGROUP
0: INFO: System cpu num is 6
0: INFO: System enable num is 63
0: WARNING: Cannot find config file: turnserver.conf. Default and command-line settings will be used.
0: INFO: Coturn Version Coturn-4.6.2 'Gorst'
0: INFO: Max number of open files/sockets allowed for this process: 512
0: INFO: Due to the open files/sockets limitation, max supported number of TURN Sessions possible is: 500 (approximately)
0: INFO:

==== Show him the instruments, Practical Frost: ====

0: INFO: OpenSSL compile-time version: OpenSSL 3.1.2 1 Aug 2023 (0x30100020)
0: INFO: TLS 1.3 supported
0: INFO: DTLS 1.2 supported
0: INFO: TURN/STUN ALPN supported
0: INFO: Third-party authorization (oAuth) supported
0: INFO: GCM (AEAD) supported
0: INFO: SQLite supported, default database location is TURNDB
0: INFO: Redis supported
0: INFO: PostgreSQL supported
0: INFO: MySQL is not supported
0: INFO: MongoDB supported
0: INFO: Default Net Engine version: 2 (UDP thread per network endpoint)
0: INFO: Domain name: WORKGROUP
0: INFO: Default realm: WORKGROUP
0: ERROR: CONFIG: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password!
0: WARNING: cannot find certificate file: turn_server_cert.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly
0: WARNING: cannot find private key file: turn_server_pkey.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because private key file is not set properly
0: INFO: Certificate file found: D:\source\coturn\build\src\apps\relay/turn_server_cert.pem
0: INFO: Private key file found: D:\source\coturn\build\src\apps\relay/turn_server_pkey.pem
0: WARNING: NO EXPLICIT LISTENER ADDRESS(ES) ARE CONFIGURED
0: INFO: ===========Discovering listener addresses: =========
0: INFO: Listener address to use: 192.168.11.49
0: INFO: Listener address to use: ::1
0: INFO: Listener address to use: 127.0.0.1
0: INFO: =====================================================
0: INFO: Total: 1 'real' addresses discovered
0: INFO: =====================================================
0: WARNING: NO EXPLICIT RELAY ADDRESS(ES) ARE CONFIGURED
0: INFO: ===========Discovering relay addresses: =============
0: INFO: Relay address to use: 192.168.11.49
0: INFO: Relay address to use: ::1
0: INFO: =====================================================
0: INFO: Total: 2 relay addresses discovered
0: INFO: =====================================================
0: INFO: IO method: win32
0: WARNING: IPv6: On this platform, I am using alternative behavior of TTL (HOPLIMIT) according to RFC 6156.
0: INFO: Wait for relay ports initialization...
0: INFO:   relay 192.168.11.49 initialization...
0: INFO:   relay 192.168.11.49 initialization done
0: INFO:   relay ::1 initialization...
0: INFO:   relay ::1 initialization done
0: INFO: Relay ports initialization done
0: INFO: Total General servers: 6
0: DEBUG: turn server id=0 created
0: DEBUG: turn server id=4 created
0: DEBUG: turn server id=3 created
0: DEBUG: turn server id=1 created
0: DEBUG: turn server id=2 created
0: DEBUG: turn server id=5 created
0: DEBUG: turn server id=128 created
0: DEBUG: turn server id=129 created
0: DEBUG: turn server id=130 created
0: DEBUG: turn server id=131 created
0: DEBUG: turn server id=132 created
0: DEBUG: turn server id=133 created
0: INFO: IPv4. UDP listener opened on: 192.168.11.49:3478
0: INFO: IPv4. UDP listener opened on: 192.168.11.49:3479
0: WARNING: Because getsockopt is not support IPV6_TCLASS in windows. it must use WSARecvMsg. so return TOS_DEFAULT. Get TCLASS on fd[1228] fail. error code: 10042
0: INFO: IPv6. UDP listener opened on: ::1:3478
0: WARNING: Because getsockopt is not support IPV6_TCLASS in windows. it must use WSARecvMsg. so return TOS_DEFAULT. Get TCLASS on fd[1244] fail. error code: 10042
0: INFO: IPv6. UDP listener opened on: ::1:3479
0: INFO: IPv4. UDP listener opened on: 127.0.0.1:3478
0: INFO: IPv4. UDP listener opened on: 127.0.0.1:3479
0: INFO: IPv4. TCP listener opened on : 192.168.11.49:3478
0: INFO: IPv4. TCP listener opened on : 192.168.11.49:3479
0: INFO: IPv6. TCP listener opened on : ::1:3478
0: INFO: IPv6. TCP listener opened on : ::1:3479
0: INFO: IPv4. TCP listener opened on : 127.0.0.1:3478
0: INFO: IPv4. TCP listener opened on : 127.0.0.1:3479
0: INFO: Total UDP servers: 6
0: INFO: Total auth threads: 4
5: INFO: turnserver compiled without prometheus support
5: DEBUG: WSARecvMsg len: 60; ttl: 0000002F; tos: 00000022
5: INFO: IPv4. Local relay addr: 192.168.11.49:62124
5: INFO: IPv4. Local reserved relay addr: 192.168.11.49:62125
5: INFO: session 128000000000000001: new, realm=<WORKGROUP>, username=<>, lifetime=777
5: INFO: session 128000000000000001: realm <WORKGROUP> user <>: incoming packet ALLOCATE processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 36; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000001: refreshed, realm=<WORKGROUP>, username=<>, lifetime=777
5: INFO: session 128000000000000001: realm <WORKGROUP> user <>: incoming packet REFRESH processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 56; ttl: 0000002F; tos: 00000022
5: INFO: IPv4. Local relay addr (RTCP): 192.168.11.49:62125
5: INFO: session 128000000000000002: new, realm=<WORKGROUP>, username=<>, lifetime=777
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet ALLOCATE processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 36; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: refreshed, realm=<WORKGROUP>, username=<>, lifetime=777
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet REFRESH processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 60; ttl: 0000002F; tos: 00000022
5: INFO: IPv4. Local relay addr: 192.168.11.49:50182
5: INFO: IPv4. Local reserved relay addr: 192.168.11.49:50183
5: INFO: session 128000000000000003: new, realm=<WORKGROUP>, username=<>, lifetime=777
5: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet ALLOCATE processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 36; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000003: refreshed, realm=<WORKGROUP>, username=<>, lifetime=777
5: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet REFRESH processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 48; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 48; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 48; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 48; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 48; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000003: peer 192.168.11.30:3481 lifetime updated: 600
5: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 36; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: refreshed, realm=<WORKGROUP>, username=<>, lifetime=600
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet REFRESH processed, success
5: DEBUG: WSARecvMsg len: 40; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 300
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CREATE_PERMISSION processed, success
5: DEBUG: WSARecvMsg len: 48; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
5: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND processed, success
5: ERROR: WSARecvMsg fail:10035
5: DEBUG: WSARecvMsg len: 36; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000003: refreshed, realm=<WORKGROUP>, username=<>, lifetime=600
5: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet REFRESH processed, success
5: DEBUG: WSARecvMsg len: 40; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000003: peer 192.168.11.30:3481 lifetime updated: 300
5: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet CREATE_PERMISSION processed, success
5: DEBUG: WSARecvMsg len: 48; ttl: 0000002F; tos: 00000022
5: INFO: session 128000000000000003: peer 192.168.11.30:3481 lifetime updated: 600
5: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND processed, success
5: ERROR: WSARecvMsg fail:10035
8: DEBUG: WSARecvMsg len: 104; ttl: 0000002F; tos: 00000022
8: ERROR: WSARecvMsg fail:10035
8: DEBUG: WSARecvMsg len: 100; ttl: 00000040; tos: 00000000
8: ERROR: WSARecvMsg fail:10035
8: DEBUG: WSARecvMsg len: 104; ttl: 0000002F; tos: 00000022
8: ERROR: WSARecvMsg fail:10035
8: DEBUG: WSARecvMsg len: 100; ttl: 00000040; tos: 00000000
8: ERROR: WSARecvMsg fail:10035
8: DEBUG: WSARecvMsg len: 36; ttl: 0000002F; tos: 00000022
8: INFO: session 128000000000000002: refreshed, realm=<WORKGROUP>, username=<>, lifetime=0
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet REFRESH processed, success
8: ERROR: WSARecvMsg fail:10035
8: ERROR: WSARecvMsg fail:10054
8: ERROR: WSARecvMsg fail:10035
8: DEBUG: WSARecvMsg len: 36; ttl: 0000002F; tos: 00000022
8: INFO: session 128000000000000003: refreshed, realm=<WORKGROUP>, username=<>, lifetime=0
8: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet REFRESH processed, success
8: ERROR: WSARecvMsg fail:10035
8: ERROR: WSARecvMsg fail:10054
8: ERROR: WSARecvMsg fail:10035
9: INFO: session 128000000000000002: usage: realm=<WORKGROUP>, username=<>, rp=11, rb=548, sp=11, sb=680
9: INFO: session 128000000000000002: peer usage: realm=<WORKGROUP>, username=<>, rp=1, rb=100, sp=1, sb=100
9: INFO: session 128000000000000002: closed (2nd stage), user <> realm <WORKGROUP> origin <>, local 192.168.11.49:3478, remote 192.168.11.30:46737, reason: allocation timeout
9: INFO: session 128000000000000002: delete: realm=<WORKGROUP>, username=<>
9: INFO: session 128000000000000002: peer 192.168.11.30:3481 deleted
9: INFO: session 128000000000000003: usage: realm=<WORKGROUP>, username=<>, rp=8, rb=408, sp=8, sb=536
9: INFO: session 128000000000000003: peer usage: realm=<WORKGROUP>, username=<>, rp=1, rb=100, sp=1, sb=100
9: INFO: session 128000000000000003: closed (2nd stage), user <> realm <WORKGROUP> origin <>, local 192.168.11.49:3478, remote 192.168.11.30:60164, reason: allocation timeout
9: INFO: session 128000000000000003: delete: realm=<WORKGROUP>, username=<>
9: INFO: session 128000000000000003: peer 192.168.11.30:3481 deleted

mingw:

M@DESKTOP-LMRLI0C MINGW64 /d/source/coturn/build_mingw/bin
$ ./turnserver.exe -v
0: DEBUG: DomainForestName is NULL
0: INFO: log file opened: turn_30364_.log
0: DEBUG: DomainNameDns is NULL
0: DEBUG: DomainNameFlat: WORKGROUP
0: INFO: System cpu num is 6
0: INFO: System enable num is 63
0: WARNING: Cannot find config file: turnserver.conf. Default and command-line settings will be used
.
0: INFO: Coturn Version Coturn-4.6.2 'Gorst'
0: INFO: Max number of open files/sockets allowed for this process: 512
0: INFO: Due to the open files/sockets limitation, max supported number of TURN Sessions possible is
: 500 (approximately)
0: INFO:

==== Show him the instruments, Practical Frost: ====

0: INFO: OpenSSL compile-time version: OpenSSL 3.1.4 24 Oct 2023 (0x30100040)
0: INFO: TLS 1.3 supported
0: INFO: DTLS 1.2 supported
0: INFO: TURN/STUN ALPN supported
0: INFO: Third-party authorization (oAuth) supported
0: INFO: GCM (AEAD) supported
0: INFO: SQLite supported, default database location is TURNDB
0: INFO: Redis is not supported
0: INFO: PostgreSQL is not supported
0: INFO: MySQL is not supported
0: INFO: MongoDB is not supported
0: INFO: Default Net Engine version: 2 (UDP thread per network endpoint)
0: INFO: Domain name: WORKGROUP
0: INFO: Default realm: WORKGROUP
0: ERROR: CONFIG: Empty cli-password, and so telnet cli interface is disabled! Please set a non empt
y cli-password!
0: WARNING: cannot find certificate file: turn_server_cert.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly
0: WARNING: cannot find private key file: turn_server_pkey.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because private key file is not set properly
0: INFO: Certificate file found: D:\source\coturn\build_mingw\bin/turn_server_cert.pem
0: INFO: Private key file found: D:\source\coturn\build_mingw\bin/turn_server_pkey.pem
0: WARNING: NO EXPLICIT LISTENER ADDRESS(ES) ARE CONFIGURED
0: INFO: ===========Discovering listener addresses: =========
0: INFO: Listener address to use: 192.168.11.49
0: INFO: Listener address to use: ::1
0: INFO: Listener address to use: 127.0.0.1
0: INFO: =====================================================
0: INFO: Total: 1 'real' addresses discovered
0: INFO: =====================================================
0: WARNING: NO EXPLICIT RELAY ADDRESS(ES) ARE CONFIGURED
0: INFO: ===========Discovering relay addresses: =============
0: INFO: Relay address to use: 192.168.11.49
0: INFO: Relay address to use: ::1
0: INFO: =====================================================
0: INFO: Total: 2 relay addresses discovered
1: INFO: =====================================================
1: INFO: IO method: win32
1: WARNING: On this platform, I am using alternative behavior of TTL/TOS according to RFC 5766.
1: WARNING: IPv6: On this platform, I am using alternative behavior of TTL (HOPLIMIT) according to R
FC 6156.
1: INFO: Wait for relay ports initialization...
1: INFO:   relay 192.168.11.49 initialization...
1: INFO:   relay 192.168.11.49 initialization done
1: INFO:   relay ::1 initialization...
1: INFO:   relay ::1 initialization done
1: INFO: Relay ports initialization done
1: INFO: Total General servers: 6
1: DEBUG: turn server id=3 created
1: DEBUG: turn server id=5 created
1: DEBUG: turn server id=0 created
1: DEBUG: turn server id=2 created
1: DEBUG: turn server id=1 created
1: DEBUG: turn server id=4 created
1: DEBUG: turn server id=128 created
1: DEBUG: turn server id=129 created
1: DEBUG: turn server id=130 created
1: DEBUG: turn server id=131 created
1: DEBUG: turn server id=132 created
1: DEBUG: turn server id=133 created
1: INFO: IPv4. UDP listener opened on: 192.168.11.49:3478
1: INFO: IPv4. UDP listener opened on: 192.168.11.49:3479
1: ERROR: Get TCLASS on fd[868] fail. error code: 10042
1: INFO: IPv6. UDP listener opened on: ::1:3478
1: ERROR: Get TCLASS on fd[876] fail. error code: 10042
1: INFO: IPv6. UDP listener opened on: ::1:3479
1: INFO: IPv4. UDP listener opened on: 127.0.0.1:3478
1: INFO: IPv4. UDP listener opened on: 127.0.0.1:3479
1: INFO: IPv4. TCP listener opened on : 192.168.11.49:3478
1: INFO: IPv4. TCP listener opened on : 192.168.11.49:3479
1: INFO: IPv6. TCP listener opened on : ::1:3478
1: INFO: IPv6. TCP listener opened on : ::1:3479
1: INFO: IPv4. TCP listener opened on : 127.0.0.1:3478
1: INFO: IPv4. TCP listener opened on : 127.0.0.1:3479
1: INFO: Total UDP servers: 6
1: INFO: Total auth threads: 4
1: INFO: turnserver compiled without prometheus support
8: INFO: IPv4. Local relay addr: 192.168.11.49:56486
8: INFO: IPv4. Local reserved relay addr: 192.168.11.49:56487
8: INFO: session 128000000000000001: new, realm=<WORKGROUP>, username=<>, lifetime=777
8: INFO: session 128000000000000001: realm <WORKGROUP> user <>: incoming packet ALLOCATE processed,
success
8: INFO: session 128000000000000001: refreshed, realm=<WORKGROUP>, username=<>, lifetime=777
8: INFO: session 128000000000000001: realm <WORKGROUP> user <>: incoming packet REFRESH processed, s
uccess
8: INFO: IPv4. Local relay addr (RTCP): 192.168.11.49:56487
8: INFO: session 128000000000000002: new, realm=<WORKGROUP>, username=<>, lifetime=777
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet ALLOCATE processed,
success
8: INFO: session 128000000000000002: refreshed, realm=<WORKGROUP>, username=<>, lifetime=777
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet REFRESH processed, s
uccess
8: INFO: IPv4. Local relay addr: 192.168.11.49:56436
8: INFO: IPv4. Local reserved relay addr: 192.168.11.49:56437
8: INFO: session 128000000000000003: new, realm=<WORKGROUP>, username=<>, lifetime=777
8: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet ALLOCATE processed,
success
8: INFO: session 128000000000000003: refreshed, realm=<WORKGROUP>, username=<>, lifetime=777
8: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet REFRESH processed, s
uccess
8: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND process
ed, success
8: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND process
ed, success
8: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND process
ed, success
8: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND process
ed, success
8: INFO: session 128000000000000003: peer 192.168.11.30:3481 lifetime updated: 600
8: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND process
ed, success
8: INFO: session 128000000000000002: refreshed, realm=<WORKGROUP>, username=<>, lifetime=600
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet REFRESH processed, s
uccess
8: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 300
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CREATE_PERMISSION pr
ocessed, success
8: INFO: session 128000000000000002: peer 192.168.11.30:3481 lifetime updated: 600
8: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND process
ed, success
8: INFO: session 128000000000000003: refreshed, realm=<WORKGROUP>, username=<>, lifetime=600
8: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet REFRESH processed, s
uccess
8: INFO: session 128000000000000003: peer 192.168.11.30:3481 lifetime updated: 300
8: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet CREATE_PERMISSION pr
ocessed, success
8: INFO: session 128000000000000003: peer 192.168.11.30:3481 lifetime updated: 600
8: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet CHANNEL_BIND process
ed, success
12: INFO: session 128000000000000002: refreshed, realm=<WORKGROUP>, username=<>, lifetime=0
12: INFO: session 128000000000000002: realm <WORKGROUP> user <>: incoming packet REFRESH processed,
success
12: INFO: IPv4. UDP listener opened on : 192.168.11.49:3478
12: INFO: session 128000000000000003: refreshed, realm=<WORKGROUP>, username=<>, lifetime=0
12: INFO: session 128000000000000003: realm <WORKGROUP> user <>: incoming packet REFRESH processed,
success
12: INFO: IPv4. UDP listener opened on : 192.168.11.49:3478
13: INFO: session 128000000000000002: usage: realm=<WORKGROUP>, username=<>, rp=11, rb=548, sp=11, s
b=680
13: INFO: session 128000000000000002: peer usage: realm=<WORKGROUP>, username=<>, rp=1, rb=100, sp=1
, sb=100
13: INFO: session 128000000000000002: closed (2nd stage), user <> realm <WORKGROUP> origin <>, local
 192.168.11.49:3478, remote 192.168.11.30:38340, reason: allocation timeout
13: INFO: session 128000000000000002: delete: realm=<WORKGROUP>, username=<>
13: INFO: session 128000000000000002: peer 192.168.11.30:3481 deleted
13: INFO: session 128000000000000003: usage: realm=<WORKGROUP>, username=<>, rp=8, rb=408, sp=8, sb=
536
13: INFO: session 128000000000000003: peer usage: realm=<WORKGROUP>, username=<>, rp=1, rb=100, sp=1
, sb=100
13: INFO: session 128000000000000003: closed (2nd stage), user <> realm <WORKGROUP> origin <>, local
 192.168.11.49:3478, remote 192.168.11.30:41642, reason: allocation timeout
13: INFO: session 128000000000000003: delete: realm=<WORKGROUP>, username=<>
13: INFO: session 128000000000000003: peer 192.168.11.30:3481 deleted

@KangLin
Copy link
Contributor Author

KangLin commented Nov 23, 2023

Test environment:

  • Server:
    • IP: 192.168.11.30
    • OS: Ubuntu
  • peer:
    • IP: 192.168.11.49
    • OS: Windows 10
  • uclient:
    • IP: 192.168.11.49
    • OS: Windows 10

Test results

Consistent with the projected results

Log

turnutils_peer #1314

D:\source\coturn\build\bin\Debug>turnutils_peer.exe -L 192.168.11.49 -v
0: INFO: 192.168.11.49:3480 start
0: INFO: 192.168.11.49:3481 start
62: DEBUG: Received 100 bytes data 192.168.11.49:3481 from 192.168.11.30:53746. total received: 100 bytes
63: DEBUG: Received 100 bytes data 192.168.11.49:3480 from 192.168.11.30:51979. total received: 100 bytes

turnutils_uclient

D:\source\coturn\build\bin\Debug>turnutils_uclient.exe -e 192.168.11.49 -n 1 192.168.11.30
0: INFO: Total connect time is 2
0: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
0: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
0: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
1: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
2: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
3: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
4: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
5: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
5: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
5: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
5: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
5: INFO: start_mclient: msz=2, tot_send_msgs=0, tot_recv_msgs=0, tot_send_bytes ~ 0, tot_recv_bytes ~ 0
5: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
5: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
5: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
5: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
6: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
6: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
6: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
6: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
6: INFO: start_mclient: msz=2, tot_send_msgs=1, tot_recv_msgs=1, tot_send_bytes ~ 100, tot_recv_bytes ~ 100
6: INFO: start_mclient: tot_send_msgs=2, tot_recv_msgs=2
6: INFO: start_mclient: tot_send_bytes ~ 200, tot_recv_bytes ~ 200
6: INFO: Total transmit time is 6
6: INFO: Total lost packets 0 (0.000000%), total send dropped 0 (0.000000%)
6: INFO: Average round trip delay 0.000000 ms; min = 0 ms, max = 0 ms
6: INFO: Average jitter 0.000000 ms; min = 4294967295 ms, max = 0 ms

turnserver

12:30:17: Debugging /home/build-coturn-Desktop_Qt_5_12_12_GCC_64bit-Debug/bin/turnserver -v  ...
0: (18618): INFO: System cpu num is 4
0: (18618): INFO: log file opened: /var/tmp/turn_18618_2023-11-23.log
0: (18618): INFO: System enable num is 4
0: (18618): WARNING: Cannot find config file: turnserver.conf. Default and command-line settings will be used.
0: (18618): INFO: Coturn Version Coturn-4.6.2 'Gorst'
0: (18618): INFO: Max number of open files/sockets allowed for this process: 1048576
0: (18618): INFO: Due to the open files/sockets limitation, max supported number of TURN Sessions possible is: 524000 (approximately)
0: (18618): INFO: 

==== Show him the instruments, Practical Frost: ====

0: (18618): INFO: OpenSSL compile-time version: OpenSSL 3.0.2 15 Mar 2022 (0x30000020)
0: (18618): INFO: TLS 1.3 supported
0: (18618): INFO: DTLS 1.2 supported
0: (18618): INFO: TURN/STUN ALPN supported
0: (18618): INFO: Third-party authorization (oAuth) supported
0: (18618): INFO: GCM (AEAD) supported
0: (18618): INFO: SQLite supported, default database location is TURNDB
0: (18618): INFO: Redis is not supported
0: (18618): INFO: PostgreSQL is not supported
0: (18618): INFO: MySQL is not supported
0: (18618): INFO: MongoDB is not supported
0: (18618): INFO: Default Net Engine version: 3 (UDP thread per CPU core)
0: (18618): INFO: Domain name: 
0: (18618): INFO: Default realm: 
0: (18618): ERROR: CONFIG: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password!
0: (18618): WARNING: cannot find certificate file: turn_server_cert.pem (1)
0: (18618): WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly
0: (18618): WARNING: cannot find private key file: turn_server_pkey.pem (1)
0: (18618): WARNING: cannot start TLS and DTLS listeners because private key file is not set properly
0: (18618): INFO: Certificate file found: /home/build-coturn-Desktop_Qt_5_12_12_GCC_64bit-Debug/bin/turn_server_cert.pem
0: (18618): INFO: Private key file found: /home/build-coturn-Desktop_Qt_5_12_12_GCC_64bit-Debug/bin/turn_server_pkey.pem
0: (18618): WARNING: NO EXPLICIT LISTENER ADDRESS(ES) ARE CONFIGURED
0: (18618): INFO: ===========Discovering listener addresses: =========
0: (18618): INFO: Listener address to use: 127.0.0.1
0: (18618): INFO: Listener address to use: 192.168.11.30
0: (18618): INFO: Listener address to use: 10.45.220.1
0: (18618): INFO: Listener address to use: ::1
0: (18618): INFO: Listener address to use: fd42:c619:14a2:60ed::1
0: (18618): INFO: =====================================================
0: (18618): INFO: Total: 3 'real' addresses discovered
0: (18618): INFO: =====================================================
0: (18618): WARNING: NO EXPLICIT RELAY ADDRESS(ES) ARE CONFIGURED
0: (18618): INFO: ===========Discovering relay addresses: =============
0: (18618): INFO: Relay address to use: 192.168.11.30
0: (18618): INFO: Relay address to use: 10.45.220.1
0: (18618): INFO: Relay address to use: fd42:c619:14a2:60ed::1
0: (18618): INFO: =====================================================
0: (18618): INFO: Total: 3 relay addresses discovered
0: (18618): INFO: =====================================================
0: (18618): WARNING: Cannot create pid file: /var/run/turnserver.pid
0: (18618): INFO: pid file created: /var/tmp/turnserver.pid
0: (18618): INFO: IO method: epoll (with changelist)
0: (18618): INFO: Wait for relay ports initialization...
0: (18618): INFO:   relay 192.168.11.30 initialization...
0: (18618): INFO:   relay 192.168.11.30 initialization done
0: (18618): INFO:   relay 10.45.220.1 initialization...
0: (18618): INFO:   relay 10.45.220.1 initialization done
0: (18618): INFO:   relay fd42:c619:14a2:60ed::1 initialization...
0: (18618): INFO:   relay fd42:c619:14a2:60ed::1 initialization done
0: (18618): INFO: Relay ports initialization done
0: (18621): DEBUG: turn server id=0 created
0: (18621): INFO: IPv4. TCP listener opened on : 127.0.0.1:3478
0: (18621): INFO: IPv4. TCP listener opened on : 127.0.0.1:3479
0: (18621): INFO: IPv4. TCP listener opened on : 192.168.11.30:3478
0: (18621): INFO: IPv4. TCP listener opened on : 192.168.11.30:3479
0: (18621): INFO: IPv4. TCP listener opened on : 10.45.220.1:3478
0: (18621): INFO: IPv4. TCP listener opened on : 10.45.220.1:3479
0: (18621): INFO: IPv6. TCP listener opened on : ::1:3478
0: (18621): INFO: IPv6. TCP listener opened on : ::1:3479
0: (18621): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3478
0: (18622): DEBUG: turn server id=1 created
0: (18621): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3479
0: (18622): INFO: IPv4. TCP listener opened on : 127.0.0.1:3478
0: (18622): INFO: IPv4. TCP listener opened on : 127.0.0.1:3479
0: (18622): INFO: IPv4. TCP listener opened on : 192.168.11.30:3478
0: (18622): INFO: IPv4. TCP listener opened on : 192.168.11.30:3479
0: (18622): INFO: IPv4. TCP listener opened on : 10.45.220.1:3478
0: (18622): INFO: IPv4. TCP listener opened on : 10.45.220.1:3479
0: (18622): INFO: IPv6. TCP listener opened on : ::1:3478
0: (18622): INFO: IPv6. TCP listener opened on : ::1:3479
0: (18622): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3478
0: (18622): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3479
0: (18623): DEBUG: turn server id=2 created
0: (18623): INFO: IPv4. TCP listener opened on : 127.0.0.1:3478
0: (18623): INFO: IPv4. TCP listener opened on : 127.0.0.1:3479
0: (18623): INFO: IPv4. TCP listener opened on : 192.168.11.30:3478
0: (18623): INFO: IPv4. TCP listener opened on : 192.168.11.30:3479
0: (18623): INFO: IPv4. TCP listener opened on : 10.45.220.1:3478
0: (18618): INFO: Total General servers: 4
0: (18623): INFO: IPv4. TCP listener opened on : 10.45.220.1:3479
0: (18623): INFO: IPv6. TCP listener opened on : ::1:3478
0: (18623): INFO: IPv6. TCP listener opened on : ::1:3479
0: (18623): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3478
0: (18624): DEBUG: turn server id=3 created
0: (18623): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3479
0: (18624): INFO: IPv4. TCP listener opened on : 127.0.0.1:3478
0: (18618): INFO: IPv4. UDP listener opened on: 127.0.0.1:3478
0: (18624): INFO: IPv4. TCP listener opened on : 127.0.0.1:3479
0: (18624): INFO: IPv4. TCP listener opened on : 192.168.11.30:3478
0: (18624): INFO: IPv4. TCP listener opened on : 192.168.11.30:3479
0: (18624): INFO: IPv4. TCP listener opened on : 10.45.220.1:3478
0: (18624): INFO: IPv4. TCP listener opened on : 10.45.220.1:3479
0: (18618): INFO: IPv4. UDP listener opened on: 127.0.0.1:3479
0: (18624): INFO: IPv6. TCP listener opened on : ::1:3478
0: (18624): INFO: IPv6. TCP listener opened on : ::1:3479
0: (18624): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3478
0: (18624): INFO: IPv6. TCP listener opened on : fd42:c619:14a2:60ed::1:3479
0: (18618): INFO: IPv4. UDP listener opened on: 192.168.11.30:3478
0: (18618): INFO: IPv4. UDP listener opened on: 192.168.11.30:3479
0: (18618): INFO: IPv4. UDP listener opened on: 10.45.220.1:3478
0: (18618): INFO: IPv4. UDP listener opened on: 10.45.220.1:3479
0: (18618): INFO: IPv6. UDP listener opened on: ::1:3478
0: (18618): INFO: IPv6. UDP listener opened on: ::1:3479
0: (18618): INFO: IPv6. UDP listener opened on: fd42:c619:14a2:60ed::1:3478
0: (18618): INFO: IPv6. UDP listener opened on: fd42:c619:14a2:60ed::1:3479
0: (18618): INFO: Total auth threads: 3
0: (18618): INFO: turnserver compiled without prometheus support
125: (18621): INFO: IPv4. Local relay addr: 192.168.11.30:51978
125: (18621): INFO: IPv4. Local reserved relay addr: 192.168.11.30:51979
125: (18621): INFO: session 000000000000000001: new, realm=<>, username=<>, lifetime=777
125: (18621): INFO: session 000000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
125: (18621): INFO: session 000000000000000001: refreshed, realm=<>, username=<>, lifetime=777
125: (18621): INFO: session 000000000000000001: realm <> user <>: incoming packet REFRESH processed, success
126: (18623): INFO: IPv4. Local relay addr (RTCP): 192.168.11.30:51979
126: (18623): INFO: session 002000000000000001: new, realm=<>, username=<>, lifetime=777
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
126: (18623): INFO: session 002000000000000001: refreshed, realm=<>, username=<>, lifetime=777
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet REFRESH processed, success
126: (18624): INFO: IPv4. Local relay addr: 192.168.11.30:53746
126: (18624): INFO: IPv4. Local reserved relay addr: 192.168.11.30:53747
126: (18624): INFO: session 003000000000000001: new, realm=<>, username=<>, lifetime=777
126: (18624): INFO: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
126: (18624): INFO: session 003000000000000001: refreshed, realm=<>, username=<>, lifetime=777
126: (18624): INFO: session 003000000000000001: realm <> user <>: incoming packet REFRESH processed, success
126: (18623): INFO: session 002000000000000001: peer 192.168.11.49:3481 lifetime updated: 600
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet CHANNEL_BIND processed, success
126: (18623): INFO: session 002000000000000001: peer 192.168.11.49:3481 lifetime updated: 600
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet CHANNEL_BIND processed, success
126: (18623): INFO: session 002000000000000001: peer 192.168.11.49:3481 lifetime updated: 600
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet CHANNEL_BIND processed, success
126: (18623): INFO: session 002000000000000001: peer 192.168.11.49:3481 lifetime updated: 600
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet CHANNEL_BIND processed, success
126: (18624): INFO: session 003000000000000001: peer 192.168.11.49:3481 lifetime updated: 600
126: (18624): INFO: session 003000000000000001: realm <> user <>: incoming packet CHANNEL_BIND processed, success
126: (18623): INFO: session 002000000000000001: refreshed, realm=<>, username=<>, lifetime=600
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet REFRESH processed, success
126: (18623): INFO: session 002000000000000001: peer 192.168.11.49:3481 lifetime updated: 300
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet CREATE_PERMISSION processed, success
126: (18623): INFO: session 002000000000000001: peer 192.168.11.49:3481 lifetime updated: 600
126: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet CHANNEL_BIND processed, success
126: (18624): INFO: session 003000000000000001: refreshed, realm=<>, username=<>, lifetime=600
126: (18624): INFO: session 003000000000000001: realm <> user <>: incoming packet REFRESH processed, success
126: (18624): INFO: session 003000000000000001: peer 192.168.11.49:3481 lifetime updated: 300
126: (18624): INFO: session 003000000000000001: realm <> user <>: incoming packet CREATE_PERMISSION processed, success
126: (18624): INFO: session 003000000000000001: peer 192.168.11.49:3481 lifetime updated: 600
126: (18624): INFO: session 003000000000000001: realm <> user <>: incoming packet CHANNEL_BIND processed, success
132: (18623): INFO: session 002000000000000001: refreshed, realm=<>, username=<>, lifetime=0
132: (18624): INFO: session 003000000000000001: refreshed, realm=<>, username=<>, lifetime=0
132: (18623): INFO: session 002000000000000001: realm <> user <>: incoming packet REFRESH processed, success
132: (18624): INFO: session 003000000000000001: realm <> user <>: incoming packet REFRESH processed, success
133: (18623): INFO: session 002000000000000001: usage: realm=<>, username=<>, rp=11, rb=548, sp=11, sb=680
133: (18623): INFO: session 002000000000000001: peer usage: realm=<>, username=<>, rp=1, rb=100, sp=1, sb=100
133: (18623): INFO: session 002000000000000001: closed (2nd stage), user <> realm <> origin <>, local 192.168.11.30:3478, remote 192.168.11.49:54057, reason: allocation timeout
133: (18623): INFO: session 002000000000000001: delete: realm=<>, username=<>
133: (18623): INFO: session 002000000000000001: peer 192.168.11.49:3481 deleted
133: (18624): INFO: session 003000000000000001: 

@@ -387,8 +374,23 @@ int get_raw_socket_tos(evutil_socket_t fd, int family) {
#else
socklen_t slen = (socklen_t)sizeof(tos);
if (getsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &tos, &slen) < 0) {
perror("get TCLASS on socket");
return -1;
#if defined(_MSC_VER)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be checking defined(WINDOWS) like is done in other places?

@@ -93,7 +93,8 @@ static int udp_create_server_socket(server_type *server, const char *ifname, con
if (addr_bind(udp_fd, server_addr, 1, 1, UDP_SOCKET) < 0)
return -1;

socket_set_nonblocking(udp_fd);
if (evutil_make_socket_nonblocking(udp_fd))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

braces please

@@ -467,28 +467,22 @@ static int create_new_connected_udp_socket(dtls_listener_relay_server_type *serv

evutil_socket_t udp_fd = socket(s->local_addr.ss.sa_family, CLIENT_DGRAM_SOCKET_TYPE, CLIENT_DGRAM_SOCKET_PROTOCOL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check that s is valid to dereference before using operator->

if (!ret) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Cannot allocate new socket structure\n", __FUNCTION__);
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot allocate new ioa_socket\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to continue log the function name, as well as the file and line number.

Additionally, can the error code explaining the allocation failure be logged?

@@ -789,6 +783,9 @@ static int create_server_socket(dtls_listener_relay_server_type *server, int rep
}
}

if (evutil_make_socket_nonblocking(udp_listen_fd))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

braces please

ret = (ioa_socket *)calloc(sizeof(ioa_socket), 1);

ret->magic = SOCKET_MAGIC;
ret = create_ioa_socket_from_fd(e, fd, NULL, st, sat, NULL, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare and define on same line

@@ -1294,10 +1296,28 @@ ioa_socket_handle create_ioa_socket_from_fd(ioa_engine_handle e, ioa_socket_raw
}

ret = (ioa_socket *)calloc(sizeof(ioa_socket), 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare and define on same line

recv_tos = *((recv_tos_t *)WSA_CMSG_DATA(cmsg));
break;
#endif
#if defined(IP_RECVERR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would cause these various defines to be defined or not defined?

Having some documentation in the code explaining that would be helpful.

TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "WSARecvMsg len: %d; ttl: %08X; tos: %08X\n", bytes_received, recv_ttl,
recv_tos);

#elif !defined(CMSG_SPACE)
do {
len = recvfrom(fd, buffer, buf_size, flags, (struct sockaddr *)orig_addr, (socklen_t *)&slen);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what prevents this from looping forever?

@KangLin
Copy link
Contributor Author

KangLin commented Jan 20, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants