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

Internet Match does not work with IPv6 #226

Open
derhass opened this issue Mar 14, 2022 · 1 comment
Open

Internet Match does not work with IPv6 #226

derhass opened this issue Mar 14, 2022 · 1 comment
Labels
bug Something isn't working Multiplayer General multiplayer issues.

Comments

@derhass
Copy link
Member

derhass commented Mar 14, 2022

The internet match IP/password field currently allows only entering IPv4 addresses. However, hostnames are also used and resolved. However, if a hostname gets resolved to an IPv6 address, the game crashes:

Unhandled Exception detected: SocketException: An address incompatible with the requested protocol was used

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy)
System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP)
System.Net.Sockets.UdpClient.DoConnect (System.Net.IPEndPoint endPoint)


(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

SocketException: An address incompatible with the requested protocol was used
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
  at System.Net.Sockets.UdpClient.DoConnect (System.Net.IPEndPoint endPoint) [0x00000] in <filename unknown>:0

(Filename:  Line: -1)

Unhandled Exception detected: NullReferenceException: Object reference not set to an instance of an object

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

LocalLANClient.DoTick () <0x000fa>
NetworkMatch.NetSystemDoTick () <0x004e4>
NetworkMatch.Update () <0x00033>
Overload.NetworkManager.Update () <0x0003b>
(wrapper dynamic-method) Overload.GameManager.Overload.GameManager.Update_Patch2 (Overload.GameManager) <0x0059e>


(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

NullReferenceException: Object reference not set to an instance of an object
at LocalLANClient.DoTick () <0x000fa>
at NetworkMatch.NetSystemDoTick () <0x004e4>
at NetworkMatch.Update () <0x00033>
at Overload.NetworkManager.Update () <0x0003b>
at (wrapper dynamic-method) Overload.GameManager.Overload.GameManager.Update_Patch2 (Overload.GameManager) <0x0059e>


(Filename:  Line: -1)

Unhandled Exception detected: NullReferenceException: Object reference not set to an instance of an object

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

LocalLANClient.DoTick () <0x000fa>
NetworkMatch.NetSystemDoTick () <0x004e4>
NetworkMatch.Update () <0x00033>
Overload.NetworkManager.Update () <0x0003b>
(wrapper dynamic-method) Overload.GameManager.Overload.GameManager.Update_Patch2 (Overload.GameManager) <0x0059e>


(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

As a quick improvement, I added a small patch in PR #225 which will prefer an IPv4 if multiple addresses are returned by the DNS.

However, in the long run, it would be nice to see if we could make olmod internet games work with IPv6 natively. It's not clear which changes this might require, and it it is feasible at all...

@derhass
Copy link
Member Author

derhass commented Mar 14, 2022

I looked a little bit into this. The UdpConnection class just needs to know the address family to use at construction time. For the matchmaking phase alone, the client side would be easy to adapt, as we already have the IPAddress at that time and know the address family.

For the server side, we would need an additional UpdClient to listen for IPv6. That should be a bit more work, but could still be doable with reasonable effort.

However, the big question which remains is whether the rest of the code can deal with IPv6 addresses or not. Haven't looked into that yet....

@roncli roncli added bug Something isn't working Multiplayer General multiplayer issues. labels May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Multiplayer General multiplayer issues.
Projects
None yet
Development

No branches or pull requests

2 participants