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

Don't use PONG ports #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bundabrg
Copy link
Contributor

This fixes a bedrock server being port forwarded with a different port than configured. For example BDS:19130 and a router with port 19133 forwarding.

If trying to connect using a bedrock client in this config, proxypass will make a single ping to the downstream server, then update its port to that returned in the pong packet (if not -1) and then continue trying to connect.

We simply skip this step and honour the port specified in the config file.

This fixes a bedrock server being port forwarded with a different port than configured. For example BDS:19130 and a router with port 19133 forwarding.
@bundabrg
Copy link
Contributor Author

I now understand why ProxyPass defaults to this. A device will advertise a different port to represent a "LAN" connection versus an invited connection.

However by enforcing a port lookup we can't ever proxypass to a bedrock device that has port forwards. Perhaps this needs to be an option to differentiate between the two options OR a connection is attempted using both ports in turn till one works.

@SupremeMortal
Copy link
Member

This is vanilla behaviour so I think it should be kept. The random port range that vanilla servers generate is the bug here because you don't have any control over what value is set so you can never have the correct ports forwarded.
Checkout BDS-1094 for more information.

@bundabrg
Copy link
Contributor Author

The issue is:

  1. With the existing behaviour its impossible to connect to a Bedrock server behind a port forward using proxypass. It will be required for Support Online Mode #13 for example.

  2. With the changed behaviour here, you end up connecting to the correct port but it will not allow it due to ProxyPass not being invited properly.

The random ports are LAN ports (offline) and the set ports are Online ports as far as I can gather.

@SupremeMortal
Copy link
Member

The random ports are the ones in which the Minecraft connection takes place. They need to be port forwarded in order for you to be able to to connect to the server.

@bundabrg
Copy link
Contributor Author

bundabrg commented Jul 30, 2020

This does not seem to be the case. If I run 'bedrock_server' under linux with the following line in server.properties:

server-port=19131

and port forward ONLY port 19133 from outside to port 19131 it works perfectly fine. I can connect without issue.

EDIT: Perhaps the dedicated server and the games themselves have different logic to how they work. I've been talking about the dedicated server here whereas the game operates how you describe with a facade port simply there to redirect to the proper port.

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.

2 participants