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

[Crash]: IPv4-only server with IPv6 client via TURN crashes the server #9691

Open
MarkoTsovko opened this issue Nov 12, 2021 · 9 comments
Open

[Crash]: IPv4-only server with IPv6 client via TURN crashes the server #9691

MarkoTsovko opened this issue Nov 12, 2021 · 9 comments
Labels

Comments

@MarkoTsovko
Copy link

@MarkoTsovko MarkoTsovko commented Nov 12, 2021

Version of OpenTTD

1.12+

Steps to reproduce

Hello. The crashes started after update 1.12. It all happens by accident, I did not find details about the crash, so I'm writing here.

4 servers work 24 on 7, and somewhere 1 time in 2 days one of servers crash.

Until 1.12 there was no crash.

Crash reason:
Signal: Aborted (6)
Message: NOT_REACHED triggered at line 186 of /__w/OpenTTD/OpenTTD/src/network/core/address.cpp

Upload crash files

[crash.zip](https://github.com/OpenTTD/OpenTTD/files/7529880/crash.zip
crash.log
)

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Nov 12, 2021

Did the game produce a crash.dmp by any chance? Or did your system generate a coredump out of it? That would be incredibly useful. Tnx :)

@MarkoTsovko
Copy link
Author

@MarkoTsovko MarkoTsovko commented Nov 12, 2021

I only found these 2 files. Where i can find coredump?

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Nov 12, 2021

If I can blindly guestimate, this is because you run an IPv4-only stack (so no IPv6 support) .. and when a TURN connection is established with an IPv6 on the client-side, that IPv6 is given to the server, which tries to Resolve() it. This fails because there is no IPv6.
That on its own isn't a real problem, except that I am guessing you have a banlist active. Now when it tries to check if the IPv6 is inside any of the ban-ranges, it fails, as it doesn't understand whether it was an IPv4 or IPv6.

That is a situation we never tested for, so that makes the question:

  • Am I right in the assumption your system doesn't have IPv6 (like, at all, not even a link-local address?)? (ip a will tell you)
  • And am I right in the assumption you have a banlist active?

If both hold true, that would explain this crash report :)

I only found these 2 files. Where i can find coredump?

If you can't find it, it isn't there. It is okay, it would just make it easier to validate the above assumptions :D

@MarkoTsovko
Copy link
Author

@MarkoTsovko MarkoTsovko commented Nov 12, 2021

You are 100% right. I have only IPv4 and active banlist.

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Nov 12, 2021

Tnx for the confirmation :) We will see what we can do to fix this!

Sadly, I do not think there is a workaround for now .. will get back to you if I can come up with one.

@MarkoTsovko
Copy link
Author

@MarkoTsovko MarkoTsovko commented Nov 12, 2021

Fine. Thanks.

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Nov 12, 2021

Please keep this open so we know to fix this :)

@TrueBrain TrueBrain reopened this Nov 12, 2021
@MarkoTsovko
Copy link
Author

@MarkoTsovko MarkoTsovko commented Nov 12, 2021

Sorry.

@TrueBrain TrueBrain changed the title [Crash]: Random crash one of four servers , 1.12+. [Crash]: IPv4-only server with IPv6 client via TURN crashes the server Nov 12, 2021
@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Nov 12, 2021

For the developers: some more detail on what is happening:

NetworkAddress address = NetworkAddress(hostname, NETWORK_DEFAULT_PORT);

resolved(false)

if (!this->IsResolved()) this->GetAddress();

this->Resolve(this->address.ss_family, SOCK_STREAM, AI_ADDRCONFIG, nullptr, ResolveLoopProc);

int e = getaddrinfo(this->hostname.empty() ? nullptr : this->hostname.c_str(), port_name, &hints, &ai);

And if you cannot resolve IPv6 address, that fails, and ss_family is never set. IsInNetmask in turns fails.

Additionally, you cannot load an IPv6 in the banlist either, as that will fail for similar reasons.

@TrueBrain TrueBrain added the bug label Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants