8000 empty listening-ip= does _NOT_ let the system listen on IPv4 and IPv6 · Issue #1294 · coturn/coturn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

empty listening-ip= does _NOT_ let the system listen on IPv4 and IPv6 #1294

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

Closed
computersalat opened this issue Oct 13, 2023 · 7 comments · Fixed by #1336
Closed

empty listening-ip= does _NOT_ let the system listen on IPv4 and IPv6 #1294

computersalat opened this issue Oct 13, 2023 · 7 comments · Fixed by #1336

Comments

@computersalat
Copy link
Contributor
computersalat commented Oct 13, 2023

Hi

in config there is the following comment:

# Listener IP address of relay server. Multiple listeners can be specified.
# If no IP(s) specified in the config file or in the command line options,
# then all IPv4 and IPv6 system IPs will be used for listening.

hence I tried

listening-ip=

with the result, that coturn is only listening on IPv4 addresses

if you want to make it listen on IPv4 as well as on IPv6 you need:

listening-ip=::

You should either update your documentation/comment to point this out or fix your code that empty IP

listening-ip=

will result in listening on any IPv4 and IPv6 address

@eakraly
Copy link
Collaborator
eakraly commented Oct 19, 2023

@computersalat feel free to submit a PR

@computersalat
Copy link
Contributor Author
computersalat commented Dec 1, 2023

@eakraly

sorry I was mistaken.
When you want to make coturn listen on IPv4 as well as on IPv6 you need:

listening-ip= or listening-ip=0.0.0.0
listening-ip=::

then you get:

0: (9364): INFO: Wait for relay ports initialization...
0: (9364): INFO:   relay 0.0.0.0 initialization...
0: (9364): INFO:   relay 0.0.0.0 initialization done
0: (9364): INFO:   relay :: initialization...
0: (9364): INFO:   relay :: initialization done
0: (9364): INFO: Relay ports initialization done
0: (9364): INFO: Total General servers: 2
6: (9365): DEBUG: turn server id=0 created
6: (9365): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:3478
6: (9365): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:5349
6: (9365): INFO: IPv6. TLS/TCP listener opened on : :::3478
6: (9365): INFO: IPv6. TLS/TCP listener opened on : :::5349
6: (9366): DEBUG: turn server id=1 created
6: (9366): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:3478
6: (9366): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:5349
6: (9366): INFO: IPv6. TLS/TCP listener opened on : :::3478
6: (9366): INFO: IPv6. TLS/TCP listener opened on : :::5349
6: (9364): INFO: IPv4. DTLS/UDP listener opened on: 0.0.0.0:3478
6: (9364): INFO: IPv4. DTLS/UDP listener opened on: 0.0.0.0:5349
6: (9364): INFO: IPv6. DTLS/UDP listener opened on: :::3478
6: (9364): INFO: IPv6. DTLS/UDP listener opened on: :::5349

@computersalat
Copy link
Contributor Author
computersalat commented Dec 1, 2023

with

listening-ip=

I get:

0: (9941): INFO: Wait for relay ports initialization...
0: (9941): INFO:   relay 0.0.0.0 initialization...
0: (9941): INFO:   relay 0.0.0.0 initialization done
0: (9941): INFO: Relay ports initialization done
0: (9941): INFO: Total General servers: 2
3: (9942): DEBUG: turn server id=0 created
3: (9942): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:3478
3: (9942): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:5349
3: (9943): DEBUG: turn server id=1 created
3: (9943): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:3478
3: (9941): INFO: IPv4. DTLS/UDP listener opened on: 0.0.0.0:3478
3: (9943): INFO: IPv4. TLS/TCP listener opened on : 0.0.0.0:5349
3: (9941): INFO: IPv4. DTLS/UDP listener opened on: 0.0.0.0:5349

hence only listening on IPv4

@computersalat
Copy link
Contributor Author

with

listening-ip=::

I get:

0: (9990): INFO: Wait for relay ports initialization...
0: (9990): INFO:   relay :: initialization...
0: (9990): INFO:   relay :: initialization done
0: (9990): INFO: Relay ports initialization done
0: (9990): INFO: Total General servers: 2
3: (9993): DEBUG: turn server id=0 created
3: (9993): INFO: IPv6. TLS/TCP listener opened on : :::3478
3: (9993): INFO: IPv6. TLS/TCP listener opened on : :::5349
3: (9994): DEBUG: turn server id=1 created
3: (9994): INFO: IPv6. TLS/TCP listener opened on : :::3478
3: (9994): INFO: IPv6. TLS/TCP listener opened on : :::5349
3: (9990): INFO: IPv6. DTLS/UDP listener opened on: :::3478
3: (9990): INFO: IPv6. DTLS/UDP listener opened on: :::5349

hence only listening on IPv6

@computersalat
Copy link
Contributor Author

@eakraly
here it is: #1336

@eakraly
Copy link
Collaborator
eakraly commented Dec 3, 2023

Hi @computersalat
I appreciate your fix but I think what needs to be done is a fix to make sure that the behavior is consistent.
It is taking the solution into direction that is wrong - documenting the wrong behavior rather than fixing it.
If documenting then we may want to clarify that unless specific IPs are provided then this option must be omitted (--listening-ip= is not the same as not having it at all)

But why not fix it properly?
I expect that 3 following options will result in the same behavior:

  1. --listening-ip= as command line argument
  2. listening-ip= in turnsever.conf
  3. Listening IP not specified at all

And the result in all 3 is that turnserver is listening on all available interfaces

What happens today is that options 1,2 IMHO work incorrectly - when value is not provided the string is '\0' which is interpreted as 0.0.0.0 which results in listening on IPv4 only.

I think

if ((len == 0) || (inet_pton(AF_INET, saddr, &addr->s4.sin_addr) == 1)) {
is the issue - if string length is 0 then the result is 0.0.0.0 which forces IPv4

@computersalat
Copy link
Contributor Author

@eakraly

I fully agree to fix the main cause.
But I am not able to fix it as I don't know C or C++.
Ich just wanted to bring awareness about the problem and how it is possible to work around until it gets a fix.
Anyone else with C/C++ knowledge should kindly step in and provide a fix.
Thank you
Chris

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 a pull request may close this issue.

2 participants
0