Raised This Month: $12 Target: $400
 3% 

[SourceMod]Issue in GetClientIP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Balimbanana
Member
Join Date: Jan 2017
Old 11-25-2020 , 03:42   [SourceMod]Issue in GetClientIP
Reply With Quote #1

Is there another method to GetClientIP?
In this situation, a larger server host is hosting several servers in a data center with port triggering through multiple routes to get supposedly lower latency for clients from anywhere.

The issue is that SourceMod's GetClientIP is returning the redirection server IP for all clients.
status returns all the correct IP's. However, this means the only method left is attempting to dump the return of status and sorting the information from file or larger buffer.
I am not sure if this should be considered a SourceMod bug, as the IP's are correctly shown in status and it renders all IP based votes and/or SM bans useless.
Balimbanana is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-25-2020 , 09:00   Re: [SourceMod]Issue in GetClientIP
Reply With Quote #2

The IP address comes from the engine (IServerGameClients::OnClientConnect), so if it is different from what is showing in `status` there is probably some hackery going on - SRCDS has no NAT support of it's own and has no way to pull real IPs from proxied connections.
__________________
asherkin is offline
Balimbanana
Member
Join Date: Jan 2017
Old 11-25-2020 , 15:09   Re: [SourceMod]Issue in GetClientIP
Reply With Quote #3

My guess at this point would be that SourceMod is getting the IP before it is resolved:
https://github.com/alliedmodders/sou...ager.cpp#L2043

This is a CSS server that I am helping with, and the IP's are returned correctly on a local server, just not the datacenter server.
The IP appears to be stored statically on player initialized, but I think that the IP is still being resolved at this point. Here are a couple returns when joining that I added:
Code:
"Balimbanana<2706><[U:1:40096491]><>" STEAM USERID validated

MetaMod plugin (no source as far as I can find):
[A-BotsMM] Hook_ClientConnect(14, "Balimbanana", "<CorrectIPAddress>:27005")

MetaMod plugin using the same SourceMod returns:
[DmgMM] Hook_ClientConnect(14, "Balimbanana", "<RedirectionIP>:31437")

OnClientConnect <RedirectionIP>:31437
OnClientConnected <RedirectionIP>:31437
OnClientAuthorized <RedirectionIP>:31437
The port of 31437 is in a dynamic port range not really assigned to anything. Maybe SM could check if the range of 31417-31456 as the connection port is being used and attempt to re-check the IP address.
That port is returned in SM by GetClientIP(i, szIP, sizeof(szIP), false);
Balimbanana is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-25-2020 , 15:11   Re: [SourceMod]Issue in GetClientIP
Reply With Quote #4

It sounds like the server is running a plugin that is replacing it with the correct IP.
__________________
asherkin is offline
Balimbanana
Member
Join Date: Jan 2017
Old 11-25-2020 , 15:26   Re: [SourceMod]Issue in GetClientIP
Reply With Quote #5

I am not too sure why that specific plugin would go through extra lengths to resolve the actual IP though.
What it looks like is an SM specific issue, not MM or SRCDS.
All those returns were at the same time upon joining.

Last edited by Balimbanana; 11-25-2020 at 19:21.
Balimbanana is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode