about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-04-08 23:56:15 +0200
committeroy <Tom_Adams@web.de>2011-04-08 23:56:15 +0200
commitb6118ae9fed672c3f06524f7a15f1025790baaf8 (patch)
tree6f185ea2b0ab1177acdae5ffd0b314c2461287ec /src/engine/client
parent9643fc36ae69c15ee8c9a9634e8aa663f112f9e6 (diff)
downloadzcatch-b6118ae9fed672c3f06524f7a15f1025790baaf8.tar.gz
zcatch-b6118ae9fed672c3f06524f7a15f1025790baaf8.zip
mapped IPv4 addresses within master servers server list to IPv6 to decrease the size of an entry and increased the servers per packet
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/client.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index 536d8231..5cce547e 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -1096,9 +1096,23 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
 		{
 			NETADDR Addr;
 
+			static char IPV4Mapping[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF };
+
 			// copy address
-			Addr.type = (pAddrs[i].m_aType[0]<<24) | (pAddrs[i].m_aType[1]<<16) | (pAddrs[i].m_aType[2]<<8) | pAddrs[i].m_aType[3];
-			mem_copy(Addr.ip, pAddrs[i].m_aIp, sizeof(Addr.ip));
+			if(!mem_comp(IPV4Mapping, pAddrs[i].m_aIp, sizeof(IPV4Mapping)))
+			{
+				mem_zero(&Addr, sizeof(Addr));
+				Addr.type = NETTYPE_IPV4;
+				Addr.ip[0] = pAddrs[i].m_aIp[12];
+				Addr.ip[1] = pAddrs[i].m_aIp[13];
+				Addr.ip[2] = pAddrs[i].m_aIp[14];
+				Addr.ip[3] = pAddrs[i].m_aIp[15];
+			}
+			else
+			{
+				Addr.type = NETTYPE_IPV6;
+				mem_copy(Addr.ip, pAddrs[i].m_aIp, sizeof(Addr.ip));
+			}
 			Addr.port = (pAddrs[i].m_aPort[0]<<8) | pAddrs[i].m_aPort[1];
 			
 			m_ServerBrowser.Set(Addr, IServerBrowser::SET_MASTER_ADD, -1, 0x0);