summaryrefslogtreecommitdiff
path: root/src/qcommon
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon')
-rw-r--r--src/qcommon/net_chan.c25
-rw-r--r--src/qcommon/q_shared.c4
-rw-r--r--src/qcommon/q_shared.h2
-rw-r--r--src/qcommon/qcommon.h9
4 files changed, 11 insertions, 29 deletions
diff --git a/src/qcommon/net_chan.c b/src/qcommon/net_chan.c
index 67ef54e0..4aacfa7e 100644
--- a/src/qcommon/net_chan.c
+++ b/src/qcommon/net_chan.c
@@ -84,8 +84,7 @@ Netchan_Setup
called to open a channel to a remote system
==============
*/
-void Netchan_Setup(netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, int challenge)
-{
+void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport ) {
Com_Memset (chan, 0, sizeof(*chan));
chan->sock = sock;
@@ -192,21 +191,17 @@ void Netchan_TransmitNextFragment( netchan_t *chan ) {
msg_t send;
byte send_buf[MAX_PACKETLEN];
int fragmentLength;
- int outgoingSequence;
// write the packet header
MSG_InitOOB (&send, send_buf, sizeof(send_buf)); // <-- only do the oob here
- outgoingSequence = chan->outgoingSequence | FRAGMENT_BIT;
- MSG_WriteLong(&send, outgoingSequence);
+ MSG_WriteLong( &send, chan->outgoingSequence | FRAGMENT_BIT );
// send the qport if we are a client
if ( chan->sock == NS_CLIENT ) {
MSG_WriteShort( &send, qport->integer );
}
- MSG_WriteLong(&send, NETCHAN_GENCHECKSUM(chan->challenge, chan->outgoingSequence));
-
// copy the reliable message to the packet first
fragmentLength = FRAGMENT_SIZE;
if ( chan->unsentFragmentStart + fragmentLength > chan->unsentLength ) {
@@ -274,14 +269,12 @@ void Netchan_Transmit( netchan_t *chan, int length, const byte *data ) {
MSG_InitOOB (&send, send_buf, sizeof(send_buf));
MSG_WriteLong( &send, chan->outgoingSequence );
+ chan->outgoingSequence++;
// send the qport if we are a client
- if(chan->sock == NS_CLIENT)
- MSG_WriteShort(&send, qport->integer);
-
- MSG_WriteLong(&send, NETCHAN_GENCHECKSUM(chan->challenge, chan->outgoingSequence));
-
- chan->outgoingSequence++;
+ if ( chan->sock == NS_CLIENT ) {
+ MSG_WriteShort( &send, qport->integer );
+ }
MSG_WriteData( &send, data, length );
@@ -335,12 +328,6 @@ qboolean Netchan_Process( netchan_t *chan, msg_t *msg ) {
qport = MSG_ReadShort( msg );
}
- int checksum = MSG_ReadLong(msg);
-
- // UDP spoofing protection
- if(NETCHAN_GENCHECKSUM(chan->challenge, sequence) != checksum)
- return qfalse;
-
// read the fragment information
if ( fragmented ) {
fragmentStart = MSG_ReadShort( msg );
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c
index 9f7600b6..b4846799 100644
--- a/src/qcommon/q_shared.c
+++ b/src/qcommon/q_shared.c
@@ -981,7 +981,7 @@ void Q_ParseNewlines( char *dest, const char *src, int destsize )
*dest++ = '\0';
}
-int QDECL Com_sprintf(char *dest, int size, const char *fmt, ...)
+void QDECL Com_sprintf(char *dest, int size, const char *fmt, ...)
{
int len;
va_list argptr;
@@ -992,8 +992,6 @@ int QDECL Com_sprintf(char *dest, int size, const char *fmt, ...)
if(len >= size)
Com_Printf("Com_sprintf: Output length %d too short, require %d bytes.\n", size, len);
-
- return len;
}
/*
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index b4ddc35e..1cedf6a8 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -741,7 +741,7 @@ void Parse2DMatrix (char **buf_p, int y, int x, float *m);
void Parse3DMatrix (char **buf_p, int z, int y, int x, float *m);
int Com_HexStrToInt( const char *str );
-int QDECL Com_sprintf (char *dest, int size, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
char *Com_SkipTokens( char *s, int numTokens, char *sep );
char *Com_SkipCharset( char *s, char *sep );
diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h
index affde995..d09ee299 100644
--- a/src/qcommon/qcommon.h
+++ b/src/qcommon/qcommon.h
@@ -192,8 +192,7 @@ void NET_Sleep(int msec);
#define MAX_DOWNLOAD_WINDOW 8 // max of eight download frames
#define MAX_DOWNLOAD_BLKSIZE 2048 // 2048 byte block chunks
-
-#define NETCHAN_GENCHECKSUM(challenge, sequence) ((challenge) ^ ((sequence) * (challenge)))
+
/*
Netchan handles packet fragmentation and out of order / duplicate suppression
@@ -222,12 +221,10 @@ 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, int challenge);
+void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport );
void Netchan_Transmit( netchan_t *chan, int length, const byte *data );
void Netchan_TransmitNextFragment( netchan_t *chan );
@@ -243,7 +240,7 @@ PROTOCOL
==============================================================
*/
-#define PROTOCOL_VERSION 71
+#define PROTOCOL_VERSION 70
// maintain a list of compatible protocols for demo playing
// NOTE: that stuff only works with two digits protocols