Open RoddyDev opened 1 month ago
https://github.com/coop-deluxe/sm64coopdx/assets/45442056/7cddbc78-57b0-4d07-a22e-d59fa3f79f1e
Video of it in action (very low quality to fit in 10 MB) IPv6-only server for testing: mariocoop.roddydev.com
Finally got the compiler to work on Windows and can confirm that it can connect normally to any server hosted on either Windows or Linux systems. I'm unable to test on macOS but it should also work the same way.
https://github.com/user-attachments/assets/ba6352e1-32b2-4cc9-bba9-5a4cd3870c8f
Here's a Windows client connecting to a server hosted on Linux.
Tested this on macOS, works fine!
Tested this on macOS, works fine!
Thank you so much for testing.
I don't think there's anything else to add here anymore. Everything works perfectly in all platforms.
The only requirement is that IPv6 needs to be enabled in your network adapter settings. (Does not require actual IPv6 connectivity + it's enabled by default in all operating systems today). Maybe we should add a fallback to AF_INET socket or show an error on screen if binding to an AF_INET6 socket fails (which means IPv6 is disabled on the system).
Edit: Guess it's not really a requirement? Tried to host with IPv6 disabled on the network adapter settings on both Windows and Linux, and it still bound to all addresses without any issues. Unless the IPv6 stack is completely absent from the system like some do with Linux? Not sure.
Coopnet is untouched and also works perfectly normal. I don't know if the edits in the translation files are really necessary, so feel free to edit these back to what it was if you want. For now, I call this final. Waiting for further testing from the maintainers.
imo there should still be a way for ipv4 to be used, what is the current behavior if ipv6 fails?
imo there should still be a way for ipv4 to be used, what is the current behavior if ipv6 fails?
Having IPv6 support doesn't mean that IPv4 support will be removed, you can still use it. When hosting a server using Direct Connection, it creates an AF_INET6 socket with IPV6_V6ONLY disabled so it does have IPv4+IPv6 support when binding to all addresses (in6addr_any). In my testings, neither Windows nor Linux complains when IPv6 is disabled on the network adapter and can still host.
When joining, getaddrinfo() returns an address depending if IPv6 connection is working or not. If it is, return IPv6 addresses first, if not, return IPv4 addresses first.
What I want to say is: If you don't have an IPv6 enabled network, it won't break! The AF_INET6 socket will still work. You just will only be reachable over IPv4. In an IPv6-only network: Coopnet will still be unreachable, but you will now be able to host and join direct connection servers.
neither Windows nor Linux complains when IPv6 is disabled on the network adapter and can still host.
can confirm macOS also doesn’t complain, and connects just fine.
You only have the English and Portuguese language translations, I'd need you to get translations for other languages before I can merge this.
Uploaded the translations. Cannot guarantee that the translations are accurate except English, Portuguese and German, because these three were translated from native speakers.
If the translations are the problem that this isn't being merged, I can just revert them to what it was before. I just wanted to let the user know that both protocols are supported.
Resolves #172
This updates sockets to use AF_INET6 with dual-stack support instead of AF_INET, and all IP address structs from sockaddr_in to sockaddr_in6. That means IPv4 addresses are treated as IPv6-mapped (Example: ::ffff:192.168.1.69) for compatibility.
Direct Connection input box was also updated for this change. It now supports direct IPv4, direct IPv6 addresses and hostnames. IPv6 addresses must be enclosed in square brackets [IPv6]:port to be able to separate IP from port, otherwise it will be treated as an IPv4 address or hostname. Would be better if IP and port had it's own input boxes, though.
resolve_domain() now uses getaddrinfo() to get IPv4 and IPv6 addresses from a hostname, replacing the deprecated gethostbyname(). The only limitation in my code for resolve_domain() is that it still only grabs the first address it sees and returns. But getaddrinfo() is smart enough that it prioritizes IPv4 for those without IPv6 connectivity, so it shouldn't be a problem for now.
Trying to connect to this updated version from v1.0 connects normally on Windows, showing "Version mismatch". Trying to connect to this updated version from v1.0 causes a crash on Linux, but it connects normally when using the same updated version. The updated version was only tested on Linux. Couldn't get the compiler to work on Windows, even after following the compilation guide. Might need to get someone to test it for me on Windows before merging.