[quake2] quake2 on ipv6
Florent Parent
Florent.Parent at viagenie.qc.ca
Tue Feb 19 09:38:30 EST 2002
--On 2002-02-18 22:58:29 -0800 mike at vinge.mine.nu wrote:
> I think you forgot to include the new file :)
Doh! Here it is.
I've also received feedback from Mike Saywell <ms at saywell.net> using this
on linux. Essentially, you need to remove the -DHAVE_SIN6_LEN, but Mike
also added a patch to remove an extra scope identifier (%) inside the ipv6
address that appears on linux only. I will take a look at this later on.
I've included Mike's patch as well if you want to take a look. You can't
apply it directly though since some of those changes were already included
in the net_udp6.c file.
Florent
--
Florent Parent
Viagénie http://www.viagenie.qc.ca
-------------- next part --------------
A non-text attachment was scrubbed...
Name: net_udp6.c
Type: application/octet-stream
Size: 27085 bytes
Desc: not available
URL: <http://icculus.org/pipermail/quake2/attachments/20020219/f86bb188/attachment.obj>
-------------- next part --------------
--- ../../backup/quake2/src/linux/net_udp6.c Sun Feb 17 18:03:19 2002
+++ linux/net_udp6.c Sun Feb 17 19:42:52 2002
@@ -329,7 +329,6 @@
base = NET_BaseAdrToString (a);
Com_sprintf (s, sizeof(s), "[%s]:%d", base, ntohs(a.port));
-
return s;
}
@@ -347,9 +346,9 @@
qboolean NET_StringToSockaddr (char *s, struct sockaddr_storage *sadr)
{
char copy[128];
- char *addrs, *space;
+ char *addrs, *space, *strpextra;
char *ports = NULL;
- int err;
+ int err, percs;
struct addrinfo hints;
struct addrinfo *resultp;
@@ -358,7 +357,7 @@
hints.ai_family = PF_UNSPEC;
strcpy (copy, s);
- addrs = space = copy;
+ strpextra = addrs = space = copy;
if (*addrs == '[') {
addrs++;
for (; *space && *space != ']'; space++);
@@ -375,13 +374,21 @@
ports = space + 1;
}
}
-
+ // Strip off any extraneous %bar fields
+ percs = 0;
+ for (; *strpextra; strpextra++) {
+ if (*strpextra == '%') {
+ percs++;
+ if (percs == 2)
+ *strpextra = '\0';
+ }
+ }
if ((err = getaddrinfo (addrs, ports, &hints, &resultp))) {
// Error
Com_Printf ("NET_StringToSockaddr: string %s:\n%s\n", s, gai_strerror(err));
return 0;
}
-
+
switch (resultp->ai_family) {
case AF_INET:
// convert to ipv4 addr
@@ -611,8 +618,14 @@
* passed a multicast address of the
* form
* ff0x::xxx%multicast_interface */
- error = getnameinfo ((struct sockaddr *) s6, s6->sin6_len, tmp, sizeof (tmp),
- NULL, 0, NI_NUMERICHOST);
+ bzero(tmp, sizeof(tmp));
+ #ifdef HAVE_SIN6_LEN
+ error = getnameinfo ((struct sockaddr *) s6, s6->sin6_len, tmp, sizeof(tmp),
+ NULL, 0, NI_NUMERICHOST);
+ #else
+ error = getnameinfo ((struct sockaddr *) s6, sizeof(struct sockaddr_storage), tmp, sizeof(tmp),
+ NULL, 0, NI_NUMERICHOST);
+ #endif
if (error) {
Com_Printf("NET_SendPacket: getnameinfo: %s", gai_strerror(error));
return;
@@ -624,7 +637,6 @@
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_NUMERICHOST;
-
error = getaddrinfo (mcast_addr, mcast_port, &hints, &res);
if (error) {
Com_Printf("NET_SendPacket: getaddrinfo: %s", gai_strerror(error));
--- ../../backup/quake2/src/client/cl_main.c Sun Feb 17 19:58:09 2002
+++ client/cl_main.c Sun Feb 17 16:34:56 2002
@@ -452,6 +452,8 @@
{
netadr_t adr;
+ memset(&adr, 0, sizeof(adr));
+
// if the local server is running and we aren't
// then connect
if (cls.state == ca_disconnected && Com_ServerState() )
@@ -684,6 +686,7 @@
int i, l;
char *in, *out;
netadr_t adr;
+ memset(&adr, 0, sizeof(adr));
if (Cmd_Argc() != 3)
{
@@ -811,6 +814,7 @@
NET_Config (true); // allow remote
+ memset(&adr, 0, sizeof(adr));
// send a broadcast packet
Com_Printf ("pinging broadcast...\n");
More information about the quake2
mailing list