https://bugs.winehq.org/show_bug.cgi?id=46940
--- Comment #6 from Brendan Shanks bshanks@codeweavers.com --- A full description of the problem:
GTA V (and probably other Rockstar games) gets the local hostname using gethostname(), and then calls getaddrinfo() with the hostname to get the list of local IP addresses. It takes that address and uses it as a source address when listening for local network communications, it's also shown in-game as "Local IP" in the Social Club overlay->Settings->Network.
The Windows documentation for getaddrinfo() supports this usage: "If the pNodeName parameter points to a computer name, all permanent addresses for the computer that can be used as a source address are returned. On Windows Vista and later, these addresses would include all unicast IP addresses returned by the GetUnicastIpAddressTable or GetUnicastIpAddressEntry functions in which the SkipAsSource member is set to false in the MIB_UNICASTIPADDRESS_ROW structure."
Wine's getaddrinfo() calls through to the host getaddrinfo(), which works very similarly but does not document any guarantee like this.
Debian, Ubuntu, Arch, and likely other Linux distributions define the local hostname to be '127.0.1.1' in /etc/hosts, apparently as a workaround for GNOME (https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostna...). When getaddrinfo() is called for the local hostname, '127.0.1.1' is the only address returned.
With the '127.0.1.1' line commented out in /etc/hosts, Linux getaddrinfo() works as expected and returns all local IP addresses.
I haven't figured out any way to use Linux getaddrinfo() to return the local IP addresses (without modifying /etc/hosts). I suspect the solution here is for Wine's getaddrinfo() to detect when the local hostname is being supplied, and use an alternate function to get the local IPs (like GetAdaptersAddresses or GetUnicastIpAddressTable). It looks like this is how gethostbyname() works already.