devkitPro / libogc

C Library for Wii and Gamecube homebrew
https://devkitpro.org/viewforum.php?f=40
Other
283 stars 69 forks source link

network_wii's if_config() does not populate netmask or gateway #179

Open emilydaemon opened 1 week ago

emilydaemon commented 1 week ago

Bug Report

What's the issue you encountered?

network_wii's if_config function does not populate netmask or gateway, even though these are accepted as parameters. I expected them to be populated with subnet mask and default gateway respectively, but the function does not make any changes to them.

How can the issue be reproduced?

  1. Copy the template project folder.
  2. Include the network.h header.
  3. Call if_config() with three separate character arrays (each 16 characters long). The last two parameters should be set to TRUE and 20.
  4. Check the values of each array. The first one is populated as expected (ex. 192.168.68.52), but the second and third arrays are left unchanged.

Environment?

I am using Windows 10 with the supplied msys2 shell, but I do not believe that this is relevant to the problem.

DacoTaco commented 1 week ago

hey emily!

just took a quick look, and it seems the parameters are unused ( https://github.com/devkitPro/libogc/blob/master/libogc/network_wii.c#L1192 ) ! question is though, are they retrieved in the ios calls... ill have to dig deeper!

EDIT : look like it'll need to be retrieved from IOS using some calls like it does for the ip : https://github.com/devkitPro/libogc/blob/master/libogc/network_wii.c#L304

the wiibrew documentation is very... bare for the network stuff. maybe we can find this stuff somewhere else ?

DacoTaco commented 1 week ago

found something in dolphin. IOS' /dev/net/ip/top device has a IOCTLV called GetInterfaceOption that can retrieve the ip, gateway and subnet mask given the right sub command id. i think our GetHostIp call needs to be replaced with this. source : https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/IOS/Network/IP/Top.cpp#L981-L991

DacoTaco commented 6 days ago

image

got the call implemented. need to clean up my code and fix dolphin's implementation of the ioctlv :) gateway isn't right though, thats the wifi broadcast ip.. :/