mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Engine: use dedicated convar to determine rcon server socket bind
Decoupled from net_usesocketforloopback since we actually don't want this to be tied with that of the game. Now it by default does not bind to the loopback socket unlike the game.
This commit is contained in:
parent
62e6f11b34
commit
b8bde9ad0e
@ -228,28 +228,6 @@ void VPK_Unmount_f(const CCommand& args)
|
||||
FileSystem()->UnmountVPKFile(args.Arg(1));
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
NET_UseSocketsForLoopbackChanged_f
|
||||
|
||||
Use random AES encryption
|
||||
key for game packets
|
||||
=====================
|
||||
*/
|
||||
void NET_UseSocketsForLoopbackChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same value.
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
// Reboot the RCON server to switch address type.
|
||||
RCONServer()->Reboot();
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
}
|
||||
|
||||
void LanguageChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
|
@ -14,7 +14,6 @@ void VPK_Pack_f(const CCommand& args);
|
||||
void VPK_Unpack_f(const CCommand& args);
|
||||
void VPK_Mount_f(const CCommand& args);
|
||||
void VPK_Unmount_f(const CCommand& args);
|
||||
void NET_UseSocketsForLoopbackChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
#ifndef DEDICATED
|
||||
|
||||
void GFX_NVN_Changed_f(IConVar* pConVar, const char* pOldString);
|
||||
|
@ -256,7 +256,6 @@ void ConVar_InitShipped(void)
|
||||
mp_gamemode->RemoveChangeCallback(mp_gamemode->m_fnChangeCallbacks[0]);
|
||||
mp_gamemode->InstallChangeCallback(MP_GameMode_Changed_f, false);
|
||||
net_usesocketsforloopback->RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
net_usesocketsforloopback->InstallChangeCallback(NET_UseSocketsForLoopbackChanged_f, false);
|
||||
#ifndef DEDICATED
|
||||
language_cvar->InstallChangeCallback(LanguageChanged_f, false);
|
||||
#endif // !DEDICATED
|
||||
|
@ -32,6 +32,7 @@ static const char s_BannedMessage[] = "Go away.\n";
|
||||
static void RCON_PasswordChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
static void RCON_WhiteListAddresChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
static void RCON_ConnectionCountChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
static void RCON_UseLoopbackSocketChanged_f(IConVar* pConVar, const char* pOldString);
|
||||
|
||||
static ConVar sv_rcon_password("sv_rcon_password", "", FCVAR_RELEASE, "Remote server access password (rcon server is disabled if empty)", &RCON_PasswordChanged_f);
|
||||
static ConVar sv_rcon_sendlogs("sv_rcon_sendlogs", "0", FCVAR_RELEASE, "Network console logs to connected and authenticated sockets");
|
||||
@ -45,6 +46,8 @@ static ConVar sv_rcon_maxconnections("sv_rcon_maxconnections", "1", FCVAR_RELEAS
|
||||
static ConVar sv_rcon_maxframesize("sv_rcon_maxframesize", "1024", FCVAR_RELEASE, "Max number of bytes allowed in a message frame from a non-authenticated netconsole", true, 0.f, false, 0.f);
|
||||
static ConVar sv_rcon_whitelist_address("sv_rcon_whitelist_address", "", FCVAR_RELEASE, "This address is not considered a 'redundant' socket and will never be banned for failed authentication attempts", &RCON_WhiteListAddresChanged_f, "Format: '::ffff:127.0.0.1'");
|
||||
|
||||
static ConVar sv_rcon_useloopbacksocket("sv_rcon_useloopbacksocket", "0", FCVAR_RELEASE, "Whether to bind rcon server to the loopback socket", &RCON_UseLoopbackSocketChanged_f);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -86,7 +89,7 @@ void CRConServer::Init(const char* pPassword, const char* pNetKey)
|
||||
return;
|
||||
}
|
||||
|
||||
const char* pszAddress = net_usesocketsforloopback->GetBool() ? NET_IPV6_UNSPEC : NET_IPV6_LOOPBACK;
|
||||
const char* pszAddress = sv_rcon_useloopbacksocket.GetBool() ? NET_IPV6_UNSPEC : NET_IPV6_LOOPBACK;
|
||||
|
||||
m_Address.SetFromString(Format("[%s]:%i", pszAddress, hostport->GetInt()).c_str(), true);
|
||||
m_Socket.CreateListenSocket(m_Address);
|
||||
@ -797,6 +800,23 @@ static void RCON_ConnectionCountChanged_f(IConVar* pConVar, const char* pOldStri
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: change whether to bind on loopback socket
|
||||
//-----------------------------------------------------------------------------
|
||||
static void RCON_UseLoopbackSocketChanged_f(IConVar* pConVar, const char* pOldString)
|
||||
{
|
||||
if (ConVar* pConVarRef = g_pCVar->FindVar(pConVar->GetName()))
|
||||
{
|
||||
if (strcmp(pOldString, pConVarRef->GetString()) == NULL)
|
||||
return; // Same value.
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
// Reboot the RCON server to switch address type.
|
||||
RCONServer()->Reboot();
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static CRConServer s_RCONServer;
|
||||
CRConServer* RCONServer() // Singleton RCON Server.
|
||||
|
Loading…
x
Reference in New Issue
Block a user