re-enabled the DDRace ip count check, then found it's useless tw trunk has it's own

fixed ip 0.0.0.0 showing for the rest of the notifications in server.cpp

Signed-off-by: GreYFoXGTi <GreYFoXGTi@Gmail.com>
This commit is contained in:
GreYFoXGTi 2010-07-29 13:09:25 +03:00
parent 7b5df1e1d3
commit a8d1c536af
3 changed files with 33 additions and 22 deletions

View file

@ -616,7 +616,6 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
NETADDR Addr;
CUnpacker Unpacker;
Unpacker.Reset(pPacket->m_pData, pPacket->m_DataSize);
// unpack msgid and system flag
int Msg = Unpacker.GetInt();
int Sys = Msg&1;
@ -658,11 +657,12 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
m_NetServer.Drop(ClientId, "Dropped due reserved slot");
return;
}
int i/*, ipcnt = 0*/; // ip count
//Start of 2cpip LemonFace
/*m_NetServer.ClientAddr(ClientId, &Addr);
//Start of 2cpip LemonFace
int i/*, ipcnt = 0*/; // ip count
Addr=m_NetServer.ClientAddr(ClientId);
m_aClients[ClientId].m_Addr = Addr; // store the address info
for(i=0; i<MAX_CLIENTS; i++)
/*for(i=0; i<MAX_CLIENTS; i++)
{
if(m_aClients[i].m_State != CClient::STATE_EMPTY) // if not an empty slot
{
@ -672,7 +672,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
m_aClients[i].m_Addr.ip[3] == Addr.ip[3])
{
if(clients[i].authed > 0) // authed players can have clones
if(m_aClients[i].m_Authed > 0) // authed players can have clones
{
ipcnt = 0;
break;
@ -683,16 +683,21 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
}
}
if(ipcnt > config.sv_max_connections) // if already n connections exist, drop him
if(ipcnt > g_Config.m_SvMaxConnections) // if already n connections exist, drop him
{
dbg_msg("server", "player dropped, too many connections. cid=%x ip=%d.%d.%d.%d",
cid,
clients[i].addr.ip[0], clients[i].addr.ip[1], clients[i].addr.ip[2], clients[i].addr.ip[3]
);
netserver_drop(net, cid, "Connections Per IP limit Exceeded");
dbg_msg("server", "Player dropped, too many connections. cid=%x ip=%d.%d.%d.%d",
ClientId,
Addr.ip[0],
Addr.ip[1],
Addr.ip[2],
Addr.ip[3]
);
char buf[100];
str_format(buf,sizeof(buf),"Connection count(%d) per IP Limit Exceeded, The Limit is %d", ipcnt, g_Config.m_SvMaxClientsPerIP);
m_NetServer.Drop(ClientId,buf);
return;
}
*/
} */
m_aClients[ClientId].m_State = CClient::STATE_CONNECTING;
SendMap(ClientId);
}
@ -897,7 +902,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
}
else
{
dbg_msg("server", "client tried to authenticate with empty password. cid=%x ip=%d.%d.%d.%d",
dbg_msg("server", "Client tried to authenticate with empty password. cid=%x ip=%d.%d.%d.%d",
ClientId,
m_aClients[ClientId].m_Addr.ip[0], m_aClients[ClientId].m_Addr.ip[1], m_aClients[ClientId].m_Addr.ip[2], m_aClients[ClientId].m_Addr.ip[3]
);

View file

@ -5,22 +5,28 @@
// TODO: remove this
#include "././game/variables.h"
//===============================
//===============================
MACRO_CONFIG_INT(SvReconnectTime,sv_reconnect_time,5,0,9999,CFGFLAG_SERVER,"how much time between leaves and joins")
MACRO_CONFIG_INT(SvVoteKickTimeDelay,sv_vote_kick_delay,0,0,9999,CFGFLAG_SERVER,"how much time between kick votes")
MACRO_CONFIG_INT(SvVoteMapTimeDelay,sv_vote_map_delay,0,0,9999,CFGFLAG_SERVER,"how much time between map votes")
MACRO_CONFIG_INT(SvMaxConnections,sv_max_connections, 2, 1, 16, CFGFLAG_SERVER, "Maximum count of connection from one IP server can accept")
MACRO_CONFIG_INT(SvMaxAfkTime,sv_max_afk_time, 0, 0, 9999, CFGFLAG_SERVER, "How many seconds a player is allowed to be afk, 0=disabled")
MACRO_CONFIG_INT(SvPauseable, sv_pauseable, 0, 0, 1, CFGFLAG_SERVER, "players can pause their char or not")
MACRO_CONFIG_INT(SvCheattime, sv_cheattime, 0, 0, 1, CFGFLAG_SERVER, "players can cheat with time or not")
MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER, "players can hammer/grenade/laser one another")
MACRO_CONFIG_INT(SvTunes, sv_tunes, 1, 0, 1, CFGFLAG_SERVER, "Turns Tuning On/Off")
//MACRO_CONFIG_INT(SvPhook, sv_phook, 1, 0, 1, CFGFLAG_SERVER, "Turns Player On/Off")
//MACRO_CONFIG_INT(SvNpc, sv_npc, 0, 0, 1, CFGFLAG_SERVER, "Turns NPC (No Player Collision) On/Off")
MACRO_CONFIG_INT(SvPhook, sv_phook, 1, 0, 1, CFGFLAG_SERVER, "Turns Player On/Off")
MACRO_CONFIG_INT(SvNpc, sv_npc, 0, 0, 1, CFGFLAG_SERVER, "Turns NPC (No Player Collision) On/Off")
MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER, "Turns Endless hooking On/Off")
MACRO_CONFIG_INT(SvCheats, sv_cheats, 0, 0, 1, CFGFLAG_SERVER, "Turns Cheats On/Off")
MACRO_CONFIG_INT(SvAllowColorChange, sv_allow_color_change, 1, 0, 1, CFGFLAG_SERVER, "Allow color change (can block rainbowmod)")
MACRO_CONFIG_INT(SvRconTries, sv_rcon_tries, 5, 0, 100, CFGFLAG_SERVER, "How Many Password Tries Before ban")
MACRO_CONFIG_INT(SvRconTriesBantime, sv_rcon_tries_bantime, 300, 0, 9999, CFGFLAG_SERVER, "How Much time will the brute rcon password attacker will be banned")
MACRO_CONFIG_STR(SvRconPasswordAdmin, sv_rcon_password_admin, 32, "", CFGFLAG_SERVER, "Remote console admin password")
MACRO_CONFIG_STR(SvRconPasswordModer, sv_rcon_password_moder, 32, "", CFGFLAG_SERVER, "Remote console moderator password")
MACRO_CONFIG_STR(SvRconPasswordHelper, sv_rcon_password_helper, 32, "", CFGFLAG_SERVER, "Remote console helper password")
MACRO_CONFIG_STR(SvRconPasswordHelper, sv_rcon_password_helper, 32, "", CFGFLAG_SERVER, "Remote console helper password")
//=============================== */
MACRO_CONFIG_STR(PlayerName, player_name, 24, "nameless tee", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Name of the player")
@ -81,7 +87,7 @@ MACRO_CONFIG_INT(SvPort, sv_port, 8303, 0, 0, CFGFLAG_SERVER, "Port to use for t
MACRO_CONFIG_INT(SvExternalPort, sv_external_port, 0, 0, 0, CFGFLAG_SERVER, "External port to report to the master servers")
MACRO_CONFIG_STR(SvMap, sv_map, 128, "dm1", CFGFLAG_SERVER, "Map to use on the server")
MACRO_CONFIG_INT(SvMaxClients, sv_max_clients, 8, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients that are allowed on a server")
MACRO_CONFIG_INT(SvMaxClientsPerIP, sv_max_clients_per_ip, 8, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients with the same IP that can connect to the server")
MACRO_CONFIG_INT(SvMaxClientsPerIP, sv_max_clients_per_ip, 2, 1, MAX_CLIENTS, CFGFLAG_SERVER, "Maximum number of clients with the same IP that can connect to the server")
MACRO_CONFIG_INT(SvHighBandwidth, sv_high_bandwidth, 0, 0, 1, CFGFLAG_SERVER, "Use high bandwidth mode. Doubles the bandwidth required for the server. LAN use only")
MACRO_CONFIG_INT(SvRegister, sv_register, 1, 0, 1, CFGFLAG_SERVER, "Register server with master server for public listing")

View file

@ -352,7 +352,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
if(FoundAddr++ >= m_MaxClientsPerIP)
{
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "only %i players with same ip allowed", m_MaxClientsPerIP);
str_format(aBuf, sizeof(aBuf), "Only %i players with the same ip is/are allowed.", m_MaxClientsPerIP);
CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, aBuf, sizeof(aBuf));
return 0;
}