iw4x-client icon indicating copy to clipboard operation
iw4x-client copied to clipboard

IW4X doesn't respect net_ip - Listens on TCP, not UDP

Open Ayymoss opened this issue 3 years ago • 4 comments

Both Windows and Linux (WINE) are affected.

My dedicated server has multiple public IPs, binding on the secondary IP via +set net_ip <x> listens on TCP but you cannot connect in-game (UDP).

The intention is to bind on my secondary (floating) IP so if I upgrade/change service on my provider I don't lose the IP and people's favourites.

Other services I run on the server respect IP binding correctly.

Windows Testing Method

  • Assign secondary static IP to main NIC adapter via Network and Sharing Centre
  • Added these arguments to start parameters -dedicated +set net_ip XX.XX.XX.XX +set net_port XXXXX
  • Start the server. You should be able to see the server via the HTTP server, however, you should not be able to connect in-game.

Linux Testing Method

  • Assign secondary static IP in your distro...
  • Follow Windows testing method, but run via wine.
  • Same result, accessible via HTTP, not in-game.

Update/Edit: You'll be able to see the HTTP server, but unable to connect to the game via the IP. It binds on the default or "primary" NIC address; which isn't the expected output/functionality of net_ip.

Ayymoss avatar Jan 20 '22 23:01 Ayymoss

Investigated this on behalf of @MrAmos123. This is a multifaceted issue.

  1. IW4's Sys_StringToSockaddr is improperly setting up the sockaddr->sin_addr value when net_ip is supplied (Not sure where it's going wrong, but hooking and reimplementing this routine fixes the issue outright on windows)
  2. WINE compatibility on Linux is inconsistent when attempting to bind the socket with a net_ip (Even post-fix) specified (Ubuntu 20.04 with WINE 6 and WINE 5 fails, Debian 11 with WINE 6 also fails, but Debian 11 with WINE 5 or WINE 4 work.

RaidMax avatar Jan 23 '22 15:01 RaidMax

I will attempt to debug Sys_StringToSockaddr to confirm where and what fails.

diamante0018 avatar Feb 06 '22 19:02 diamante0018

Resolved in 0.7+.

Ayymoss avatar Jun 05 '22 18:06 Ayymoss

Nevermind. This isn't resolved.

Test Environment: OS: Debian 10 Interfaces: 2, DHCP Wine: 7

It fails to bind on a secondary IP address, however, binds correctly using Wine 4.

Ayymoss avatar Jun 16 '22 09:06 Ayymoss