diff options
Diffstat (limited to 'src/qcommon/net_chan.c')
-rw-r--r-- | src/qcommon/net_chan.c | 25 |
1 files changed, 6 insertions, 19 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 ); |