]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - netconn.c
Reimpl. the cvar alias system. Reimpl. the cvar hash table as a distinct type
[xonotic/darkplaces.git] / netconn.c
index 28b9a57520230184c311ed2199202b51230050bb..539b98c1c46762703070ed2b04b269567fed7241 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -85,9 +85,9 @@ cvar_t net_sourceaddresscheck = {CVAR_CLIENT, "net_sourceaddresscheck", "1", "co
 cvar_t hostname = {CVAR_SERVER | CVAR_SAVE, "hostname", "UNNAMED", "server message to show in server browser"};
 cvar_t developer_networking = {CVAR_CLIENT | CVAR_SERVER, "developer_networking", "0", "prints all received and sent packets (recommended only for debugging)"};
 
-cvar_t cl_netlocalping = {CVAR_CLIENT, "cl_netlocalping","0", "lags local loopback connection by this much ping time (useful to play more fairly on your own server with people with higher pings)"};
-static cvar_t cl_netpacketloss_send = {CVAR_CLIENT, "cl_netpacketloss_send","0", "drops this percentage of outgoing packets, useful for testing network protocol robustness (jerky movement, prediction errors, etc)"};
-static cvar_t cl_netpacketloss_receive = {CVAR_CLIENT, "cl_netpacketloss_receive","0", "drops this percentage of incoming packets, useful for testing network protocol robustness (jerky movement, effects failing to start, sounds failing to play, etc)"};
+cvar_t net_fakelag = {CVAR_CLIENT, "net_fakelag","0", "lags local loopback connection by this much ping time (useful to play more fairly on your own server with people with higher pings)"};
+static cvar_t net_fakeloss_send = {CVAR_CLIENT, "net_fakeloss_send","0", "drops this percentage of outgoing packets, useful for testing network protocol robustness (jerky movement, prediction errors, etc)"};
+static cvar_t net_fakeloss_receive = {CVAR_CLIENT, "net_fakeloss_receive","0", "drops this percentage of incoming packets, useful for testing network protocol robustness (jerky movement, effects failing to start, sounds failing to play, etc)"};
 static cvar_t net_slist_queriespersecond = {CVAR_CLIENT, "net_slist_queriespersecond", "20", "how many server information requests to send per second"};
 static cvar_t net_slist_queriesperframe = {CVAR_CLIENT, "net_slist_queriesperframe", "4", "maximum number of server information requests to send each rendered frame (guards against low framerates causing problems)"};
 static cvar_t net_slist_timeout = {CVAR_CLIENT, "net_slist_timeout", "4", "how long to listen for a server information response before giving up"};
@@ -618,9 +618,9 @@ int NetConn_Read(lhnetsocket_t *mysocket, void *data, int maxlength, lhnetaddres
                Thread_UnlockMutex(netconn_mutex);
        if (length == 0)
                return 0;
-       if (cl_netpacketloss_receive.integer)
+       if (net_fakeloss_receive.integer)
                for (i = 0;i < cl_numsockets;i++)
-                       if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_receive.integer)
+                       if (cl_sockets[i] == mysocket && (rand() % 100) < net_fakeloss_receive.integer)
                                return 0;
        if (developer_networking.integer)
        {
@@ -642,9 +642,9 @@ int NetConn_Write(lhnetsocket_t *mysocket, const void *data, int length, const l
 {
        int ret;
        int i;
-       if (cl_netpacketloss_send.integer)
+       if (net_fakeloss_send.integer)
                for (i = 0;i < cl_numsockets;i++)
-                       if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_send.integer)
+                       if (cl_sockets[i] == mysocket && (rand() % 100) < net_fakeloss_send.integer)
                                return length;
        if (mysocket->address.addresstype == LHNETADDRESSTYPE_LOOP && netconn_mutex)
                Thread_LockMutex(netconn_mutex);
@@ -970,11 +970,11 @@ static void NetConn_OpenClientPort(const char *addressstring, lhnetaddresstype_t
                else
                {
                        LHNETADDRESS_ToString(&address, addressstring2, sizeof(addressstring2), true);
-                       Con_Printf("Client failed to open a socket on address %s\n", addressstring2);
+                       Con_Errorf("Client failed to open a socket on address %s\n", addressstring2);
                }
        }
        else
-               Con_Printf("Client unable to parse address %s\n", addressstring);
+               Con_Errorf("Client unable to parse address %s\n", addressstring);
 }
 
 void NetConn_OpenClientPorts(void)
@@ -1034,12 +1034,12 @@ static qboolean NetConn_OpenServerPort(const char *addressstring, lhnetaddressty
                        else
                        {
                                LHNETADDRESS_ToString(&address, addressstring2, sizeof(addressstring2), true);
-                               Con_Printf("Server failed to open socket on address %s\n", addressstring2);
+                               Con_Errorf("Server failed to open socket on address %s\n", addressstring2);
                        }
                }
                else
                {
-                       Con_Printf("Server unable to parse address %s\n", addressstring);
+                       Con_Errorf("Server unable to parse address %s\n", addressstring);
                        // if it cant parse one address, it wont be able to parse another for sure
                        return false;
                }
@@ -1513,8 +1513,6 @@ static void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_
 #ifdef CONFIG_MENU
        M_Update_Return_Reason("");
 #endif
-       // the connection request succeeded, stop current connection and set up a new connection
-       CL_Disconnect();
        // if we're connecting to a remote server, shut down any local server
        if (LHNETADDRESS_GetAddressType(peeraddress) != LHNETADDRESSTYPE_LOOP && sv.active)
        {
@@ -1951,141 +1949,144 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                        return true;
                }
 #ifdef CONFIG_MENU
-               if (length >= 15 && !memcmp(string, "statusResponse\x0A", 15))
+               if(key_dest != key_game)
                {
-                       serverlist_info_t *info;
-                       char *p;
-                       int n;
-
-                       string += 15;
-                       // search the cache for this server and update it
-                       n = NetConn_ClientParsePacket_ServerList_ProcessReply(addressstring2);
-                       if (n < 0)
-                               return true;
-
-                       info = &serverlist_cache[n].info;
-                       info->game[0] = 0;
-                       info->mod[0]  = 0;
-                       info->map[0]  = 0;
-                       info->name[0] = 0;
-                       info->qcstatus[0] = 0;
-                       info->players[0] = 0;
-                       info->protocol = -1;
-                       info->numplayers = 0;
-                       info->numbots = -1;
-                       info->maxplayers  = 0;
-                       info->gameversion = 0;
-
-                       p = strchr(string, '\n');
-                       if(p)
+                       if (length >= 15 && !memcmp(string, "statusResponse\x0A", 15))
                        {
-                               *p = 0; // cut off the string there
-                               ++p;
-                       }
-                       else
-                               Con_Printf("statusResponse without players block?\n");
-
-                       if ((s = InfoString_GetValue(string, "gamename"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game));
-                       if ((s = InfoString_GetValue(string, "modname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));
-                       if ((s = InfoString_GetValue(string, "mapname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));
-                       if ((s = InfoString_GetValue(string, "hostname"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));
-                       if ((s = InfoString_GetValue(string, "protocol"     , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s);
-                       if ((s = InfoString_GetValue(string, "clients"      , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s);
-                       if ((s = InfoString_GetValue(string, "bots"         , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s);
-                       if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s);
-                       if ((s = InfoString_GetValue(string, "gameversion"  , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s);
-                       if ((s = InfoString_GetValue(string, "qcstatus"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
-                       if (p                                                                                         != NULL) strlcpy(info->players, p, sizeof(info->players));
-                       info->numhumans = info->numplayers - max(0, info->numbots);
-                       info->freeslots = info->maxplayers - info->numplayers;
+                               serverlist_info_t *info;
+                               char *p;
+                               int n;
 
-                       NetConn_ClientParsePacket_ServerList_UpdateCache(n);
+                               string += 15;
+                               // search the cache for this server and update it
+                               n = NetConn_ClientParsePacket_ServerList_ProcessReply(addressstring2);
+                               if (n < 0)
+                                       return true;
 
-                       return true;
-               }
-               if (length >= 13 && !memcmp(string, "infoResponse\x0A", 13))
-               {
-                       serverlist_info_t *info;
-                       int n;
+                               info = &serverlist_cache[n].info;
+                               info->game[0] = 0;
+                               info->mod[0]  = 0;
+                               info->map[0]  = 0;
+                               info->name[0] = 0;
+                               info->qcstatus[0] = 0;
+                               info->players[0] = 0;
+                               info->protocol = -1;
+                               info->numplayers = 0;
+                               info->numbots = -1;
+                               info->maxplayers  = 0;
+                               info->gameversion = 0;
+
+                               p = strchr(string, '\n');
+                               if(p)
+                               {
+                                       *p = 0; // cut off the string there
+                                       ++p;
+                               }
+                               else
+                                       Con_Printf("statusResponse without players block?\n");
+
+                               if ((s = InfoString_GetValue(string, "gamename"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game));
+                               if ((s = InfoString_GetValue(string, "modname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));
+                               if ((s = InfoString_GetValue(string, "mapname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));
+                               if ((s = InfoString_GetValue(string, "hostname"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));
+                               if ((s = InfoString_GetValue(string, "protocol"     , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s);
+                               if ((s = InfoString_GetValue(string, "clients"      , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s);
+                               if ((s = InfoString_GetValue(string, "bots"         , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s);
+                               if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s);
+                               if ((s = InfoString_GetValue(string, "gameversion"  , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s);
+                               if ((s = InfoString_GetValue(string, "qcstatus"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
+                               if (p                                                                                         != NULL) strlcpy(info->players, p, sizeof(info->players));
+                               info->numhumans = info->numplayers - max(0, info->numbots);
+                               info->freeslots = info->maxplayers - info->numplayers;
+
+                               NetConn_ClientParsePacket_ServerList_UpdateCache(n);
 
-                       string += 13;
-                       // search the cache for this server and update it
-                       n = NetConn_ClientParsePacket_ServerList_ProcessReply(addressstring2);
-                       if (n < 0)
                                return true;
+                       }
+                       if (length >= 13 && !memcmp(string, "infoResponse\x0A", 13))
+                       {
+                               serverlist_info_t *info;
+                               int n;
 
-                       info = &serverlist_cache[n].info;
-                       info->game[0] = 0;
-                       info->mod[0]  = 0;
-                       info->map[0]  = 0;
-                       info->name[0] = 0;
-                       info->qcstatus[0] = 0;
-                       info->players[0] = 0;
-                       info->protocol = -1;
-                       info->numplayers = 0;
-                       info->numbots = -1;
-                       info->maxplayers  = 0;
-                       info->gameversion = 0;
-
-                       if ((s = InfoString_GetValue(string, "gamename"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game));
-                       if ((s = InfoString_GetValue(string, "modname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));
-                       if ((s = InfoString_GetValue(string, "mapname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));
-                       if ((s = InfoString_GetValue(string, "hostname"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));
-                       if ((s = InfoString_GetValue(string, "protocol"     , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s);
-                       if ((s = InfoString_GetValue(string, "clients"      , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s);
-                       if ((s = InfoString_GetValue(string, "bots"         , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s);
-                       if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s);
-                       if ((s = InfoString_GetValue(string, "gameversion"  , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s);
-                       if ((s = InfoString_GetValue(string, "qcstatus"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
-                       info->numhumans = info->numplayers - max(0, info->numbots);
-                       info->freeslots = info->maxplayers - info->numplayers;
+                               string += 13;
+                               // search the cache for this server and update it
+                               n = NetConn_ClientParsePacket_ServerList_ProcessReply(addressstring2);
+                               if (n < 0)
+                                       return true;
 
-                       NetConn_ClientParsePacket_ServerList_UpdateCache(n);
+                               info = &serverlist_cache[n].info;
+                               info->game[0] = 0;
+                               info->mod[0]  = 0;
+                               info->map[0]  = 0;
+                               info->name[0] = 0;
+                               info->qcstatus[0] = 0;
+                               info->players[0] = 0;
+                               info->protocol = -1;
+                               info->numplayers = 0;
+                               info->numbots = -1;
+                               info->maxplayers  = 0;
+                               info->gameversion = 0;
+
+                               if ((s = InfoString_GetValue(string, "gamename"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game));
+                               if ((s = InfoString_GetValue(string, "modname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));
+                               if ((s = InfoString_GetValue(string, "mapname"      , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));
+                               if ((s = InfoString_GetValue(string, "hostname"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));
+                               if ((s = InfoString_GetValue(string, "protocol"     , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s);
+                               if ((s = InfoString_GetValue(string, "clients"      , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s);
+                               if ((s = InfoString_GetValue(string, "bots"         , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s);
+                               if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s);
+                               if ((s = InfoString_GetValue(string, "gameversion"  , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s);
+                               if ((s = InfoString_GetValue(string, "qcstatus"     , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus));
+                               info->numhumans = info->numplayers - max(0, info->numbots);
+                               info->freeslots = info->maxplayers - info->numplayers;
+
+                               NetConn_ClientParsePacket_ServerList_UpdateCache(n);
 
-                       return true;
-               }
-               if (!strncmp(string, "getserversResponse\\", 19) && serverlist_cachecount < SERVERLIST_TOTALSIZE)
-               {
-                       // Extract the IP addresses
-                       data += 18;
-                       length -= 18;
-                       NetConn_ClientParsePacket_ServerList_ParseDPList(peeraddress, data, length, false);
-                       return true;
-               }
-               if (!strncmp(string, "getserversExtResponse", 21) && serverlist_cachecount < SERVERLIST_TOTALSIZE)
-               {
-                       // Extract the IP addresses
-                       data += 21;
-                       length -= 21;
-                       NetConn_ClientParsePacket_ServerList_ParseDPList(peeraddress, data, length, true);
-                       return true;
-               }
-               if (!memcmp(string, "d\n", 2) && serverlist_cachecount < SERVERLIST_TOTALSIZE)
-               {
-                       // Extract the IP addresses
-                       data += 2;
-                       length -= 2;
-                       masterreplycount++;
-                       if (serverlist_consoleoutput)
-                               Con_Printf("received QuakeWorld server list from %s...\n", addressstring2);
-                       while (length >= 6 && (data[0] != 0xFF || data[1] != 0xFF || data[2] != 0xFF || data[3] != 0xFF) && data[4] * 256 + data[5] != 0)
+                               return true;
+                       }
+                       if (!strncmp(string, "getserversResponse\\", 19) && serverlist_cachecount < SERVERLIST_TOTALSIZE)
                        {
-                               dpsnprintf (ipstring, sizeof (ipstring), "%u.%u.%u.%u:%u", data[0], data[1], data[2], data[3], data[4] * 256 + data[5]);
-                               if (serverlist_consoleoutput && developer_networking.integer)
-                                       Con_Printf("Requesting info from QuakeWorld server %s\n", ipstring);
-                               
-                               if( !NetConn_ClientParsePacket_ServerList_PrepareQuery( PROTOCOL_QUAKEWORLD, ipstring, false ) ) {
-                                       break;
-                               }
+                               // Extract the IP addresses
+                               data += 18;
+                               length -= 18;
+                               NetConn_ClientParsePacket_ServerList_ParseDPList(peeraddress, data, length, false);
+                               return true;
+                       }
+                       if (!strncmp(string, "getserversExtResponse", 21) && serverlist_cachecount < SERVERLIST_TOTALSIZE)
+                       {
+                               // Extract the IP addresses
+                               data += 21;
+                               length -= 21;
+                               NetConn_ClientParsePacket_ServerList_ParseDPList(peeraddress, data, length, true);
+                               return true;
+                       }
+                       if (!memcmp(string, "d\n", 2) && serverlist_cachecount < SERVERLIST_TOTALSIZE)
+                       {
+                               // Extract the IP addresses
+                               data += 2;
+                               length -= 2;
+                               masterreplycount++;
+                               if (serverlist_consoleoutput)
+                                       Con_Printf("received QuakeWorld server list from %s...\n", addressstring2);
+                               while (length >= 6 && (data[0] != 0xFF || data[1] != 0xFF || data[2] != 0xFF || data[3] != 0xFF) && data[4] * 256 + data[5] != 0)
+                               {
+                                       dpsnprintf (ipstring, sizeof (ipstring), "%u.%u.%u.%u:%u", data[0], data[1], data[2], data[3], data[4] * 256 + data[5]);
+                                       if (serverlist_consoleoutput && developer_networking.integer)
+                                               Con_Printf("Requesting info from QuakeWorld server %s\n", ipstring);
+                                       
+                                       if( !NetConn_ClientParsePacket_ServerList_PrepareQuery( PROTOCOL_QUAKEWORLD, ipstring, false ) ) {
+                                               break;
+                                       }
 
-                               // move on to next address in packet
-                               data += 6;
-                               length -= 6;
+                                       // move on to next address in packet
+                                       data += 6;
+                                       length -= 6;
+                               }
+                               // begin or resume serverlist queries
+                               serverlist_querysleep = false;
+                               serverlist_querywaittime = realtime + 3;
+                               return true;
                        }
-                       // begin or resume serverlist queries
-                       serverlist_querysleep = false;
-                       serverlist_querywaittime = realtime + 3;
-                       return true;
                }
 #endif
                if (!strncmp(string, "extResponse ", 12))
@@ -2739,13 +2740,13 @@ static qboolean hmac_mdfour_time_matching(lhnetaddress_t *peeraddress, const cha
        long t1, t2;
 
        if (!password[0]) {
-               Con_Print("^4LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n");
+               Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n");
                return false;
        }
 
        t1 = (long) time(NULL);
        t2 = strtol(s, NULL, 0);
-       if(abs(t1 - t2) > rcon_secure_maxdiff.integer)
+       if(labs(t1 - t2) > rcon_secure_maxdiff.integer)
                return false;
 
        if(!HMAC_MDFOUR_16BYTES((unsigned char *) mdfourbuf, (unsigned char *) s, slen, (unsigned char *) password, (int)strlen(password)))
@@ -2760,7 +2761,7 @@ static qboolean hmac_mdfour_challenge_matching(lhnetaddress_t *peeraddress, cons
        int i;
 
        if (!password[0]) {
-               Con_Print("^4LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n");
+               Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n");
                return false;
        }
 
@@ -2791,7 +2792,7 @@ static qboolean hmac_mdfour_challenge_matching(lhnetaddress_t *peeraddress, cons
 static qboolean plaintext_matching(lhnetaddress_t *peeraddress, const char *password, const char *hash, const char *s, int slen)
 {
        if (!password[0]) {
-               Con_Print("^4LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n");
+               Con_Error("LOGIC ERROR: RCon_Authenticate should never call the comparator with an empty password. Please report.\n");
                return false;
        }
 
@@ -2939,7 +2940,7 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
 {
        int i, ret, clientnum, best;
        double besttime;
-       char *string, response[1400], addressstring2[128];
+       char *string, response[2800], addressstring2[128];
        static char stringbuf[16384]; // server only
        qboolean islocal = (LHNETADDRESS_GetAddressType(peeraddress) == LHNETADDRESSTYPE_LOOP);
        char senddata[NET_HEADERSIZE+NET_MAXMESSAGE+CRYPTO_HEADERSIZE];
@@ -3756,7 +3757,7 @@ void NetConn_QueryMasters(qboolean querydp, qboolean queryqw)
        }
        if (!masterquerycount)
        {
-               Con_Print("Unable to query master servers, no suitable network sockets active.\n");
+               Con_Error("Unable to query master servers, no suitable network sockets active.\n");
                M_Update_Return_Reason("No network");
        }
 }
@@ -3898,9 +3899,12 @@ void NetConn_Init(void)
        Cvar_RegisterVariable(&net_challengefloodblockingtimeout);
        Cvar_RegisterVariable(&net_getstatusfloodblockingtimeout);
        Cvar_RegisterVariable(&net_sourceaddresscheck);
-       Cvar_RegisterVariable(&cl_netlocalping);
-       Cvar_RegisterVariable(&cl_netpacketloss_send);
-       Cvar_RegisterVariable(&cl_netpacketloss_receive);
+       Cvar_RegisterVariable(&net_fakelag);
+       Cvar_RegisterVariable(&net_fakeloss_send);
+       Cvar_RegisterVariable(&net_fakeloss_receive);
+       Cvar_RegisterAlias(&net_fakelag, "cl_netlocalping");
+       Cvar_RegisterAlias(&net_fakeloss_send, "cl_netpacketloss_send");
+       Cvar_RegisterAlias(&net_fakeloss_receive, "cl_netpacketloss_receive");
        Cvar_RegisterVariable(&hostname);
        Cvar_RegisterVariable(&developer_networking);
        Cvar_RegisterVariable(&cl_netport);
@@ -3924,7 +3928,7 @@ void NetConn_Init(void)
                        Cvar_SetQuick(&net_address, com_argv[i + 1]);
                }
                else
-                       Con_Printf("-ip option used, but unable to parse the address \"%s\"\n", com_argv[i + 1]);
+                       Con_Errorf("-ip option used, but unable to parse the address \"%s\"\n", com_argv[i + 1]);
        }
 // COMMANDLINEOPTION: Server: -port <portnumber> sets the port to use for a server (default 26000, the same port as QUAKE itself), useful if you host multiple servers on your machine
        if (((i = COM_CheckParm("-port")) || (i = COM_CheckParm("-ipport")) || (i = COM_CheckParm("-udpport"))) && i + 1 < com_argc)
@@ -3936,7 +3940,7 @@ void NetConn_Init(void)
                        Cvar_SetValueQuick(&sv_netport, i);
                }
                else
-                       Con_Printf("-port option used, but %i is not a valid port number\n", i);
+                       Con_Errorf("-port option used, but %i is not a valid port number\n", i);
        }
        cl_numsockets = 0;
        sv_numsockets = 0;