mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-22 11:51:17 +00:00
Correct check for IPv6 local addresses
This commit is contained in:
parent
80632a5210
commit
168d480ed5
1 changed files with 23 additions and 6 deletions
|
@ -426,12 +426,29 @@ void CL_ConnectionlessPacket (void)
|
|||
|
||||
Con_Printf ("client command\n");
|
||||
|
||||
#ifndef HAVE_IPV6
|
||||
if ((*(unsigned *)net_from.ip != *(unsigned *)net_local_adr.ip
|
||||
&& *(unsigned *)net_from.ip != htonl(INADDR_LOOPBACK)) )
|
||||
{
|
||||
Con_Printf ("Command packet from remote host. Ignored.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (memcmp(net_from.ip, net_local_adr.ip, sizeof(net_from.ip)) == 0)
|
||||
;
|
||||
else if (IN6_IS_ADDR_LOOPBACK((struct in6_addr *)net_from.ip))
|
||||
;
|
||||
else if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)net_from.ip) &&
|
||||
((struct in_addr *)&net_from.ip[3])->s_addr == htonl(INADDR_LOOPBACK))
|
||||
;
|
||||
else {
|
||||
Con_Printf ("Command packet from remote host. Ignored.\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
ShowWindow (mainwindow, SW_RESTORE);
|
||||
SetForegroundWindow (mainwindow);
|
||||
|
|
Loading…
Reference in a new issue