From 3b328b36426e84975e85a572b82f17cd7caf3dc6 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Tue, 12 Jul 2011 11:59:48 +0000 Subject: - Implement dual protocol support (#4962) - Fix several UDP spoofing security issues --- src/qcommon/qcommon.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/qcommon/qcommon.h') diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h index 165dccae..28834168 100644 --- a/src/qcommon/qcommon.h +++ b/src/qcommon/qcommon.h @@ -193,7 +193,8 @@ void NET_Sleep(int msec); #define MAX_DOWNLOAD_WINDOW 48 // ACK window of 48 download chunks. Cannot set this higher, or clients // will overflow the reliable commands buffer #define MAX_DOWNLOAD_BLKSIZE 1024 // 896 byte block chunks - + +#define NETCHAN_GENCHECKSUM(challenge, sequence) ((challenge) ^ ((sequence) * (challenge))) /* Netchan handles packet fragmentation and out of order / duplicate suppression @@ -222,10 +223,12 @@ typedef struct { int unsentFragmentStart; int unsentLength; byte unsentBuffer[MAX_MSGLEN]; + + int challenge; } netchan_t; void Netchan_Init( int qport ); -void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport ); +void Netchan_Setup(netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, int challenge); void Netchan_Transmit( netchan_t *chan, int length, const byte *data ); void Netchan_TransmitNextFragment( netchan_t *chan ); @@ -241,7 +244,7 @@ PROTOCOL ============================================================== */ -#define PROTOCOL_VERSION 70 +#define PROTOCOL_VERSION 71 // maintain a list of compatible protocols for demo playing // NOTE: that stuff only works with two digits protocols -- cgit