diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 13:15:18 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:37 +0000 |
commit | 39a04df7a0477708c11dae6e45e99c6da33e20d7 (patch) | |
tree | 6a6b1729ef29fcb34370eb87d20d7314fd6e8c1a /src/client/cl_main.c | |
parent | 26767f1713a6e1b12263c37f0659d527caf41a65 (diff) |
* Convert master address resolution to IPv6-compatible API
* MOTD parsing should use the whole string rather than just arg1
Diffstat (limited to 'src/client/cl_main.c')
-rw-r--r-- | src/client/cl_main.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 9e2add18..16ddcffc 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -1336,15 +1336,22 @@ void CL_RequestMotd( void ) { return; } Com_Printf( "Resolving %s\n", MASTER_SERVER_NAME ); - if ( !NET_StringToAdr( MASTER_SERVER_NAME, &cls.updateServer, NA_IP ) ) { - Com_Printf( "Couldn't resolve address\n" ); - return; + + switch( NET_StringToAdr( MASTER_SERVER_NAME, &cls.updateServer, + NA_UNSPEC ) ) + { + case 0: + Com_Printf( "Couldn't resolve master address\n" ); + return; + + case 2: + cls.updateServer.port = BigShort( PORT_MASTER ); + default: + break; } - cls.updateServer.port = BigShort( PORT_MASTER ); - Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", MASTER_SERVER_NAME, - cls.updateServer.ip[0], cls.updateServer.ip[1], - cls.updateServer.ip[2], cls.updateServer.ip[3], - BigShort( cls.updateServer.port ) ); + + Com_Printf( "%s resolved to %s\n", MASTER_SERVER_NAME, + NET_AdrToStringwPort( cls.updateServer ) ); info[0] = 0; // NOTE TTimo xoring against Com_Milliseconds, otherwise we may not have a true randomization @@ -2197,16 +2204,23 @@ CL_MotdPacket =================== */ void CL_MotdPacket( netadr_t from, const char *info ) { - char *v; + const char *v; // if not from our server, ignore it if ( !NET_CompareAdr( from, cls.updateServer ) ) { + Com_DPrintf( "MOTD packet from unexpected source\n" ); return; } + Com_DPrintf( "MOTD packet: %s\n", info ); + while( *info != '\\' ) + info++; + // check challenge v = Info_ValueForKey( info, "challenge" ); if ( strcmp( v, cls.updateChallenge ) ) { + Com_DPrintf( "MOTD packet mismatched challenge: " + "'%s' != '%s'\n", v, cls.updateChallenge ); return; } @@ -2438,7 +2452,7 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) { // global MOTD from trem master if ( !Q_stricmp(c, "motd") ) { - CL_MotdPacket( from, arg1 ); + CL_MotdPacket( from, s ); return; } |