srcdslab / sm-plugin-FixNetPublicAdr

Add/Edit convar net_public_adr for servers behind NAT/DHCP
0 stars 1 forks source link

Does this work in L4D2? #4

Open rikka0w0 opened 3 months ago

rikka0w0 commented 3 months ago

Although L4D2 supports +net_public_adr, it is not properly implemented. When I specify +net_public_adr in the startup command-line, srcds still reports the wrong IP.

https://github.com/ValveSoftware/Source-1-Games/issues/3207

Rushaway commented 3 months ago

Hi, I can be wrong since it's @maxime1907 who's mostly handling server installation most of the time, but as I saw in your comment, your current startup:

./srcds_run -game left4dead2 -port 27114 -insecure -num_edicts 8191 +net_public_adr SG +hostport 27114 +ip 0.0.0.0 +maxplayers 8 +map c5m1_waterfront +allow_all_bot_survivor_team 1 +sv_gametypes coop

Did you try to replace the +ip 0.0.0.0 with your game machine IP ?

maxime1907 commented 3 months ago

even with 0.0.0.0 it should be working but we never really tried it on left4dead2 so PRs are welcome!

rikka0w0 commented 2 months ago

I tested the plugin, and it doesn't work in L4D2.

My setup includes two machines, one in Singapore (IP is SG), one in Australia (IP is AU). I would like to host the L4D2 server on the AU machine, set up a UDP forwarding on the SG machine, and register the IP of the SG machine to the steam server list: Client/Steam ---> SG:27114 ---> AU:27114

I installed the plugin:

sm plugins list
  32 "FixNetPublicAddr" (1.1.1) by maxime1907, .Rushaway

sm version
 SourceMod Version Information:
    SourceMod Version: 1.11.0.6968
    SourcePawn Engine: 1.11.0.6968, jit-x86 (build 1.11.0.6968)
    SourcePawn API: v1 = 5, v2 = 16
    Compiled on: Jun 23 2024 19:38:55
    Built from: https://github.com/alliedmodders/sourcemod/commit/13510eab
    Build ID: 6968:13510eab
    http://www.sourcemod.net/

status
hostname: xxxx

version : 2.2.4.1 9309 insecure  (unknown)
udp/ip  : 192.168.1.21:27114 [ public SG_IP:27114 ]
os      : Linux Dedicated
map     : c5m1_waterfront
players : 0 humans, 0 bots (16 max) (not hibernating) (unreserved)

# userid name uniqueid connected ping loss state rate adr
#end

And my configuration (set in cfg/sourcemod/plugin.FixNetPublicAdr.cfg) looks like:

sm_fixnetpublicaddr_custom_ip "SG_IP"
sm_fixnetpublicaddr_method "2"

I confirmed that players can join the server using the connect console command via both SG_IP:27114 and AU_IP:27114, so the firewall and port forwarding are correctly configured.

Steam API https://api.steampowered.com/isteamapps/getserversataddress/v0001?addr=SG_IP shows nothing, but https://api.steampowered.com/isteamapps/getserversataddress/v0001?addr=AU_IP shows the L4d2 server. It should be the other way around. Looks like L4D2 is ignoring the value of net_public_adr and sending the public IP of the AU machine (where the L4d2 server actually runs) to the Steam server list.

rikka0w0 commented 2 months ago

Did you try to replace the +ip 0.0.0.0 with your game machine IP ?

Tried, it makes no difference.

maxime1907 commented 2 months ago

oh okay i understand the confusion, this plugin only creates/changes the cvar value but does not actually interact with steam by itself so i guess this behavior is expected

its essentially only used with third party plugins that retrieve the cvar value to understand which public ip to use like the discord map notification plugin that sends a connect link with the correct ip instead of 0.0.0.0