Opened 6 months ago

Last modified 6 months ago

#14371 new defect

LAN: Server's IP interface is sometimes from a virtual adapter

Reported by: antoniou79 Owned by:
Priority: normal Component: --Other--
Version: Keywords: LAN, IP interface
Cc: Game:


This is was noted on ScummVM 2.8git compiled from master HEAD) on Windows 10 x64.

When activating the LAN feature from Global Options...-> LAN -> Run server, ScummVM would choose an IP interface which corresponds to a virtual ethernet adapter named vEthernet (WSL) Hyper-V Virtual Ethernet Adapter. The resulting url for the server was:
As far as I can tell this is something set up by WSL2 (Windows Subsystem for Linux).

The preferrable IP interface in my case would be the one of my home LAN using the IP range:, which is also the main network that the OS is using (to access the router/Internet and other devices in the LAN).

Yet, there is no way to customise this. Ideally, ScummVM would be able to autodetect the preferrable LAN interface.

From a short discussion on Discord, similar issue can happen on Linux and iOS.

A relevant excerpt from the discussion that might be helpful in the resolution of the issue:

(criezy) The IP comes from SDL_Net (look for SDLNet_ResolveHost in backends/networking/. Hopefully the code could be improved for all platforms there, without requiring platform-specific code to get a usable IP.
(rootfather) Looks like SDLnet simply picks the first IP configured on the system, regardless of the interfaces

Change History (1)

comment:1 by sev-, 6 months ago

I did a small investigation.

We are using SDLNet_ResolveHost() to get the IP address. The implementation in SDL_net ( returns this:


And there is this define:

#define h_addr  h_addr_list[0]  /* address, for backward compatibility */

E.g. we return only the first address which could be incorrect in case there are several interfaces.

Instead, we would need to iterate over the returned addresses like this:

    for (int i = 0; hp->h_addr_list[i] != 0; ++i) {
        struct in_addr addr;
        memcpy(&addr, hp->h_addr_list[i], sizeof(struct in_addr));

And then return the list of addresses. The complication is that our current code keeps not the IP address but generates a URL with port and protocol:

So, that part has to be refactored.

My idea is that we show all of these addresses in GUI when we launch the local server.

Note: See TracTickets for help on using tickets.