aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-08-31 19:54:29 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-08-31 19:54:29 +0000
commitc6d2bfb53ab3821c6429355d2c6d1f7f44ef4a14 (patch)
tree1f4bda2c5b9fe6c9a2fb5c2e0035057061cb19bf /code/qcommon
parent60bee81ce803959461493d107ad5a0e568c958c8 (diff)
downloadioquake3-aero-c6d2bfb53ab3821c6429355d2c6d1f7f44ef4a14.tar.gz
ioquake3-aero-c6d2bfb53ab3821c6429355d2c6d1f7f44ef4a14.zip
- Add scope id to ipv6 addresses.
- Clean up a few other ipv6 issues like removing the seemingly unnecessary MacOSX workaround. - Bring ipv6 master server up to speed for dpmaster Thanks go out to Mathieu Olivier for this work. git-svn-id: svn://svn.icculus.org/quake3/trunk@1468 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r--code/qcommon/net_ip.c19
-rw-r--r--code/qcommon/q_shared.h2
-rw-r--r--code/qcommon/qcommon.h1
3 files changed, 13 insertions, 9 deletions
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c
index e93ee23..ac78a83 100644
--- a/code/qcommon/net_ip.c
+++ b/code/qcommon/net_ip.c
@@ -227,6 +227,7 @@ static void NetadrToSockadr( netadr_t *a, struct sockaddr *s ) {
((struct sockaddr_in6 *)s)->sin6_family = AF_INET6;
((struct sockaddr_in6 *)s)->sin6_addr = * ((struct in6_addr *) &a->ip6);
((struct sockaddr_in6 *)s)->sin6_port = a->port;
+ ((struct sockaddr_in6 *)s)->sin6_scope_id = a->scope_id;
}
else if(a->type == NA_MULTICAST6)
{
@@ -248,6 +249,7 @@ static void SockadrToNetadr( struct sockaddr *s, netadr_t *a ) {
a->type = NA_IP6;
memcpy(a->ip6, &((struct sockaddr_in6 *)s)->sin6_addr, sizeof(a->ip6));
a->port = ((struct sockaddr_in6 *)s)->sin6_port;
+ a->scope_id = ((struct sockaddr_in6 *)s)->sin6_scope_id;
}
}
@@ -279,14 +281,11 @@ static qboolean Sys_StringToSockaddr(const char *s, struct sockaddr *sadr, int s
memset(sadr, '\0', sizeof(*sadr));
memset(&hints, '\0', sizeof(hints));
- // workaround for buggy MacOSX getaddrinfo implementation that doesn't handle AF_UNSPEC in hints correctly.
- if(family == AF_UNSPEC)
- hintsp = NULL;
- else
- {
- hintsp = &hints;
- hintsp->ai_family = family;
- }
+ hintsp = &hints;
+ hintsp->ai_family = family;
+ hintsp->ai_socktype = SOCK_DGRAM;
+ // FIXME: we should set "->ai_flags" to AI_PASSIVE if we intend
+ // to use this structure for a bind() - instead of a sendto()
retval = getaddrinfo(s, NULL, hintsp, &res);
@@ -399,7 +398,7 @@ qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b)
if (a.type == NA_IP6)
{
- if(!memcmp(a.ip6, b.ip6, sizeof(a.ip6)))
+ if(!memcmp(a.ip6, b.ip6, sizeof(a.ip6)) && a.scope_id == b.scope_id)
return qtrue;
return qfalse;
@@ -720,6 +719,8 @@ qboolean Sys_IsLANAddress( netadr_t adr ) {
}
else
{
+ // TODO? should we check the scope_id here?
+
compareip = (byte *) &((struct sockaddr_in6 *) &localIP[index].addr)->sin6_addr;
comparemask = (byte *) &((struct sockaddr_in6 *) &localIP[index].netmask)->sin6_addr;
compareadr = adr.ip6;
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index 248fcf1..9a7ddac 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -38,6 +38,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define CLIENT_WINDOW_MIN_TITLE "ioq3"
#endif
+#define GAMENAME BASEGAME
+
#ifdef _MSC_VER
#define PRODUCT_VERSION "1.35"
#endif
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index 72ea617..006342a 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -155,6 +155,7 @@ typedef struct {
byte ip6[16];
unsigned short port;
+ unsigned long scope_id; // Needed for IPv6 link-local addresses
} netadr_t;
void NET_Init( void );