sockaddr_qstorage should make no assumptions about where the sa_family member is. Thanks to bigfoot for pointing this out.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@862 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
72a13752b6
commit
ae500c07ef
7 changed files with 14 additions and 14 deletions
|
@ -946,7 +946,7 @@ void CL_ParseCustomTEnt(void)
|
||||||
clcustomtents_t *t;
|
clcustomtents_t *t;
|
||||||
int type = MSG_ReadByte();
|
int type = MSG_ReadByte();
|
||||||
|
|
||||||
if (type == 255)
|
if (type == 255) //255 is register
|
||||||
{
|
{
|
||||||
type = MSG_ReadByte();
|
type = MSG_ReadByte();
|
||||||
if (type == 255)
|
if (type == 255)
|
||||||
|
|
|
@ -234,7 +234,7 @@ void NET_SendPollPacket(int len, void *data, netadr_t to)
|
||||||
|
|
||||||
NetadrToSockadr (&to, &addr);
|
NetadrToSockadr (&to, &addr);
|
||||||
#ifdef USEIPX
|
#ifdef USEIPX
|
||||||
if (addr.sa_family == AF_IPX)
|
if (((struct sockaddr*)&addr)->sa_family == AF_IPX)
|
||||||
{
|
{
|
||||||
lastpollsockIPX++;
|
lastpollsockIPX++;
|
||||||
if (lastpollsockIPX>=POLLIPXSOCKETS)
|
if (lastpollsockIPX>=POLLIPXSOCKETS)
|
||||||
|
|
|
@ -828,7 +828,7 @@ void R_DefaultTrail (model_t *model)
|
||||||
else if (model->flags & EF_TRACER3)
|
else if (model->flags & EF_TRACER3)
|
||||||
model->particletrail = AllocateParticleType("t_tracer3");
|
model->particletrail = AllocateParticleType("t_tracer3");
|
||||||
|
|
||||||
else if (model->flags & EF_BLOODSHOT)
|
else if (model->flags & EF_BLOODSHOT) //these are the hexen2 ones.
|
||||||
model->particletrail = AllocateParticleType("t_bloodshot");
|
model->particletrail = AllocateParticleType("t_bloodshot");
|
||||||
else if (model->flags & EF_FIREBALL)
|
else if (model->flags & EF_FIREBALL)
|
||||||
model->particletrail = AllocateParticleType("t_fireball");
|
model->particletrail = AllocateParticleType("t_fireball");
|
||||||
|
|
|
@ -40,8 +40,8 @@ typedef struct
|
||||||
|
|
||||||
struct sockaddr_qstorage
|
struct sockaddr_qstorage
|
||||||
{
|
{
|
||||||
short sa_family;
|
short dontusesa_family;
|
||||||
unsigned char sa_pad[6];
|
unsigned char dontusesa_pad[6];
|
||||||
#if defined(_MSC_VER) || defined(MINGW)
|
#if defined(_MSC_VER) || defined(MINGW)
|
||||||
__int64 sa_align;
|
__int64 sa_align;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -192,7 +192,7 @@ void NetadrToSockadr (netadr_t *a, struct sockaddr_qstorage *s)
|
||||||
|
|
||||||
void SockadrToNetadr (struct sockaddr_qstorage *s, netadr_t *a)
|
void SockadrToNetadr (struct sockaddr_qstorage *s, netadr_t *a)
|
||||||
{
|
{
|
||||||
switch (s->sa_family)
|
switch (((struct sockaddr*)s)->sa_family)
|
||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
a->type = NA_IP;
|
a->type = NA_IP;
|
||||||
|
@ -453,7 +453,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sadr->sa_family = 0;
|
((struct sockaddr*)sadr)->sa_family = 0;
|
||||||
for (pos = addrinfo; pos; pos = pos->ai_next)
|
for (pos = addrinfo; pos; pos = pos->ai_next)
|
||||||
{
|
{
|
||||||
switch(pos->ai_family)
|
switch(pos->ai_family)
|
||||||
|
@ -470,7 +470,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
|
||||||
}
|
}
|
||||||
dblbreak:
|
dblbreak:
|
||||||
pfreeaddrinfo (addrinfo);
|
pfreeaddrinfo (addrinfo);
|
||||||
if (!sadr->sa_family)
|
if (!((struct sockaddr*)sadr)->sa_family)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define NET_GAMENAME_QW "QUAKEWORLD"
|
#define NET_GAMENAME_QW "QUAKEWORLD"
|
||||||
|
|
||||||
// This is enables a simple IP banning mechanism
|
// This is enables a simple IP banning mechanism
|
||||||
#define BAN_TEST
|
//#define BAN_TEST
|
||||||
|
|
||||||
#ifdef BAN_TEST
|
#ifdef BAN_TEST
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -1005,7 +1005,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
||||||
|
|
||||||
#ifdef BAN_TEST
|
#ifdef BAN_TEST
|
||||||
// check for a ban
|
// check for a ban
|
||||||
if (clientaddr.sa_family == AF_INET)
|
if (((struct sockaddr_in*)clientaddr).sa_family == AF_INET)
|
||||||
{
|
{
|
||||||
unsigned long testAddr;
|
unsigned long testAddr;
|
||||||
testAddr = ((struct sockaddr_in *)&clientaddr)->sin_addr.s_addr;
|
testAddr = ((struct sockaddr_in *)&clientaddr)->sin_addr.s_addr;
|
||||||
|
|
|
@ -554,7 +554,7 @@ static int PartialIPAddress (char *in, struct sockaddr_qstorage *hostaddr)
|
||||||
else
|
else
|
||||||
port = net_hostport;
|
port = net_hostport;
|
||||||
|
|
||||||
hostaddr->sa_family = AF_INET;
|
((struct sockaddr_in *)hostaddr)->sin_family = AF_INET;
|
||||||
((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port);
|
((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port);
|
||||||
((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr);
|
((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr);
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ int WINS_StringToAddr (char *string, struct sockaddr_qstorage *addr)
|
||||||
sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp);
|
sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp);
|
||||||
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
|
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
|
||||||
|
|
||||||
addr->sa_family = AF_INET;
|
((struct sockaddr_in *)addr)->sin_family = AF_INET;
|
||||||
((struct sockaddr_in *)addr)->sin_addr.s_addr = htonl(ipaddr);
|
((struct sockaddr_in *)addr)->sin_addr.s_addr = htonl(ipaddr);
|
||||||
((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)hp);
|
((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)hp);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -724,7 +724,7 @@ int WINS_GetAddrFromName(char *name, struct sockaddr_qstorage *addr)
|
||||||
if (!hostentry)
|
if (!hostentry)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
addr->sa_family = AF_INET;
|
((struct sockaddr_in *)addr)->sin_family = AF_INET;
|
||||||
((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)net_hostport);
|
((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)net_hostport);
|
||||||
((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0];
|
((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0];
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ int WINS_GetAddrFromName(char *name, struct sockaddr_qstorage *addr)
|
||||||
|
|
||||||
int WINS_AddrCompare (struct sockaddr_qstorage *addr1, struct sockaddr_qstorage *addr2)
|
int WINS_AddrCompare (struct sockaddr_qstorage *addr1, struct sockaddr_qstorage *addr2)
|
||||||
{
|
{
|
||||||
if (addr1->sa_family != addr2->sa_family)
|
if (((struct sockaddr_in *)addr1)->sin_family != ((struct sockaddr_in *)addr2)->sin_family)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (((struct sockaddr_in *)addr1)->sin_addr.s_addr != ((struct sockaddr_in *)addr2)->sin_addr.s_addr)
|
if (((struct sockaddr_in *)addr1)->sin_addr.s_addr != ((struct sockaddr_in *)addr2)->sin_addr.s_addr)
|
||||||
|
|
Loading…
Reference in a new issue