aboutsummaryrefslogtreecommitdiffstats
path: root/code/server
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-04 23:22:22 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-04 23:22:22 +0000
commitf4c60f773c1bae0e356090e812d9a619c1cfda85 (patch)
tree7125468e574841a6f996e4bd4bb85602b9195f0d /code/server
parent774e6430a3655619d690e4eb47fa04a32c4c6bd3 (diff)
downloadioquake3-aero-f4c60f773c1bae0e356090e812d9a619c1cfda85.tar.gz
ioquake3-aero-f4c60f773c1bae0e356090e812d9a619c1cfda85.zip
Basic IPv6 support. Some inspiration from the patches by Lubos Dolezel and JF Tremblay at https://bugzilla.icculus.org/show_bug.cgi?id=2355.
git-svn-id: svn://svn.icculus.org/quake3/trunk@1290 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/server')
-rw-r--r--code/server/sv_ccmds.c4
-rw-r--r--code/server/sv_client.c88
-rw-r--r--code/server/sv_main.c2
3 files changed, 52 insertions, 42 deletions
diff --git a/code/server/sv_ccmds.c b/code/server/sv_ccmds.c
index a580416..4e3c592 100644
--- a/code/server/sv_ccmds.c
+++ b/code/server/sv_ccmds.c
@@ -433,7 +433,7 @@ static void SV_Ban_f( void ) {
// look up the authorize server's IP
if ( !svs.authorizeAddress.ip[0] && svs.authorizeAddress.type != NA_BAD ) {
Com_Printf( "Resolving %s\n", AUTHORIZE_SERVER_NAME );
- if ( !NET_StringToAdr( AUTHORIZE_SERVER_NAME, &svs.authorizeAddress ) ) {
+ if ( !NET_StringToAdr( AUTHORIZE_SERVER_NAME, &svs.authorizeAddress, NA_IP ) ) {
Com_Printf( "Couldn't resolve address\n" );
return;
}
@@ -487,7 +487,7 @@ static void SV_BanNum_f( void ) {
// look up the authorize server's IP
if ( !svs.authorizeAddress.ip[0] && svs.authorizeAddress.type != NA_BAD ) {
Com_Printf( "Resolving %s\n", AUTHORIZE_SERVER_NAME );
- if ( !NET_StringToAdr( AUTHORIZE_SERVER_NAME, &svs.authorizeAddress ) ) {
+ if ( !NET_StringToAdr( AUTHORIZE_SERVER_NAME, &svs.authorizeAddress, NA_IP ) ) {
Com_Printf( "Couldn't resolve address\n" );
return;
}
diff --git a/code/server/sv_client.c b/code/server/sv_client.c
index cbea6b4..8a85bdc 100644
--- a/code/server/sv_client.c
+++ b/code/server/sv_client.c
@@ -88,50 +88,61 @@ void SV_GetChallenge( netadr_t from ) {
return;
}
- // look up the authorize server's IP
- if ( !svs.authorizeAddress.ip[0] && svs.authorizeAddress.type != NA_BAD ) {
- Com_Printf( "Resolving %s\n", AUTHORIZE_SERVER_NAME );
- if ( !NET_StringToAdr( AUTHORIZE_SERVER_NAME, &svs.authorizeAddress ) ) {
- Com_Printf( "Couldn't resolve address\n" );
- return;
+ // Drop the authorize stuff if this client is coming in via v6 as the auth server does not support ipv6.
+ if(challenge->adr.type == NA_IP)
+ {
+ // look up the authorize server's IP
+ if ( !svs.authorizeAddress.ip[0] && svs.authorizeAddress.type != NA_BAD ) {
+ Com_Printf( "Resolving %s\n", AUTHORIZE_SERVER_NAME );
+ if ( !NET_StringToAdr( AUTHORIZE_SERVER_NAME, &svs.authorizeAddress, NA_IP ) ) {
+ Com_Printf( "Couldn't resolve address\n" );
+ return;
+ }
+ svs.authorizeAddress.port = BigShort( PORT_AUTHORIZE );
+ Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", AUTHORIZE_SERVER_NAME,
+ svs.authorizeAddress.ip[0], svs.authorizeAddress.ip[1],
+ svs.authorizeAddress.ip[2], svs.authorizeAddress.ip[3],
+ BigShort( svs.authorizeAddress.port ) );
}
- svs.authorizeAddress.port = BigShort( PORT_AUTHORIZE );
- Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", AUTHORIZE_SERVER_NAME,
- svs.authorizeAddress.ip[0], svs.authorizeAddress.ip[1],
- svs.authorizeAddress.ip[2], svs.authorizeAddress.ip[3],
- BigShort( svs.authorizeAddress.port ) );
- }
- // if they have been challenging for a long time and we
- // haven't heard anything from the authorize server, go ahead and
- // let them in, assuming the id server is down
- if ( svs.time - challenge->firstTime > AUTHORIZE_TIMEOUT ) {
- Com_DPrintf( "authorize server timed out\n" );
+ // if they have been challenging for a long time and we
+ // haven't heard anything from the authorize server, go ahead and
+ // let them in, assuming the id server is down
+ if ( svs.time - challenge->firstTime > AUTHORIZE_TIMEOUT ) {
+ Com_DPrintf( "authorize server timed out\n" );
- challenge->pingTime = svs.time;
- NET_OutOfBandPrint( NS_SERVER, challenge->adr,
- "challengeResponse %i", challenge->challenge );
- return;
- }
+ challenge->pingTime = svs.time;
+ NET_OutOfBandPrint( NS_SERVER, challenge->adr,
+ "challengeResponse %i", challenge->challenge );
+ return;
+ }
- // otherwise send their ip to the authorize server
- if ( svs.authorizeAddress.type != NA_BAD ) {
- cvar_t *fs;
- char game[1024];
+ // otherwise send their ip to the authorize server
+ if ( svs.authorizeAddress.type != NA_BAD ) {
+ cvar_t *fs;
+ char game[1024];
- Com_DPrintf( "sending getIpAuthorize for %s\n", NET_AdrToString( from ));
+ Com_DPrintf( "sending getIpAuthorize for %s\n", NET_AdrToString( from ));
+
+ strcpy(game, BASEGAME);
+ fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
+ if (fs && fs->string[0] != 0) {
+ strcpy(game, fs->string);
+ }
- strcpy(game, BASEGAME);
- fs = Cvar_Get ("fs_game", "", CVAR_INIT|CVAR_SYSTEMINFO );
- if (fs && fs->string[0] != 0) {
- strcpy(game, fs->string);
+ // the 0 is for backwards compatibility with obsolete sv_allowanonymous flags
+ // getIpAuthorize <challenge> <IP> <game> 0 <auth-flag>
+ NET_OutOfBandPrint( NS_SERVER, svs.authorizeAddress,
+ "getIpAuthorize %i %i.%i.%i.%i %s 0 %s", svs.challenges[i].challenge,
+ from.ip[0], from.ip[1], from.ip[2], from.ip[3], game, sv_strictAuth->string );
}
+ }
+ else
+ {
+ challenge->pingTime = svs.time;
- // the 0 is for backwards compatibility with obsolete sv_allowanonymous flags
- // getIpAuthorize <challenge> <IP> <game> 0 <auth-flag>
- NET_OutOfBandPrint( NS_SERVER, svs.authorizeAddress,
- "getIpAuthorize %i %i.%i.%i.%i %s 0 %s", svs.challenges[i].challenge,
- from.ip[0], from.ip[1], from.ip[2], from.ip[3], game, sv_strictAuth->string );
+ NET_OutOfBandPrint( NS_SERVER, challenge->adr,
+ "challengeResponse %i", challenge->challenge );
}
}
@@ -284,9 +295,8 @@ void SV_DirectConnect( netadr_t from ) {
for (i=0 ; i<MAX_CHALLENGES ; i++) {
if (NET_CompareAdr(from, svs.challenges[i].adr)) {
- if ( challenge == svs.challenges[i].challenge ) {
- break; // good
- }
+ if ( challenge == svs.challenges[i].challenge )
+ break;
}
}
if (i == MAX_CHALLENGES) {
diff --git a/code/server/sv_main.c b/code/server/sv_main.c
index 675713c..d0d7c65 100644
--- a/code/server/sv_main.c
+++ b/code/server/sv_main.c
@@ -252,7 +252,7 @@ void SV_MasterHeartbeat( void ) {
sv_master[i]->modified = qfalse;
Com_Printf( "Resolving %s\n", sv_master[i]->string );
- if ( !NET_StringToAdr( sv_master[i]->string, &adr[i] ) ) {
+ if ( !NET_StringToAdr( sv_master[i]->string, &adr[i], NA_IP ) ) {
// if the address failed to resolve, clear it
// so we don't take repeated dns hits
Com_Printf( "Couldn't resolve address: %s\n", sv_master[i]->string );