Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket: Fix AF_INET6 on non-Windows systems #9705

Merged
merged 1 commit into from May 13, 2021
Merged

Socket: Fix AF_INET6 on non-Windows systems #9705

merged 1 commit into from May 13, 2021

Conversation

Leseratte10
Copy link
Contributor

WiiSockMan::NewSocket in 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 socket call.

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_in to a Wii sockaddr_in is 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 IPv6 sockaddr_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.

@lioncash lioncash merged commit 0ef88d4 into dolphin-emu:master May 13, 2021
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants