Apple recently announced that beginning June 1, 2016, “all apps submitted to the App Store must support IPv6-only networking.” Since many of our users publish Unity games to the App Store, we wanted to take a moment to discuss Unity’s support for IPv6-only networks. Note that this requirement applies to both new app submissions and updates to existing apps.
What is IPv6?
From the Wikipedia article: “Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet.” Devices can operate on an IPv4-only network (the previous standard), and IPv6-only network, or a network with both protocols in use. Apple’s new requirement means that apps must be able to operate in an IPv6-only network.
It is important to understand that IPv4 and IPv6 networks do not interoperate, although it is possible to pass traffic from one type of network over the other with tunnelling.
Does Unity support IPv6?
Yes! WWW and UnityWebRequest are IPv6 compatible on iOS out of the box because they are based on high level Apple networking APIs. And over the past few months we have been working to bring support for IPv6-only networks to Unity’s .NET/IL2CPP libraries. Our last known IPv6 bugs related to .NET/IL2CPP were corrected in the 5.3.4p4 patch release. There is one fix pending for UNET which is going to be shipped in coming weeks. Thanks to help from great members of our community (like Exit Games) we have been able root out a number of bugs in the Unity Engine code and provide support for IPv6-only networks on the following platforms:
- Editor: All platforms
- Standalone player: All platforms
- iOS
- Android
We’ll continue to add support for IPv6-only networks on other platforms in the future.
What about older versions of Unity?
If you are using only WWW or UnityWebRequest APIs to access network resources you should be fine, though please test your games carefully.
We are also planning to backport our .NET/IL2CPP fixes to selected older lines of Unity and release them as 4.7.2, 5.1.5 and 5.2.5 updates.
What should you do?
First, test your game in IPv6-only setup to assess if all the game features work as intended. This guide from Apple goes through the setup of an IPv6-only testing network using a Mac with OS X 10.11 or later. This is the same testing that App Store reviewers will use, so it is a good place to start with IPv6 testing. Since IPv4 and IPv6 networks cannot interoperate, you must test on an IPv6-only network to ensure everything is working well. If your device has both IPv6 and IPv4 addresses, then socket operations could succeed using IPv4.
Second, audit your code for a few indicators of possible problems:
- Look for the use of IPv4 addresses (e.g. 127.0.0.1, 8.8.4.4). Any use of such hardcoded addresses should be removed. Prefer host names, which can be used to look up the proper IPv4 or IPv6 address of a given device for the proper type of network.
- Look for the use of the IPAddress.AddressFamily property. If the code branches based on the value of the property, is there a branch that handles IPv6 properly?
- Look for the use of the IPAddress.Any and IPAddress.Loopback fields. These fields work with IPv4 addresses, not IPv6 addresses. Use the IPAddress.IPv6Any and IPAddress.IPv6Loopback fields as well to ensure IPv6 support.
If you encounter troubles beyond the ones mentioned above, please make sure you are using a build with the necessary fix in it. If a fix has not yet landed in your line (4.7.x, 5.1.x, 5.2.x), wait until we have released a patch with it. Then proceed to upgrade to this version.
Some of 3rd party native and managed networking plugins might also be not compatible with IPv6 networks, please consider reaching out plugin vendor for their compatibility status.
Finally, let us know if you encounter bugs in Unity related to IPv6. We will work hard to correct them as soon as possible. For issues specifically related to the App Store requirements, visit the iOS and tvOS development section of our forums. I’ll be hanging out there to help.
Update: 4.7.2 is live now: http://unity3d.com/get-unity/download/archive
Update #2: 5.2.5 is live too: http://unity3d.com/get-unity/download/archive (scroll down below 5.3.x updates).
Update #3: 5.1.5 is live too: http://unity3d.com/get-unity/download/archive (scroll down below 5.2.x updates).
Yu
junho 14, 2016 às 10:24 amHI,
Does unity has any equivalent method to CAPI “getaddrinfo”?
I tried to synthesize an IPv6 address from IPv4 address manually, by using “Dns.GetHostEntry” and “Dns.GetHostAddresses”, and none of them worked.
We need this, because some of our submissions using fixed prefix(“64:ff9b::”) were rejected by Apple, though it works fine with our MAC sim testing pure ipv6 env.
Any suggestion?
Thank you!
Mantas Puida
junho 15, 2016 às 11:30 pmCould you please forward me (mantas@unity3d.com) rejection letter you got from Apple?
Thanks!
ALEXANDER BOGOMOLETZ
junho 17, 2016 às 4:57 pmI was planning to use this workaround too.
If you find any solution to it please post here or keep in touch via email!
Thank you!
Damian
junho 7, 2016 às 5:30 pmSubmitted 2 bug reports:
Socket.OSSupportsIPv6 throwing an exception on Android: https://fogbugz.unity3d.com/default.asp?803576_dd4igthvr1jva96j
and
Hostname only being accepted for TcpClient.BeginConnect on iOS (throws an exception on Editor/Android): https://fogbugz.unity3d.com/default.asp?803613_bnc234pfm7rrvtg7 (sync Connect() works, but seems to connect to the IPv4 ip – at least in the editor)
Mantas Puida
junho 15, 2016 às 11:28 pmFirst bug is already assigned to Android team grabbag and second one is in QA queue. Any issues that would prevent shipping game on iOS?
Damian
junho 17, 2016 às 10:07 amNothing that prevents shipping, though I’m still getting rejected :D Running their test by setting up a DNS64/NAT64 network locally through a Mac works fine, but no info from Apple about why they’re rejecting it
Mantas Puida
junho 17, 2016 às 6:53 pmCould you please forward rejection letter to mantas [at] unity3d.com?
Thanks!
Pavel Alieinikov
junho 6, 2016 às 8:36 pmHi, I am deploying dedicated server made on UNET and when I start server I try to get list of all IPs (both IPv4 and IPv6). My server is deployed on Linux server on DigitalOcean with IPv6 support enabled, server can be pinged via IPv6 address. When I connect via IPv4 from client to server (from NetworkClient to NetworkServer) – everything works fine, however, when I connect via IPv6 – I get timeout error. I am using Unity 5.3. Strange thing is that it seems to work fine on Windows server, but doesn’t work on Linux. Can anybody help me out with this issue?
Mantas Puida
junho 7, 2016 às 2:34 amCould you please make a bugreport with some small repro case attached to it and share your case number?
Thanks!
Juztin
junho 3, 2016 às 4:47 amGrateful for 4.7.2 . Unfortunately it doesn’t work for me . My ipv6 code is failed . I build my ios player with il2cpp and the problem “An address incompatible with the requested protocol was used” is the same as using old unity version . The good news is that the same code works when i change the build setting to using mono(2.x) not using il2cpp . Maybe there are some bugs in il2cpp . And my work condition must uses il2cpp . Btw thanks unity .
Mantas Puida
junho 5, 2016 às 9:49 amPlease submit a bugreport and share your case number.
Thanks!
Alexander Bogomoletz
junho 7, 2016 às 12:41 pmI have similar issue in 5.4.0b20 with Udp socket when reading Socket.LocalEndpoint property.
Mantas Puida
junho 7, 2016 às 5:37 pmThanks for reporting!
Developers are looking into Socket.LocalEndpoint issue.
Alexander Bogomoletz
junho 7, 2016 às 1:44 pmI submitted a bug with description, case 803569
zzh1234567
junho 15, 2016 às 12:37 pmI have same issue in 4.7.2f1 with ” “An address incompatible with the requested protocol was used” . Does unity solve it?
Julien
junho 1, 2016 às 10:26 amI am so relieved that 4.x will support this…
Thanks Unity.
Jawa
maio 31, 2016 às 1:24 pm*4.7.2 is live now* : http://unity3d.com/get-unity/download/archive
izibazi
maio 31, 2016 às 2:05 pmThanx.
Wilfred
maio 29, 2016 às 4:57 pmThat great, could I know when will have the patch 4.7.2 release?
Mantas Puida
maio 30, 2016 às 2:06 pmIt’s undergoing latest testing stages right now. I believe it will be out early this week. Fingers crossed.
JIANGXIAO
junho 2, 2016 às 4:36 amHI, I run a simplified code with version 5.3.5, exception occurred at:
m_testSocket.LocalEndPoint
, with “An address incompatible with the requested protocol was used”, by ignore this, everything is OK now. I will re-test 4.7.1 and 4.7.2 later. Thank you!Mantas Puida
junho 2, 2016 às 10:49 amHmm.. Could you please submit a bugreport for 5.3.5 and share your case number?
Thanks!
JIANGXIAO
junho 2, 2016 às 1:56 pmHI, Mantas Puida, I’d like to, please give me a bug report url. It is the same with 4.7.1, receive operation is OK, but m_testSocket.LocalEndPoint throw an exception. Thank you!
Mantas Puida
junho 2, 2016 às 2:03 pmIn Unity Editor activate Help menu and pick “Report a Bug…” there.
JIANGXIAO
junho 3, 2016 às 9:01 amI reported a bug, case 802618, thank you!
Jangxiao
maio 31, 2016 às 12:45 pmHI, Our server has only ipv4 address, so We add the prefix”64:ff9b::” as you mentioned early, but it works only in one direction : it connect to the server, send data to the server(and server received it), but can not receive from the server, no data received. Receive code as follows( it works with ipv4, but not ipv6):
m_testSocket.BeginReceive(m_rcvBuff, m_rcvBuffEnd, RCV_BUFF_SIZE -m_rcvBuffEnd, SocketFlags.None, new AsyncCallback(ReceivedDataCallback), m_testSocket);
Any suggestion? Thanks!
Jangxiao
maio 31, 2016 às 12:47 pmand our unity version : 4.7.1
Mantas Puida
maio 31, 2016 às 12:59 pmI believe you are hitting known issue. You should wait for 4.7.2 release, which is expected to happen very soon.
spacefrog
maio 13, 2016 às 10:22 amGreat to hear that there will be an 4.7.2 update !
A*
maio 24, 2016 às 3:39 pm4.7.2, thats nice…
I’m glad to hear that too.
I think Unity should not drop support for version 4.7.x until Unity 6 is out.
Which means Unity can keep supporting the last 2 Major releases (at least) concurrently. Many big software companies do support the current major version of their software + at least 1 previous major version.
Martin Nielsen
maio 13, 2016 às 9:43 amSo, we are heavily relying on AssetBundles in our game, and are currently using 5.2.4f1 for best performance. Assetbundle loading is heavily broken in the 5.3.4 patch line.
Any ETA on the IPV6 backport to 5.2.4f1 or a definitive Assetbundle fix for 5.3.4p1-6 ?
We are caught between two gamebreaking issues, and are facing the possibility of not being able to publish new content.
Mantas Puida
maio 13, 2016 às 7:14 pmWhat API are you using to download Asset Bundles? If it’s WWW class then you should be fine your current version, but please do test it carefully in ipv6-only setup.
Martin Nielsen
maio 17, 2016 às 3:34 pmIts not downloading Assetbundles that is broken, that works just fine. But everything related to Assetbundle.LoadAssetAsync() is completely broken in 5.3.4. Our entire loading structure is based on async loading, so we cant change that.
Our next best step is to try Unity 5.3.3 and hope its IPv6 ready, as Assetbundles loading seems to be working there.
Mantas Puida
junho 1, 2016 às 7:09 pm5.2.5 is out now, link is at the bottom of blogpost
Rasmus Kristensen
maio 12, 2016 às 4:16 pmAny ETA on the patch releases for 5.1 and 5.2?
Mantas Puida
maio 13, 2016 às 11:18 amWe are working on them, but hopefully we will know better about actual shipment dates next week.
Mantas Puida
junho 1, 2016 às 7:10 pm5.2.5 is out now, please check bottom of the blogpost
Jhone
maio 12, 2016 às 9:51 ami try to use the socket to connect ipv6 address, it works fine in ipv4 and ipv6 networks, but has a 10051 err code in ipv6-only network. why?
Mantas Puida
maio 12, 2016 às 11:07 amDid you setup ipv6-only testing environment properly. Like can you reach http://www.apple.com from iOS device in this setup?
Jhone
maio 13, 2016 às 3:30 ami had reach https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html, and setup ipv6-only testing environment on my mac-mini. but in this testing network, i still get a 10051 err code.
Mantas Puida
maio 13, 2016 às 11:26 amAre you also getting similar errors in Safari on the iOS device?
Jhone
maio 13, 2016 às 4:31 ami had read https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html, and setup ipv6-only testing environment on my mac-mini. but in this testing network, i still get a 10051 err code.
Jhone
maio 13, 2016 às 12:23 pmno. i have not got any err in safari on my device. i can access the web page.
Mantas Puida
maio 14, 2016 às 2:06 pmDo you have sample code to share on how are you testing it?
Jhone
maio 18, 2016 às 4:14 am//********** my ipv6 testing code **********
IPEndPoint ep = new IPEndPoint(IPAddress.Parse(“::ffff:118.123.216.87”),10001);
Socket m_Socket = new Socket(ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
m_Socket.Connect(ep);
//********** end code **********************
i will get a 10051 err code in ipv6-only, bu it’s fine in ipv4. And the err occurs in API ‘Connect’.
Mantas Puida
maio 18, 2016 às 11:37 pmApple NAT64 test environment seems to not like “::ffff:” prefix, use “64:ff9b::” instead as noted in https://tools.ietf.org/html/rfc6052. In general it is highly advisable to use hostnames everywhere instead of direct IP addresses.
tatata
junho 24, 2016 às 3:20 amhttps://forums.developer.apple.com/thread/46545
An Apple staff said
> it is not safe to form an IPv6 address by combining an IPv4 address with the Well-Known Prefix (64:ff9b::/96). This may work in some NAT64 networks but it is not a general solution to the problem.
Jhone
maio 19, 2016 às 5:37 amthanks for your answer.
today, i have changed my testing code. like this:
//********** my ipv6 testing code **********
IPAddress[] _ips = Dns.GetHostAddresses(“test.ts.ls.dkmol.cn”);
IPEndPoint ep = new IPEndPoint(_ips[0],10001);
Socket m_Socket = new Socket(ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
m_Socket.Connect(ep);
//********** end code **********************
it’s fine in ipv4, but get an err message “No such host is known” in ipv6-only. And the err occurs in API ‘Dns.GetHostAddresses’.
Jhone
maio 19, 2016 às 5:40 ammy unity version is 4.7.1.
Mantas Puida
maio 19, 2016 às 11:11 amSimilar code works for me fine on Unity 5.3.4p6.
Fixes for Unity 4.7 are not yet released, we are working on them.
lx
maio 11, 2016 às 5:24 amwhat abou webgl sockets, is it supported there?
nug700
maio 11, 2016 às 11:16 amWebGL routes all its networking through javascript (the browser) using external calls, so it uses whatever the browser is using.
Lior Tal
maio 10, 2016 às 11:44 pmI just scanned our game project for any IPAddress class usage. It looks like Unity Test Tools are using this class, perhaps you guys should update that to support the new requirements?
Mantas Puida
maio 11, 2016 às 12:58 pmThank you, we will look into it. Just note that use of test tools should not affect your iOS game submissions.
laptop servis
maio 10, 2016 às 10:19 pmnice!
http://laptop-servis-doo.rs/