[SPIGOT-7031] Bungee IP forwarding with a port results in a "<unresolved>" IP Created: 05/Jun/22 Updated: 25/Dec/24 |
|
| Status: | Open |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | mammut53 | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | bug, spigot | ||
| Environment: |
Spigot server with a self-written development proxy which uses bungee forwarding |
||
| Version: | 3496-Spigot-b081915-a59dc59 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) |
| Guidelines Read: | Yes |
| Description |
|
Bungee IP forwarding does not work like expected when sending a IP:PORT string. Spigot cannot resolve the IP and it stays unresolved, but continues to allow the client to join.
The console output looks like this: [Server thread/INFO]: mammut53[127.0.0.1:49654/<unresolved>:49657] logged in with entity id 147 at ([world]24.5, 74.0, -38.5) This is clearly not intended behaviour. Having a quick looking into the Spigot patches, I noticed that there is a regex which allows a ":" in the IP part of the forwarded information, but this part gets matched and directly feed into java.net.InetSocketAddress here. Another strangeness here is also the port that gets feed into java.net.InetSocketAddress. This is the proxy's port to the server and not the port of the client to the proxy.
Quick note: Sending no IP (this means nothing between the null characters) also allows the client to join: [Server thread/INFO]: mammut53[localhost/127.0.0.1:62006] logged in with entity id 583 at ([world]-36.33158959627857, 78.0, -182.12459419585574)
Maybe I'm missing something and this is necessary?
I would hope that this gets changed so that I can also forward the client's port. In my opinion, it looks like that this was initially an intended "feature" and someone just forgot to handle this case and everyone else just ended up only sending the IP without the port for this reason. Thanks.
Fun fact: With a player based IP-ban, you can actually ban the "<unresolved>" IP
|
| Comments |
| Comment by mammut53 [ 07/Jun/22 ] |
|
That makes sense... I'm stupid. Yes, I can't think of a real production use-case either, it would just be for looks and "overall correctness". For my development setup it would be quite nice to have, but I can patch this for myself. Maybe use a stricter regex that the IP can always be resolved and if this is not the case, disconnect like it is already implemented, so this doesn't happen again? Thank you for your time! |
| Comment by md_5 [ 06/Jun/22 ] |
|
That regex is there to allow ipv6 addresses, not ports. There is no use for ports so bungee doesn't send them and Spigot doesn't parse them. |