[Scummvm-tracker] [ScummVM :: Bugs] #14371: LAN: Server's IP interface is sometimes from a virtual adapter

ScummVM :: Bugs trac at scummvm.org
Fri Mar 31 08:58:11 UTC 2023


#14371: LAN: Server's IP interface is sometimes from a virtual adapter
------------------------------+------------------------
Reporter:  antoniou79         |       Owner:  (none)
    Type:  defect             |      Status:  new
Priority:  normal             |   Component:  --Other--
 Version:                     |  Resolution:
Keywords:  LAN, IP interface  |        Game:
------------------------------+------------------------
Comment (by sev-):

 I did a small investigation.

 We are using SDLNet_ResolveHost() to get the IP address. The
 implementation in SDL_net (https://github.com/libsdl-
 org/SDL_net/blob/main/SDLnet.c#L186) returns this:
 {{{
   SDL_memcpy(&address->host,hp->h_addr,hp->h_length);
 }}}

 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:
 https://github.com/scummvm/scummvm/blob/master/backends/networking/sdl_net/localwebserver.cpp#L288

 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.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/14371#comment:1>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list