Project

General

Profile

Actions

Emulator Issues #13129

open

Network: Wrong broadcast address used on Android

Added by Leseratte10 about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

What's the problem? Describe what went wrong.

This is a general bug in Dolphin's network code for Android that I noticed looking at the code. I didn't open a PR as I'm unsure how to fix that, never programmed anything for Android before. At least now the bug is documented here (if it's a bug and I'm not misunderstanding stuff).

Looking at the function GetSystemDefaultInterface in Source/Core/Core/IOS/Network/IP/Top.cpp, this function is supposed to return a DefaultInterface which according to the struct definition contains IPv4, subnet mask, and broadcast address.

Looking at how that function is implemented, on Windows and Linux it correctly returns IP, netmask and broadcast address.
On Android, the function calls GetNetworkGateway() which is a Java function that returns the Gateway of the current network connection. And then it returns that in place of the broadcast address. Also, it only returns something if the condition "if (addr || netmask || gateway)" is met - shouldn't that be "if (addr && netmask && gateway)" instead so no incomplete data is returned?

The code has that bug ever since it was introduced in PR 9191.

Another related bug is in the function below, GetSystemDefaultInterfaceOrFallback. It uses variable names "IP", "NETMASK" and "GATEWAY", though it returns IP, Netmask and Broadcast address. And the broadcast address that's included in the code there ("10.0.255.255") is neither a valid broadcast address nor a valid gateway address for that network (broadcast for that network would be 10.0.1.255).

Looking at what a real Wii does according to WiiBrew, that IOS call is supposed to return IP, Netmask & Broadcast, so the struct and the Windows/Linux implementation seems correct while the Android implementation is wrong.

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.

Yes, see https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/IOS/Network/IP/Top.cpp

Actions #1

Updated by sepalani about 1 month ago

Good catch, I completely missed that part since I initially thought it was returning the gateway address as suggested the variable name (which in reality seems to be a misnomer as you explained). Your other concerns sounds valid to me as well. I'll address them as soon as possible.

Actions

Also available in: Atom PDF