Opened 7 years ago

Last modified 39 hours ago

#4301 new task

IPv6 enet support

Reported by: fcxSanya Owned by:
Priority: Must Have Milestone: Backlog
Component: Network Keywords: beta ipv6
Cc: Patch: Phab:D1676

Description (last modified by elexis)

IPv6 adoption is rising, some ISPs already provide IPv6 addresses only, so we eventually will have to support it in the network layer.

pyrogenesis uses ENet which currently isn't IPv6 compatible, the best place to track ENet IPv6 status is probably this pull request: https://github.com/lsalzman/enet/pull/21.

Change History (20)

comment:1 by fcxSanya, 7 years ago

IPv6 support topic was raised on IRC a number of times, so I decided it would be useful to gather all the information in a ticket, so it would be possible to easily find the current status and track possible updates

comment:2 by echotangoecho, 7 years ago

Milestone: BacklogAlpha 22
Priority: Should HaveMust Have

Also take note of this issue from another project wanting to get ipv6 support using enet: https://github.com/godotengine/godot/issues/6992. We should try to fix this before next release as this is important to have (not having it denies an increasing number of people the ability to play multiplayer).

comment:3 by elexis, 7 years ago

Milestone: Alpha 22Backlog
Summary: IPv6 supportIPv6 enet support

I didn't come across a single bug report yet about missing ipv6.

Currently we support enet 1.3 or older, (see wiki:BuildInstructions) and even the most recent enet version doesn't include ipv6. The latest commit in https://github.com/lsalzman/enet was in june, while the link you provided shows pull requests from october. So it seems out of reach for now.

Also this didn't discuss lobby / XMPP support yet, which would be mandatory for allowing seamless IPv6 support.

comment:4 by elexis, 6 years ago

Description: modified (diff)

I didn't come across a single bug report yet about missing ipv6.

Recent ejabberd uses IPv6 by default and needs to be configured to only listen on IPv4. (Otherwise hosting will work with STUN enabled but not without it.)

There are different pull requests for enet ipv6 support and we must consider patching enet locally if not getting it merged upstream.

comment:5 by elexis, 5 years ago

Keywords: beta added

comment:6 by Stan, 5 years ago

Might be interesting to use Godot sockets for IPV6 support https://github.com/godotengine/godot/pull/7985

comment:7 by elexis, 5 years ago

Lefo has mentioned on the lobby that he has successfully compiled 0ad with an ipv6 patched enet. The difficulty will be to deploy it on the lobby in conjunction with ejabberd ipv4 or ipv6 addresses and not having some clients who only speak ipv4 or clients who only speak ipv6 be locked out from some of the games (or even the entire lobby).

comment:8 by Lefo, 5 years ago

Milestone: BacklogWork In Progress

comment:9 by elexis, 5 years ago

Patch: Phab:D1676

comment:10 by elexis, 5 years ago

Milestone: Work In ProgressAlpha 24

comment:11 by historic_bruno, 5 years ago

Keywords: ipv6 added

comment:12 by elexis, 5 years ago

refs #5498 for macOS gloox IPv6 support

comment:13 by Stan, 3 years ago

Milestone: Alpha 24Alpha 25

I couldn't get any consensus so I'm pushing it to A25.

It seems Godot worked around the issue by using their own sockets (See the PR by fcx sanya) Maybe that would be more acceptable.

comment:14 by wraitii, 3 years ago

Did a deeper dive on this following Phab:D3944. What I think:

  • We ought to remove un-necessary dependency on Enet for address-to-human code and STUN in general. This seems easy enough since *nix and Win32 share mostly compatible APIs, and in the future we can hope C++ will standardise something.
    • The opposite was done in Phab:D1676, but it can be used for reference.
  • Then we ought to look into using a fork of Enet that supports IPV6, unless by that point it looks like Enet itself got updated.

In terms of 'status update', there is one new PR that got more enthusiastic comments : https://github.com/lsalzman/enet/pull/109 . On a superficial level, this seems quite simple, which is good. Indeed, as noted by the Godot guys at https://github.com/godotengine/godot/pull/7985/, the only struct that's really problematic is ENetAddress. If that is changed, everything else mostly falls into place (with some changes in the platform-specific code, of course). Godot's PR provides an example of how to provide a custom socket implementation, which I don't think is really what we want to do.

In terms of fork, I am wary of ZPL-C's fork used as the basis for D1676 - they did a rather larger number of changes, and I'm not sure about the philosophy of the maintainers. A much lighter fork is maintained at https://github.com/mman/enet, but we would obviously need to check a few things. Still, the risk of using such a "light" for shouldn't be too high, because it doesn't affect enet-specific code, only the sockets, which are platform-specific and likely to fail in non-subtle ways.

I haven't really found another stable, up-to-date fork.

Last edited 3 years ago by Stan (previous) (diff)

comment:15 by wraitii, 3 years ago

So I did another deep dive, pulling out D3952. In fact, the AF_INET6 socket & sockets in general using IPV6 are fully compatible with IPV4, so that's great, it's _actually_ protocol-independent.

The only problem is that Enet doesn't use AF_INET6 sockets, so things won't work. But that single change is necessary, the rest of the code should be completely agnostic.

comment:16 by Stan, 3 years ago

In r25453:

StunClient code cleanup: use enet functions, endianness

Instead of using platform-specific sockets, use enet_socket* functions (which ends up doing the same). Clean up some confusing APIs, removing the distinction between finding the public IP for the host/join.

Fix endianness support & use simpler code.

Refs Phab:D364 / Phab:rP19703 (and some subsequent fixing diffs).

Differential Revision: https://code.wildfiregames.com/D3970

comment:17 by Stan, 3 years ago

Milestone: Alpha 25Alpha 26

Phab:D3952 was abandonned, Enet still doesn't support IPV6

comment:18 by Stan, 2 years ago

Milestone: Alpha 26Alpha 27

Unlikely to get done for A26

comment:19 by Freagarach, 16 months ago

Milestone: Alpha 27Backlog

Pushing back.

in reply to:  3 comment:20 by Dunedan, 39 hours ago

Replying to elexis:

Also this didn't discuss lobby / XMPP support yet, which would be mandatory for allowing seamless IPv6 support.

Running ejabberd dual-stack listing on IPv4 and IPv6 is no big deal, so we can easily support connections to the lobby for all players, no matter if they use IPv4 or IPv6.

The big question I see is how we can support players with IPv4-only internet connections playing together with players with IPv6-only internet connections, as they need to be able to exchange UDP-packets directly. That'd require at least the player hosting the game to have a dual-stack internet connection, unless we host the games on our own dual-stack enabled infrastructure. Another option would be to mark games explicitly as IPv4 and/or IPv6 depending on what the host supports, however that would split the player base into two, which IMO isn't a good idea.

In any case I believe there is some hidden complexity beyond just IPv6 support for enet.

Note: See TracTickets for help on using tickets.