godot icon indicating copy to clipboard operation
godot copied to clipboard

IPv6 support

Open Kermer opened this issue 10 years ago • 20 comments

It would be nice for Godot Networking to finally support IPv6, especially that most of ISPs begin to use v6 instead of v4 as a base.

With my new modem(router) I can't get the networking to work, since Godot can't resolve the hostname for IPv6 and my supposed IPv4 (which I don't even know how is obtained) doesn't respond to anything.

Kermer avatar May 13 '16 15:05 Kermer

I don't live in a country where ipv6 is widespread, so any contributions welcome

On Fri, May 13, 2016 at 12:43 PM, Kermer [email protected] wrote:

It would be nice for Godot Networking to finally support IPv6, especially that most of ISPs begin to use v6 instead of v4 as a base.

With my new modem(router) I can't get the networking to work, since Godot can't resolve the hostname https://github.com/godotengine/godot/blob/a895e2e372c9df2a9972f38134ae0ea9c8bf45a8/drivers/unix/ip_unix.cpp#L69 for IPv6 and my supposed IPv4 (which I don't even know how is obtained) doesn't respond to anything.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/godotengine/godot/issues/4651

reduz avatar May 13 '16 15:05 reduz

My ISP supports IPv6 since a few years now (SFR, France), but I don't have network programming knowledge.

For information, IPv6 is starting to become widespread-ish, about 5% of Google's traffic seems to go through IPv6. Also, in some cases, IPv6 can offer lower latency thanks to better peering (this is the case for me at least).

Calinou avatar May 13 '16 20:05 Calinou

Does the current API work for an ipv6 implementation at least? Maybe we need a bigger container for the addresses :p

On 13 May 2016 at 17:55, Calinou [email protected] wrote:

My ISP supports IPv6 since a few years now (SFR, France), but I don't have network programming knowledge.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/godotengine/godot/issues/4651#issuecomment-219156734

punto- avatar May 13 '16 22:05 punto-

IP_Address is the current address holder, which is 32b union, so expanding this to 128 will be required. The question is how this action alone will affect other functions... Maybe with some hints I could try to start some work on it.

Following the error from entering IPv6 string in StreamPeerTCP.connect(), we should start in resolving hostname - gethostbyname(p_hostname.utf8().get_data()) returns NULL for v6 and I'm not sure where this function is defined (is it system or external library?)

Second thing - expanding IP_Address and changing the return value from gethostbyname to correct (size) one.

Kermer avatar May 15 '16 15:05 Kermer

I am unaware of how IPV6 works, is it enough with just supporting 128bit addresses, or is there anything else we must add support for?

On Sun, May 15, 2016 at 12:05 PM, Kermer [email protected] wrote:

IP_Address https://github.com/godotengine/godot/blob/a895e2e372c9df2a9972f38134ae0ea9c8bf45a8/core/io/ip_address.h is the current address holder, which is 32b union, so expanding this to 128 will be required. The question is how this action alone will affect other functions... Maybe with some hints I could try to start some work on it.

Following the error from entering IPv6 string in StreamPeerTCP.connect(), we should start in resolving hostname - gethostbyname(p_hostname.utf8().get_data()) https://github.com/godotengine/godot/blob/a895e2e372c9df2a9972f38134ae0ea9c8bf45a8/drivers/unix/ip_unix.cpp#L68 returns NULL for v6 and I'm not sure where this function is defined (is it system or external library?)

Second thing - expanding IP_Address and changing the return value from gethostbyname to correct (size) one.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/godotengine/godot/issues/4651#issuecomment-219290959

reduz avatar May 15 '16 15:05 reduz

They have shorter header and few other things... But hey, one problem at a time :shipit:

Kermer avatar May 15 '16 16:05 Kermer

When does the divergence happen tho? If you have a hostname, you resolve it and might get an ipv4 address, or ipv6, at that point you decide to connect using the StreamPeer for that protocol? Or is there a separate resolver for each protocol? The questions is not about adapting the existing implementations I think, it's about if the StreamPeer API provides everything needed to implement one for ipv6, which will be separate from the current ipv4 one.

On 15 May 2016 at 13:25, Kermer [email protected] wrote:

Probably not. They have shorter header and few other things... But hey, one problem at a time [image: :shipit:]

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/godotengine/godot/issues/4651#issuecomment-219295442

punto- avatar May 15 '16 16:05 punto-

gethostbyname() is deprecated in Windows. From MS Docs:

The gethostbyname function can only return IPv4 addresses for the name parameter. The getaddrinfo function and associated addrinfo structure should be used if IPv6 addresses for the host are required or if both IPv4 and IPv6 addresses for the host are required.

So at least for Windows gethostbyname() has to be replaced with addrinfo().

vnen avatar May 15 '16 16:05 vnen

I peeked into current networking a bit and I think rewriting those files isn't for me. As punto mentioned, creating a separate StreamPeer for v6 would be a start. Rewriting it from scratch, using the old one only as helper, might be even quicker than trying to modify the v4 version. Maybe after that you could try to merge them.

Maybe I'll try my luck with creating some module later on. Using asio c++ lib or something like that.

Either way keep in mind that IPv4 might hold on long for intranet, but for internet there might be more traffic through v6 than v4 in a couple of years, so it's worth to support it.

P.S. Mind that 6to4 exists, but 4to6 doesn't

Kermer avatar May 18 '16 13:05 Kermer

https://developer.apple.com/news/?id=05042016a So for almost all of the mobile games developers support of IPv6 can be quite handy ;)

lukaskotik avatar Oct 09 '16 19:10 lukaskotik

@punto- is looking at implementing ipv6 this week

reduz avatar Oct 09 '16 19:10 reduz

Nice! Keep us updated :+1:

Kermer avatar Oct 09 '16 19:10 Kermer

Here is an official answer from Apple about our application: "Performance - 2.1 We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 10.0.2 on Wi-Fi connected to an IPv6 network. We were unable to log in.

Next Steps: Please run your app on a device while connected to an IPv6 network (all apps must support IPv6) to identify the issue(s), then revise and resubmit your app for review. Resources: For information about supporting IPv6 Networks, please refer to Supporting IPv6 DNS64/NAT64 Networks and About Networking" :(

Disputer avatar Oct 15 '16 16:10 Disputer

Done (but a bit broken) on master, so maybe we should close this?

bojidar-bg avatar Oct 28 '16 15:10 bojidar-bg

I think we need another issue about IPv6 on ENet.

vnen avatar Oct 31 '16 10:10 vnen

@vnen - akien just did: #6992

Kermer avatar Oct 31 '16 12:10 Kermer

I have the same issue. I dont have any log in form on my game but the only moment when access user internet is the moment when he want to buy something from the store and I am using godot in app purchase. Any idea what should I do for this issue??

Thanks!!!

FabiGjuzi avatar Nov 30 '16 09:11 FabiGjuzi

What is the issue you have exactly? app store rejecting your game for the ipv6 reasons? Can you open a separate issue with the exact error message?

On 30 November 2016 at 06:32, FabiGjuzi [email protected] wrote:

I had the same issue. I dont have any log in form on my game but the only moment when access user internet is the moment when he want to buy something from the store and I am using godot in app purchase. Any idea what should I do for this issue??

Thanks!!!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/4651#issuecomment-263825593, or mute the thread https://github.com/notifications/unsubscribe-auth/AGVmPZmlxg4oNge6YNhdtDox10mdByuYks5rDUKXgaJpZM4IeI06 .

punto- avatar Nov 30 '16 09:11 punto-

yes.......Here is the apple response

Performance - 2.1

We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 10.1.1 on Wi-Fi connected to an IPv6 network.

  • We were unable to purchase your In App Purchase products because of the error message.

We've attached screenshot(s) for your reference.

Next Steps

Please run your app on a device while connected to an IPv6 network (all apps must support IPv6) to identify the issue(s), then revise and resubmit your app for review.

If we misunderstood the intended behavior of your app, please reply to this message in Resolution Center to provide information on how these features were intended to work.

For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce the issue(s). For updates, install the new version as an update to the previous version, then follow the steps to reproduce the issue(s).

P.S: I have the same issue with the difference that @Disputer cant log in and our game cant use godot in app purchase

FabiGjuzi avatar Nov 30 '16 09:11 FabiGjuzi

Open a new issue with this and attach those screenshots with the actually error message, I don't think this is related to the IPV6 code

On 30 November 2016 at 06:37, FabiGjuzi [email protected] wrote:

yes.......Here is the apple response

Performance - 2.1

We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 10.1.1 on Wi-Fi connected to an IPv6 network.

  • We were unable to purchase your In App Purchase products because of the error message.

We've attached screenshot(s) for your reference.

Next Steps

Please run your app on a device while connected to an IPv6 network (all apps must support IPv6) to identify the issue(s), then revise and resubmit your app for review.

If we misunderstood the intended behavior of your app, please reply to this message in Resolution Center to provide information on how these features were intended to work.

For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce the issue(s). For updates, install the new version as an update to the previous version, then follow the steps to reproduce the issue(s).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/4651#issuecomment-263826856, or mute the thread https://github.com/notifications/unsubscribe-auth/AGVmPW8KRaopJyKV6L2_FtU4AQep1-a4ks5rDUPegaJpZM4IeI06 .

punto- avatar Nov 30 '16 09:11 punto-