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

ipv6 #203

Open
PolestarWorkshop opened this issue Jun 1, 2018 · 8 comments
Open

ipv6 #203

PolestarWorkshop opened this issue Jun 1, 2018 · 8 comments

Comments

@PolestarWorkshop
Copy link

Hello my friends. First of all - thanks for this great server engine. I'm almost done my first multiplayer game and got a little problem, while I trying post my application for Apple review. They said:
"exhibited one or more bugs when reviewed on iPad running iOS 11.4 on Wi-Fi connected to an IPv6 network.". Game not working on IPv6 networks, Master server not reachable.
I'm using hard coded IP address in my project, and do you can give some advice on how to get good result for adding support of IPv6 networks ?

@delmarle
Copy link

delmarle commented Jun 2, 2018

unet support ipv6 out of the box, is your server using ipv6 ? you could also solve this by using dns name

@PolestarWorkshop
Copy link
Author

PolestarWorkshop commented Jun 6, 2018

Yes I have ipv6 ip address on my server. Server have both ipv4 and ipv6 adresses. Connectivity settings is ipv4 ip address in Msf.Connect.
What to do next ?, please help.

@JadeWhite
Copy link
Contributor

JadeWhite commented Jun 11, 2018

I just hit the same problem! Did you happen upon a solution?

I suspect this has to do with the Websocket sharp connection to the master server. Apple recently made it so all apps submitted to the store must comply with the IPv6-only standards this June 1st. So maybe it's related to that.

I'm new to this IPv6 thing, but I'm reading we can't have hardcoded ip addresses? In which case maybe it's as simple as replacing the server ip e.g. "192.168....." with whatever this dns name stuff is.

Out of curiosity, what version of barebones-masterserver are you using? If it's recent, it could be dying out at the server Ping check (which I recently added), or it's the WebSocket itself. Unity claims to have fixed Ping to support IPv6, but it might still be broken https://issuetracker.unity3d.com/issues/unityengine-dot-ping-does-not-work-with-ipv6-addresses

Also possibly related: The current websocket server might not be able to accept ipv4 and ipv6 connections at the same time!? sta/websocket-sharp#339

I'll try stuff out when I get home later today.

@JadeWhite
Copy link
Contributor

JadeWhite commented Jun 12, 2018

Following Apple's guide under "Test for IPv6 DNS64/NAT64 Compatibility Regularly" at https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html . I've managed to reproduce the app not connecting.

Trying to wrap my head around this, but from my understanding - the Apple requires apps to support using "IPv4 only" and "IPv6 only" connection methods separately. When using IPv6 only, using a IPv4 address, like "192.168.7..." isn't going to fly; it needs to be a IPv6 address, which looks like e.g. "2001:db8:85a3::8a2e:370:7334". Apparently it's possible to have a IPv4 address inside a IPv6 address with some notation like "::ffff:192.0.2.128", (according to wikipedia).

This is problematic for connecting to the master server because it relies on a IPv4 address. It'll also be problematic for a player to connect to a GameServer using UnetGameRoom, since that also uses a IPv4 address, which comes from SpawnerBehaviour.DefaultMachineIP.

I've got some solution ideas, very unsure if they'll work:
#0: Somehow detect if we're on a IPv6 only network. If so, automatically replace the IPv4 strings with IPv6 strings like "::ffff:192.0.2.128" before connecting. It's such a dirty workaround, I think it's too good to be true.

#1: Somehow detect if we're on a IPv6 only network. If so, replace the IPv4 strings with your server's IPv6 string like "2001:db8:85a3::8a2e:370:7334". However, WebSocketServer by default only accepts IPv4 connections, so we would modify it with some workarounds to accept IPv6 sta/websocket-sharp#339 .

#2: We replace our address names with a dns names like "myserver.com", which is the recommended approach. We would also need to fix the WebSocketServer, as mentioned in #1. However, domains need to be renewed, cost money (though ~$1/month from Amazon), and you'd need a unique subdomain for each server machine you had. Maybe someone knows of a reliable free one?

All this assuming I know what I'm talking about...

@PolestarWorkshop
Copy link
Author

PolestarWorkshop commented Jun 12, 2018

Thanks for the deep research about problem. Interesting ideas, but two days ago I made DNS records (A, AAAA) on subdomain of main landing website for mapping to server IP addresses. Just as you explained in #2 about mapping dns names to ip addresses. I don't know exactly for 100%, this helps out of problem or not. I will put on review to Apple soon.

@JadeWhite
Copy link
Contributor

JadeWhite commented Jun 14, 2018

So I did the same thing (#2) and tested it following Apple's guide; looks like it worked! No code changes needed. However, Apple's testing guide only covers IPv6 --> IPv4 via NAT64. In Apple's offices, it'll be full on IPv6-->IPv6, so the result could be different.

How did your app review go? (If by chance you got it completed already) Was thinking of resubmitting mine. Otherwise I'll probably need to change websocket.

@PolestarWorkshop
Copy link
Author

I apologize for the long answer, I confirm - ipv6 solution is correct way and ipv6 passed by Apple.
My app review passes slowly, Apple find more and more issues after every review

@JadeWhite
Copy link
Contributor

JadeWhite commented Jun 20, 2018

A update on my end too, I used a dns name and modified Websocket (#2) and my app also managed to pass Apple's IPv6 check. Good to know the websocket changes aren't necessary though.
I'm also stuck in app review hell, but at least that problem is out of the way.

Update: My app cleared the review process 👍

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

No branches or pull requests

3 participants