[BUG] Dedicated server connection issues with IPv6 networks

Hi again, as you can already see (link text) we’re working in an Android / IOS multiplayer project, and due the new apple policies (link text) we forced to make our app to be IPv6 capable, and here is when a new issue appears. Following the instructions provided by apple (link text) we setup a IPv6 network to perform our own tests.

If we connect any device using the IPv6 network we’re unable to connect to the dedicated server using the open command pointing to the IPv4 address (the server host is an AWS EC2 with IPv4 and IPv6 support). But, if we use a ipv4 client network it works perfect.

Additional notes:

  • It is not a IOS dependence issue because it happens testing in android devices too.
  • We already tested other apps using the IPV6 network and everything works fine, so we can discard a network issue.

Additional Information

  • UE4 - 4.14.3 (Source Version)

We’re made some changes to the engine code regarding your answer to enable ARM64 support to the dedicated server:
(link text)

After read the links listed next we assume that Unreal 4.14 is already ipv6 capable.

  • New: Enabled IPv6 support on iOS and Mac (link text).
  • Fixed! UE-35738 IPv6 implementation is not working on IOS (link text)

Hello DarielNS,

Thank you for reporting this issue. I’m currently looking into getting a test set up for this but due to the network modifications required, it’s taking some time. I’ll try to get back to you as soon as possible.

Hi Matthew,
Is there any news about this?

Hello GameOlic,

I apologize for the delay but we’re currently in the process of having a testing environment setup to simulate the environment a consumer would be using to connect with IPv6 to accurately test this problem.

Ok Matthew, please let me know.
We are really stucked at this issue and our deadline is aproaching.
Thanks

Hi there.

I can confirm that on iOS and Android connecting to the dedicated server via IPv6 is not possible.

The code has many bugs in terms of containing the ipv6 address. For some reasons engine tries to cast ipv6 address which has 128bits to ipv4 addres where we hve 32 bits and we’ve got huge data lost.

I’ve fixed it, but the only I can do is to inform about what accualy went wrong.

Thank you so much!, i’ll be waiting for your reply.

Thank you so much!, our AWS is running Windows, but we will request a linux setup in order to test your work.I’ll update this thread after get the results of our test.

(for legal reasons it was removed)

Hi Matthew,

In case it can help, we debug the thing a little more and finally get a good log about the issue:


[2017.06.03-18.58.22:096][544]LogNet: Browse: 52.146.70.150:8001//Game/Maps/Login

[2017.06.03-18.58.22:105][544]LogInit: BSD IPv6: Socket queue 32768 / 32768

[2017.06.03-18.58.22:107][544]LogIOS: Host addr is WIFI: [::ffff:169.254.157.197]

[2017.06.03-18.58.22:113][544]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)

[2017.06.03-18.58.22:116][544]LogNet: Game client on port 8001, rate 10000

[2017.06.03-18.58.22:119][544]LogSockets: sendto error: (ESocketErrors:23)

[2017.06.03-18.58.22:120][544]LogNetVersion: GetLocalNetworkVersion: CL: 0, ProjectName: test, ProjectVersion: 1.0.0.0, EngineNetworkVersion: 2, GameNetworkVersion: 0, NetworkChecksum: 1076119533

[2017.06.03-18.58.22:121][544]LogNet: UPendingNetGame::InitNetDriver: Sending hello. [UNetConnection] RemoteAddr: [::ffff:52.146.70.150]:8001, Name: IpConnection_0, Driver: PendingNetDriver IpNetDriver_0, IsServer: NO, PC: NULL, Owner: NULL

[2017.06.03-18.58.23:123][604]LogSockets: sendto error: (ESocketErrors:23)

[2017.06.03-18.58.24:137][666]LogSockets: sendto error: (ESocketErrors:23)

[2017.06.03-18.58.25:152][727]LogSockets: sendto error: (ESocketErrors:23)


We got the log by making the ‘open map’ to an IPv4 network from an IPv6 net.
Remember that our AWS is currently supporting IPv6 network.

Note: we edit the log to hidden our real IPv4 address (marked in bold), if you need the real IP please let me know.

Hi again zompi2
I checked what you told me, the problem persist, and i got this log:

[2017.06.04-17.50.33:061][387]LogNet: Browse: ec2-52-146-70-150.us-west-2.compute.amazonaws.com:8001//Game/Maps/Login

[2017.06.04-17.50.33:083][387]LogInit: BSD IPv6: Socket queue 32768 / 32768

[2017.06.04-17.50.33:085][387]LogIOS: Host addr is WIFI: [::ffff:169.254.157.197]

[2017.06.04-17.50.33:094][387]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)

[2017.06.04-17.50.33:101][387]LogNet: Game client on port 8001, rate 10000

[2017.06.04-17.50.33:103][387]LogNetVersion: GetLocalNetworkVersion: CL: 0, ProjectName: hunterswar, ProjectVersion: 1.0.0.0, EngineNetworkVersion: 2, GameNetworkVersion: 0, NetworkChecksum: 1076119533

[2017.06.04-17.50.33:107][387]LogNet: UPendingNetGame::InitNetDriver: Sending hello. [UNetConnection] RemoteAddr: [::]:8001, Name: IpConnection_0, Driver: PendingNetDriver IpNetDriver_0, IsServer: NO, PC: NULL, Owner: NULL

[2017.06.04-17.50.33:279][396]LogNet: Host name resolution completed

[2017.06.04-17.50.34:120][438]LogSockets: sendto error: (ESocketErrors:23)

[2017.06.04-17.50.35:126][496]LogSockets: sendto error: (ESocketErrors:23)

[2017.06.04-17.50.36:130][557]LogSockets: sendto error: (ESocketErrors:23)

As you can see the RemoteAddr is empty, we dont sure but it may be caused due the weird host name that amazon provide, anyways your opinion will be very helpful.

We already request a hostname change (or redirect by DNS to another domain) to perform more tests.

You’ve said you have 4.14 right? There was a bug with IP name resolving, fixed here: .com/EpicGames/UnrealEngine/pull/3172 This should make ip resolving for ipv4 proper and you should get the Remote Addr after “Host name resolution completed”.

This will work for IPv4 network. For IPv6… it seems I can’t give codes at this moment, but I can tell where is the problem. But at fist - check if the host name resolving is ok.

From what I can see - You are trying to connect to AWS via IPv4 address. AWS has dual-stack support so You can use either IPv4 and IPv6 address.

But when you are in IPv6 network, using BSDIPv6 sockets and trying to connect to IPv4 server - then you must use the help of DNS64. To do this, simply set up a domain address and try to connect to it. The domain will be something like “mygame.test.amazon.com”. You can set up it in AWS dashboard.
The DNS64 should get you RemoteAddr like: [64:ff9b::3492:4696]

Another, very importan thing - you are trying to connect via port 8001. The default port for UE4 is 7777. You can change it by launching a dedicated server with a parameter: -port=8001
If I remember correctly - UE4 will try next 100 ports if the first one won’t succeed.

Hello DarielNS, I apologize for the delay on this response; Are you still experiencing this issue? If so, I would like to continue investigating.

Hi Matthew, we deal with Apple to bypass the requisite for now, but the problem still there. We will aboard the issue again after finish our milestones.
I appreciate your interest so much.

Hi. If you could inform the programmers - the issue is that there is no structure to hold 128bit ip address anywhere. Adding specialized methods for setting and getting ipv6 should fix all problems.

I’m currently consulting this with my team… We have a fix for that, but making pull requests to master takes a lot of time which we don’t have :frowning:

hi, @zompi2, did you means this code? if I change this code to fix ipv6 length, will pass appstore?

if change this code works, you don’t need pull the source from github, just public IpConnection,and configure it in engine configure file.

After read the code and do some test, I finaly make it works. It’s the engine bug,
bug you don’t need compile from source,
I post my solution on github:
.com/feixuwu/UE4-IOS-IPV6

I’ve finally could sit down and write everything…

So - here’s a pull request.
.com/EpicGames/UnrealEngine/pull/4397/files

Main issue is in the IpConnection.cpp LowLevelSend method. There is an ResolveInfo copying the address to the RemoteAddr. But it is doing it by copying only 4 bytes, not 16 (which is the size of IPv6).

The host name resolver is bad too in my opinion. There will be problems if you try to connect using IPv4 network and IPv4 server.

There are 4 new methods: SetIPv6 and GetIPv6 for explicitly getting and setting IP Address using IPv6 byte code and IsBSDIPv6 which checks is the Address is binded to the BSDIPv6 socket and CreateInternetAddr6 for proper creating and then cacheing the resolved address.

There is a lot of going on with interfaces and there might be bugs. I will look at this in the future, but I think this is a good solution.

We are using it in our project and we have dedicated server on Linux and game on iOS and Android working pretty nice on any combination of IPv4 and IPv6 networks.

Hi zompi!. we re trying to implement your suggestion right now, but the SocketSubsystemBSDIPv6.cpp is shiggly different. We are now working in UE 4.18.1. What version you used?