Socket: Fix AF_INET6 on non-Windows systems #9705
Merged
+20
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
WiiSockMan::NewSocketin Socket.cpp is the function that's responsible for creating a host network socket when the emulated game wants to make a socket.Currently, Dolphin assumes that an IPv6 socket (AF_INET6) requested by the emulated software has the same integer value (23) on all operating systems and just passes that 23 through to the
socketcall.That assumption is true on Windows, but it's not true on other OSes.
AF_INET6 is 23 on a Wii and on Windows, but it's 10 on most Linux systems, and 30 on MacOS or iOS.
In theory, the same thing is true for IPv4 (AF_INET), too. AF_INET isn't 100% guaranteed to be 2, though it probably always is. Still, I added that bugfix for IPv4, too, just in case.
This particular issue is probably not a big deal as I don't know of any Wii software that attempts to use any kind of IPv6 connection whatsoever, but it is a bug nevertheless.
I wanted to try and add IPv6 support to Wii games after I noticed that Wii IOSes seem to actually support IPv6 in some way, did a first test in Dolphin on a Linux machine and noticed this address family value being wrong.
Who knows, maybe I'll actually get that to work on a Wii some time; in that case I would probably be making more PRs as it looks like none of the other code that converts a host
sockaddr_into a Wiisockaddr_inis currently capable of handling IPv6, but I wanted to get this bug fixed so I don't forget about it. Missing code (as in not handling IPv6sockaddr_ins correctly) is probably better than known-broken code like this one.I can confirm that without this change, Wii software can't open an IPv6 socket on Linux, and with this change it can. But of course I wasn't able to actually send / receive anything as there's too much other code that doesn't yet support IPv6.