2617 Commits

Author SHA1 Message Date
Kawe Mazidjatari
d978d0c745 Reduce address buffer size to 128
128 is the max size that the entire address string could be (with it being ipv6 and bracketed with ports).
2023-04-30 02:10:57 +02:00
Kawe Mazidjatari
4554a92e27 Prevent connecting to null address string
Add check to prevent connect code getting fired if address buffer is empty.
2023-04-30 02:08:40 +02:00
Kawe Mazidjatari
f319fc0846 Use server global variables for client loops
Use server global variables for determining the num clients to loop over. This is cheaper and better than always looping over MAX_PLAYERS.
2023-04-30 01:50:38 +02:00
Kawe Mazidjatari
6b23570beb Ban system bug fix and improvements
* Format the ip as '[ip]:port' in all logging calls for consistency.
* Fixed a bug causing the IP to be send up as full instead of base only to master server (should always be base only).
* Temporarily uncommented the plugin callback logic.
2023-04-30 01:29:54 +02:00
Kawe Mazidjatari
98f09b25de CClient: Member type improvements
* Made 'm_nUserID' signed.
2023-04-30 01:26:37 +02:00
Kawe Mazidjatari
4ec8e67d9b CNetChan: Getters improvements
* Allow for requesting address base only.
* Added new getter 'GetPort'.
2023-04-30 01:24:45 +02:00
Kawe Mazidjatari
78a86fed6a Log address of 'SV_BroadcastVoiceData' 2023-04-29 21:07:45 +02:00
Kawe Mazidjatari
55aa254e6b Merge branch 'bulk_check' into indev 2023-04-29 21:01:59 +02:00
Kawe Mazidjatari
d52074238f Mark pylon refresh cvars as devonly
Marked 'sv_pylonRefreshRate' and 'sv_banlistRefreshRate' as development only.
2023-04-29 20:44:51 +02:00
Kawe Mazidjatari
7ecad819be Set dedicated nucleus id to '9990000' 2023-04-29 20:36:57 +02:00
Kawe Mazidjatari
a5bc2f77cb Fix broken 'SV_IsClientBanned' implementation
SV_IsClientBanned is now checked after the creating of CClient, and thus 'CServer::AuthClient' has been inlined into 'CServer::ConnectClient'. Since we have to request the master server to check whether or not this particular client is globally banned, we have to detach it into a separate thread, and process the results back into the main thread once finished. This takes too much time, so we connect the client anyways and if the master server marked it as 'banned', we disconnect it right away.
2023-04-29 20:36:29 +02:00
Kawe Mazidjatari
2748c61fe2 Put json value getters in try catch
Put 'nlohmann::json::value' operations in try catch, as these could raise an exception.
2023-04-29 14:58:46 +02:00
Kawe Mazidjatari
145bc3797f Only check token field if the server is hidden 2023-04-29 13:15:18 +02:00
Kawe Mazidjatari
d46061a55a Don't log GPU device on dedicated 2023-04-29 12:16:09 +02:00
Kawe Mazidjatari
3ea49766c6 Light banning code improvements
* Removed extraneous std::string constructors (everything using the bansystem used raw char pointers).
* Improved logging and function comments.
2023-04-29 12:15:51 +02:00
rexx
dca27475ec (re)implement sv_alltalk
Rebuilds SV_BroadcastVoiceData with an additional check of "sv_alltalk" cvar to disable team checking, allowing for servers to enable global voice chat
2023-04-29 11:11:10 +01:00
Kawe Mazidjatari
ab9d36e0d8 Send client's persona name to the master server
Will be used on the master server for additional checking.
2023-04-29 00:05:47 +02:00
Kawe Mazidjatari
7739e56b0d Adjust default value of cvar 'sv_banlistRefreshRate'
Set to 30 sec.
2023-04-28 23:48:30 +02:00
Kawe Mazidjatari
48bc69b028 Initial implementation of bulk ban checking
Initial implementation of the bulk ban check system. This implementation takes a snapshot of the currently connected clients, sends it up to the master server, and the master server returns anything within this list that is marked 'banned'. The server would then kick the player from the server. This commit also removes the global banned list cache, as the bulk checking system offers a lot more freedom regarding banning specific players and have it sync across all available servers.
2023-04-28 23:47:58 +02:00
rexx
6b1d02dfea
Merge pull request #94 from O-Robotic/indev
Fix plugin directory creation
2023-04-27 21:02:44 +01:00
O-Robotic
a54e1df06a Fix plugin directory creation 2023-04-27 20:34:05 +01:00
Kawe Mazidjatari
fcc4b410f3 Improve formatting in pylon code 2023-04-26 23:31:16 +02:00
Kawe Mazidjatari
a1c97e1b39 Fix assignment bug
Sigscan results returned to the wrong var.
2023-04-26 23:31:03 +02:00
Kawe Mazidjatari
9872b4042a Improve pylon error logging
Improve error formatting.
2023-04-25 22:57:06 +02:00
Kawe Mazidjatari
73fe590f99 Fix small bug
Fixed bug caused by const char* to const string& conversion, resulting in the request message not always getting sent properly.
2023-04-25 22:51:06 +02:00
Kawe Mazidjatari
0399d753f4 Properly toggle cvars in sdk launcher
Toggle them on or off instead of just on. Else disabling the toggle wouldn't disable then in the runtime as the default value of these cvars is '1'.
2023-04-25 00:47:44 +02:00
Kawe Mazidjatari
d9fa611418 Add new callbacks to server functions
A few new callback hooks which are perhaps useful in the future.
2023-04-25 00:46:45 +02:00
Kawe Mazidjatari
000f7c7f82 CPylon parsing/logging code deduplication
Deduplicated parsing and logging code. Results are a lot more consistent and comprehensive.
2023-04-25 00:45:39 +02:00
Kawe Mazidjatari
f0a561552b CPylon server query code deduplication
Created another dedicated wrapper for handling API requests; significantly reduced duplicate code.
2023-04-24 01:55:37 +02:00
Kawe Mazidjatari
aff4b6125e CPylon error handling code deduplication
Deduplicate code.
2023-04-24 00:32:27 +02:00
rexx
3eb660c9f7 enable pluginsystem 2023-04-23 22:28:16 +01:00
Kawe Mazidjatari
59b685b7ee Fix unreachable code warning
This code isn't reachable, removed.
2023-04-23 20:35:08 +02:00
Kawe Mazidjatari
8898b44dee Fix memory leak in ImGui panels
Properly release texture buffers.
2023-04-23 20:34:36 +02:00
Kawe Mazidjatari
615de70b1f Fix shutdown crash
Fixed crash due to destructor of CSocketCreator being called during shutdown. If the socket fails to close, an error is logged. But at this point, all sockets have been closed already and the logger system has already been destroyed. Allocated as dynamic memory to avoid destructor being called at this stage.
2023-04-23 18:01:30 +02:00
Kawe Mazidjatari
1eef4aacb4 Improve signatures
Better signatures, and fix signature/compile errors for s1 and s2.
2023-04-23 17:05:00 +02:00
Kawe Mazidjatari
b11e5d539c Light code cleanup
Compiler output did not change; logic remained identical.
2023-04-23 11:35:09 +02:00
Kawe Mazidjatari
02bef4c2dd Light cleanup in CPylon
Force consistency.
2023-04-22 22:00:20 +02:00
Kawe Mazidjatari
d69451466c Add assert in 'CNetAdr::ToString'
Main thread only from now on. Any other thread should manually pass in a buffer.
2023-04-22 21:46:37 +02:00
Kawe Mazidjatari
df81d52398 Improve assert
Fix assert condition where iSocket and GetAcceptedSocketCount are both 0.
2023-04-22 21:46:05 +02:00
Kawe Mazidjatari
13fcdaa442 Fix bug in 'CServer::AuthClient'
The IP that is sent to the server should be in base format only (no brackets or port). The buffer size was also too small to contain the entire length of the full IP address with port and brackets.
2023-04-22 20:30:53 +02:00
Kawe Mazidjatari
d56c24ce05 'CNetConBase::Recv' cleanup 2023-04-22 18:13:42 +02:00
Kawe Mazidjatari
9829684183 Set max value for rcon cvars
Clamp 'sv_rcon_maxsockets' and 'sv_rcon_maxconnections' to MAX_PLAYERS as it could otherwise crash the game if set too high.
2023-04-22 18:13:27 +02:00
Kawe Mazidjatari
50b3273101 Add change callback for 'sv_rcon_maxconnections'
If 'sv_rcon_maxconnections' is set higher than current auth socket count, reopen listen socket. If its set lower, close all sockets until auth socket count matches 'sv_rcon_maxconnections'. Sockets are getting closed in reverse order, so the netcon that connected last will be disconnected first.
2023-04-22 16:51:18 +02:00
Kawe Mazidjatari
9b65c7e59c Light cleanup 2023-04-22 16:49:22 +02:00
Kawe Mazidjatari
be61c93c85 RCON system improvements
* Added more error handling throughout code.
* Marked function parameters 'const' where possible.
* Updated comments.
2023-04-22 16:02:54 +02:00
Kawe Mazidjatari
8aed88a0b5 Make it easier to distinguish netconsole logs from rcon logs
Log net console timestamps with parentheses, and rcon logs with brackets. This makes it much easier to determine who the owner of the log is.
2023-04-19 02:05:58 +02:00
Kawe Mazidjatari
39445eecc4 Add missing check
This fixes the bug where RCON address couldn't be set from the '[::]:port' format.
2023-04-19 01:52:05 +02:00
Kawe Mazidjatari
e51336dd5a Add 'bf_write::WriteBytes' 2023-04-19 01:36:35 +02:00
Kawe Mazidjatari
83d5deb109 Remove unused type
No longer used; replaced with cvar 'sv_rcon_maxpacketsize'.
2023-04-19 01:36:10 +02:00
Kawe Mazidjatari
179bd31ee6 Initial large refactor of the RCON implementation
* Decoding and encoding is done into a single buffer, from raw buffers to avoid extraneous copies.
* Added base class holding all core logic for encoding, decoding, receiving and processing of the RCON protocol. This code was initially identical between all implementations of RCON, deduplicating this avoids bugs.
* Added more sophisticated error handling, stop right away when decoding for example fails.
* Added ability to have more than one active authenticated net console on the server. Controlled by cvar 'sv_rcon_maxconnections' (default 1).
* Max packet size for accepted, but not authenticated sockets is now controled by cvar 'sv_rcon_maxpacketsize' (default 1024).
2023-04-19 01:35:31 +02:00