summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskrll <skrll>2002-01-10 16:43:27 +0000
committerskrll <skrll>2002-01-10 16:43:27 +0000
commit0ba425477ce0bb24f195a57cb264c94a9cf300f9 (patch)
treedddc867430d6eadb0d28c12148254b38d5661047
parent7215a6afedf401bbcbf46f6a4ff8968980ff8a65 (diff)
downloadpkgsrc-0ba425477ce0bb24f195a57cb264c94a9cf300f9.tar.gz
Remove the autoconf BUILD_DEPENDS and have all the patches in one place.
-rw-r--r--games/quake6/Makefile10
-rw-r--r--games/quake6/distinfo13
-rw-r--r--games/quake6/patches/patch-aa33
-rw-r--r--games/quake6/patches/patch-ab16
-rw-r--r--games/quake6/patches/patch-ac13
-rw-r--r--games/quake6/patches/patch-ad13
-rw-r--r--games/quake6/patches/patch-ae23
-rw-r--r--games/quake6/patches/patch-af128
-rw-r--r--games/quake6/patches/patch-ag22
-rw-r--r--games/quake6/patches/patch-ah13
-rw-r--r--games/quake6/patches/patch-aj186
11 files changed, 426 insertions, 44 deletions
diff --git a/games/quake6/Makefile b/games/quake6/Makefile
index 64a97fd6383..420b0609489 100644
--- a/games/quake6/Makefile
+++ b/games/quake6/Makefile
@@ -1,20 +1,15 @@
-# $NetBSD: Makefile,v 1.14 2001/09/27 23:18:08 jlam Exp $
+# $NetBSD: Makefile,v 1.15 2002/01/10 16:43:27 skrll Exp $
DISTNAME= quake-v6-bsd-kame
PKGNAME= quake6-0.0
CATEGORIES= games
MASTER_SITES= http://www.viagenie.qc.ca/quake/
-PATCH_SITES= ftp://ftp.kame.net/pub/kame/misc/
-PATCHFILES= quake6-00-v6-20000202b.diff.gz
-PATCH_DIST_STRIP= -p1
-
MAINTAINER= itojun@kame.net
HOMEPAGE= http://www.viagenie.qc.ca/en/ipv6-quake.shtml
COMMENT= Quake over IPv6
DEPENDS= quakedata-[0-9]*:../../games/quakedata
-BUILD_DEPENDS= autoconf>=2.13:../../devel/autoconf
WRKSRC= ${WRKDIR}/quakeforge
@@ -36,7 +31,4 @@ IGNORE= "${PKGNAME} requires IPv6 support"
# "bindir" setting is very non-standard for GNU autoconf
CONFIGURE_ARGS+=--disable-asmopt --bindir=/bin
-post-patch:
- cd ${WRKSRC}; autoreconf
-
.include "../../mk/bsd.pkg.mk"
diff --git a/games/quake6/distinfo b/games/quake6/distinfo
index 446c9154780..889e53015ed 100644
--- a/games/quake6/distinfo
+++ b/games/quake6/distinfo
@@ -1,8 +1,15 @@
-$NetBSD: distinfo,v 1.2 2001/04/21 02:08:35 wiz Exp $
+$NetBSD: distinfo,v 1.3 2002/01/10 16:43:28 skrll Exp $
SHA1 (quake-v6-bsd-kame.tar.gz) = 09d58eef39f3d8a6b7b7287c88fc66d4dd3feb0b
Size (quake-v6-bsd-kame.tar.gz) = 4503326 bytes
SHA1 (quake6-00-v6-20000202b.diff.gz) = a4a1cf178e40c5effb3faad0fa744bbbcd0a56ab
Size (quake6-00-v6-20000202b.diff.gz) = 3857 bytes
-SHA1 (patch-aa) = 6a1efb5ac2a9a8a7375a40c95beb67276ae163e8
-SHA1 (patch-ab) = 6cb06286340c5d9818125594c097dda77714fb5e
+SHA1 (patch-aa) = 4f637a95f6045e616e9602ba0d7f2d609344e339
+SHA1 (patch-ab) = 418d3f9c1bcc53a68ab7da87a40413eb9adb41da
+SHA1 (patch-ac) = 26a88941cbc5aaaf1fe4993e7e5143f86a22d96a
+SHA1 (patch-ad) = c37c599f2e9388fb5caba6228dc2a021149d2320
+SHA1 (patch-ae) = 89328f2f9f8ebe2645b8612ed6b6ca2849494051
+SHA1 (patch-af) = 3dd7bf9a44a4e087e09e758b53c69406e1468121
+SHA1 (patch-ag) = d7821ab0e335b4e35e9721797b1cd5aa1ab8ee45
+SHA1 (patch-ah) = cba95c90176666b302288ff4e9dc1d292c512a2b
+SHA1 (patch-aj) = a754b5c78c5e81d4103276332f4a0bb3160770aa
diff --git a/games/quake6/patches/patch-aa b/games/quake6/patches/patch-aa
index 9888341b552..ad4e4bbcc6e 100644
--- a/games/quake6/patches/patch-aa
+++ b/games/quake6/patches/patch-aa
@@ -1,34 +1,13 @@
-$NetBSD: patch-aa,v 1.1 2000/02/01 17:17:41 itojun Exp $
---- qw_client/Makefile.in- Tue Feb 1 09:14:56 2000
-+++ qw_client/Makefile.in Tue Feb 1 09:15:03 2000
+$NetBSD: patch-aa,v 1.2 2002/01/10 16:43:28 skrll Exp $
+
+--- qw_client/Makefile.in.orig Tue Jan 11 15:56:21 2000
++++ qw_client/Makefile.in
@@ -17,7 +17,7 @@
BUILD_DIR = ../targets/qw_client
--LDFLAGS = @LDFLAGS@ @SND_LIBS@ -lm -L/usr/local/v6/lib -linet6
-+LDFLAGS = @LDFLAGS@ @SND_LIBS@ -lm
- LIBS = @LIBS@
- CC = @CC@
- INTEL_ARCH = @INTEL_ARCH@
---- qw_server/Makefile.in- Tue Feb 1 09:14:56 2000
-+++ qw_server/Makefile.in Tue Feb 1 09:15:06 2000
-@@ -16,7 +16,7 @@
- QW_COMMON_DIR= $(PROJECT_DIR)/qw_common
- BUILD_DIR = ../targets/qw_server
-
--LDFLAGS = @LDFLAGS@ -lm -L/usr/local/v6/lib -linet6
-+LDFLAGS = @LDFLAGS@ -lm
- LIBS = @LIBS@
- CC = @CC@
- INTEL_ARCH = @INTEL_ARCH@
---- uquake/Makefile.in- Tue Feb 1 09:14:56 2000
-+++ uquake/Makefile.in Tue Feb 1 09:15:09 2000
-@@ -16,7 +16,7 @@
- COMMON_DIR=$(PROJECT_DIR)/common
- BUILD_DIR =../targets/uquake
-
--LDFLAGS = @LDFLAGS@ @SND_LIBS@ -lm -L/usr/local/v6/lib -linet6
-+LDFLAGS = @LDFLAGS@ @SND_LIBS@ -lm
+-LDFLAGS = -L/usr/local/v6/lib -linet6 @LDFLAGS@ @SND_LIBS@ -lm
++LDFLAGS = @LDFLAGS@ @SND_LIBS@ -lm
LIBS = @LIBS@
CC = @CC@
INTEL_ARCH = @INTEL_ARCH@
diff --git a/games/quake6/patches/patch-ab b/games/quake6/patches/patch-ab
index 4c728c80908..a08d49cc337 100644
--- a/games/quake6/patches/patch-ab
+++ b/games/quake6/patches/patch-ab
@@ -1,12 +1,18 @@
-$NetBSD: patch-ab,v 1.1 2000/08/26 05:56:48 itojun Exp $
---- configure.in.orig Tue Jan 11 20:10:13 2000
-+++ configure.in Sat Aug 26 14:52:52 2000
-@@ -41,2 +41,3 @@
+$NetBSD: patch-ab,v 1.2 2002/01/10 16:43:28 skrll Exp $
+
+--- configure.in.orig Tue Jan 11 11:10:13 2000
++++ configure.in
+@@ -39,11 +39,12 @@
+ AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
+
dnl Checks for X11 support
+AC_PATH_X
AC_PATH_XTRA
-@@ -45,3 +46,3 @@
+ if test "x$no_x" = x; then
+ HAS_X11=yes
AC_CHECK_LIB(Xext, XShmQueryExtension, [X11_SHM_LIB=-lXext],
- [X11_SHM_LIB=""], [ $X_LIBS $X_EXTRA_LIBS ])
+ [X11_SHM_LIB=""], [ $X_LIBS $X_EXTRA_LIBS -lX11])
fi
+
+ dnl Check for DGA support
diff --git a/games/quake6/patches/patch-ac b/games/quake6/patches/patch-ac
new file mode 100644
index 00000000000..fe77659017e
--- /dev/null
+++ b/games/quake6/patches/patch-ac
@@ -0,0 +1,13 @@
+$NetBSD: patch-ac,v 1.1 2002/01/10 16:43:28 skrll Exp $
+
+--- configure.orig Thu Jan 10 15:58:43 2002
++++ configure
+@@ -2189,7 +2189,7 @@
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ ac_save_LIBS="$LIBS"
+-LIBS="-lXext $X_LIBS $X_EXTRA_LIBS $LIBS"
++LIBS="-lXext $X_LIBS $X_EXTRA_LIBS -lX11 $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 2195 "configure"
+ #include "confdefs.h"
diff --git a/games/quake6/patches/patch-ad b/games/quake6/patches/patch-ad
new file mode 100644
index 00000000000..c5a855a1464
--- /dev/null
+++ b/games/quake6/patches/patch-ad
@@ -0,0 +1,13 @@
+$NetBSD: patch-ad,v 1.1 2002/01/10 16:43:28 skrll Exp $
+
+--- qw_server/Makefile.in.orig Thu Jan 10 16:04:02 2002
++++ qw_server/Makefile.in
+@@ -16,7 +16,7 @@
+ QW_COMMON_DIR= $(PROJECT_DIR)/qw_common
+ BUILD_DIR = ../targets/qw_server
+
+-LDFLAGS = @LDFLAGS@ -lm -L/usr/local/v6/lib -linet6
++LDFLAGS = @LDFLAGS@ -lm
+ LIBS = @LIBS@
+ CC = @CC@
+ INTEL_ARCH = @INTEL_ARCH@
diff --git a/games/quake6/patches/patch-ae b/games/quake6/patches/patch-ae
new file mode 100644
index 00000000000..bc26b9adbe8
--- /dev/null
+++ b/games/quake6/patches/patch-ae
@@ -0,0 +1,23 @@
+$NetBSD: patch-ae,v 1.1 2002/01/10 16:43:28 skrll Exp $
+
+--- qw_common/net.h.orig Wed Jan 12 03:03:44 2000
++++ qw_common/net.h
+@@ -25,16 +25,14 @@
+
+ #define PORT_ANY -1
+
+-#ifdef AF_INET6
+ typedef struct
+ {
+- unsigned int ip[4];
++#ifdef AF_INET6
++ u_int32_t ip[4];
+ unsigned char family;
+ unsigned short port;
+ unsigned short pad;
+ #else
+-typedef struct
+-{
+ byte ip[4];
+ unsigned short port;
+ unsigned short pad;
diff --git a/games/quake6/patches/patch-af b/games/quake6/patches/patch-af
new file mode 100644
index 00000000000..d0febfa50a4
--- /dev/null
+++ b/games/quake6/patches/patch-af
@@ -0,0 +1,128 @@
+$NetBSD: patch-af,v 1.1 2002/01/10 16:43:28 skrll Exp $
+
+--- qw_common/net_udp.c.orig Thu Jan 13 04:01:30 2000
++++ qw_common/net_udp.c
+@@ -73,11 +73,9 @@
+ #else
+ typedef struct sockaddr_in6 sockaddress_t;
+ #ifdef __sun__
+-#define s6_addr32 _S6_un._S6_u32
++#define ss_family __ss_family
++#define ss_len __ss_len
+ #endif __sun__
+-#ifdef __FreeBSD__
+-#define s6_addr32 __u6_addr.__u6_addr32
+-#endif __FreeBSD__
+
+ #endif AF_INET6
+
+@@ -108,11 +106,8 @@
+ memset (s, 0, sizeof(*s));
+ // s->sin6_family = a->family;
+
+- s->sin6_family = AF_UNSPEC;
+- s->sin6_addr.s6_addr32[0] = a->ip[0];
+- s->sin6_addr.s6_addr32[1] = a->ip[1];
+- s->sin6_addr.s6_addr32[2] = a->ip[2];
+- s->sin6_addr.s6_addr32[3] = a->ip[3];
++ s->sin6_family = AF_INET6;
++ memcpy(&s->sin6_addr, a->ip, sizeof(s->sin6_addr));
+ s->sin6_port = a->port;
+ s->sin6_len = sizeof(struct sockaddr_in6);
+ #endif
+@@ -124,10 +119,7 @@
+ *(int *)&a->ip = *(int *)&s->sin_addr;
+ a->port = s->sin_port;
+ #else
+- a->ip[0] = s->sin6_addr.s6_addr32[0];
+- a->ip[1] = s->sin6_addr.s6_addr32[1];
+- a->ip[2] = s->sin6_addr.s6_addr32[2];
+- a->ip[3] = s->sin6_addr.s6_addr32[3];
++ memcpy(a->ip, &s->sin6_addr, sizeof(s->sin6_addr));
+ a->port = s->sin6_port;
+ a->family = s->sin6_family;
+ #endif
+@@ -182,11 +174,21 @@
+ static char s[BUFSIZ];
+ struct sockaddr_storage ss;
+
+- ss.__ss_len = sizeof(ss);
+- ss.__ss_family = AF_UNSPEC;
+- memcpy(ss.__ss_pad1, &(a.ip), sizeof(a.ip));
+- if (getnameinfo((struct sockaddr *) &ss,sizeof(ss),s,sizeof(s),NULL,0,NI_NUMERICHOST)) {
+- strcpy(s,"<invalid>");
++ memset(&ss, 0, sizeof(ss));
++ if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)a.ip)) {
++ ss.ss_len = sizeof(struct sockaddr_in);
++ ss.ss_family = AF_INET;
++ memcpy(&((struct sockaddr_in *)&ss)->sin_addr,
++ &((struct in6_addr *)a.ip)->s6_addr[12], sizeof(struct in_addr));
++ } else {
++ ss.ss_len = sizeof(struct sockaddr_in6);
++ ss.ss_family = AF_INET6;
++ memcpy(&((struct sockaddr_in6 *)&ss)->sin6_addr,
++ a.ip, sizeof(struct in6_addr));
++ }
++ if (getnameinfo((struct sockaddr *)&ss, ss.ss_len, s, sizeof(s),
++ NULL, 0, NI_NUMERICHOST)) {
++ strcpy(s, "<invalid>");
+ }
+ return s;
+ }
+@@ -282,10 +284,9 @@
+ ss6=(struct sockaddr_in6 *) &ss;
+ ss4=(struct sockaddr_in *) resultp->ai_addr;
+ ss6->sin6_family=AF_INET6;
+- ss6->sin6_addr.s6_addr32[0]=0;
+- ss6->sin6_addr.s6_addr32[1]=0;
+- ss6->sin6_addr.s6_addr32[2]=htonl(0xffff);
+- ss6->sin6_addr.s6_addr32[3]=ss4->sin_addr.s_addr;
++ memset(&ss6->sin6_addr, 0, sizeof(ss6->sin6_addr));
++ ss6->sin6_addr.s6_addr[10] = ss6->sin6_addr.s6_addr[11] = 0xff;
++ memcpy(&ss6->sin6_addr.s6_addr[12], &ss4->sin_addr, sizeof(ss4->sin_addr));
+ break;
+ case AF_INET6:
+ memcpy(&ss,resultp->ai_addr,sizeof(struct sockaddr_in6));
+@@ -305,10 +306,10 @@
+ // the IP is NOT one of our interfaces.
+ qboolean NET_IsClientLegal(netadr_t *adr)
+ {
++#if 0
+ sockaddress_t sadr;
+ int newsocket;
+
+-#if 0
+ if (adr->ip[0] == 127)
+ return false; // no local connections period
+
+@@ -416,6 +417,7 @@
+ int Error;
+ char Buf[BUFSIZ], *Service, *Host;
+ qboolean _true = true;
++ const int false = 0;
+ int i;
+
+ memset(&hints, 0, sizeof(hints));
+@@ -438,13 +440,21 @@
+ Service = Buf;
+ }
+
+- if(Error = getaddrinfo(Host, Service, &hints, &res))
++ Error = getaddrinfo(Host, Service, &hints, &res);
++ if (Error)
+ Sys_Error ("UDP_OpenSocket: getaddrinfo: %s", gai_strerror(Error));
+
+ if ((newsocket = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1)
+ Sys_Error ("UDP_OpenSocket: socket:", strerror(errno));
+ if (ioctl (newsocket, FIONBIO, (char *)&_true) == -1)
+ Sys_Error ("UDP_OpenSocket: ioctl FIONBIO:", strerror(errno));
++
++#ifdef IPV6_BINDV6ONLY
++ if (setsockopt(newsocket, IPPROTO_IPV6, IPV6_BINDV6ONLY, &false,
++ sizeof(false)) < 0) {
++ /* I don't care */
++ }
++#endif
+
+ if (bind(newsocket, res->ai_addr, res->ai_addrlen) < 0)
+ Sys_Error ("UDP_OpenSocket: bind: %s", strerror(errno));
diff --git a/games/quake6/patches/patch-ag b/games/quake6/patches/patch-ag
new file mode 100644
index 00000000000..853a7daacbc
--- /dev/null
+++ b/games/quake6/patches/patch-ag
@@ -0,0 +1,22 @@
+$NetBSD: patch-ag,v 1.1 2002/01/10 16:43:28 skrll Exp $
+
+--- qw_client/cl_main.c.orig Mon Jan 10 16:59:34 2000
++++ qw_client/cl_main.c
+@@ -854,9 +854,14 @@
+
+ Con_Printf ("client command\n");
+
+- if ((*(unsigned *)net_from.ip != *(unsigned *)net_local_adr.ip
+- && *(unsigned *)net_from.ip != htonl(INADDR_LOOPBACK)) )
+- {
++ 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;
+ }
diff --git a/games/quake6/patches/patch-ah b/games/quake6/patches/patch-ah
new file mode 100644
index 00000000000..d7d87db9612
--- /dev/null
+++ b/games/quake6/patches/patch-ah
@@ -0,0 +1,13 @@
+$NetBSD: patch-ah,v 1.1 2002/01/10 16:43:28 skrll Exp $
+
+--- qw_server/sys_unix.c.orig Mon Jan 10 16:59:37 2000
++++ qw_server/sys_unix.c
+@@ -25,7 +25,7 @@
+ #endif
+
+ // FIXME: use autoconf
+-#if defined(unix) || defined(_AIX)
++#if defined(unix) || defined(_AIX) || defined(__NetBSD__)
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <sys/time.h>
diff --git a/games/quake6/patches/patch-aj b/games/quake6/patches/patch-aj
new file mode 100644
index 00000000000..c03b6e8ce9d
--- /dev/null
+++ b/games/quake6/patches/patch-aj
@@ -0,0 +1,186 @@
+$NetBSD: patch-aj,v 1.1 2002/01/10 16:43:29 skrll Exp $
+
+--- uquake/net_udp.c.orig Mon Jan 10 16:59:39 2000
++++ uquake/net_udp.c
+@@ -32,12 +32,17 @@
+ #include <sys/param.h>
+ #include <sys/ioctl.h>
+ #include <errno.h>
++#include <net/if.h>
+
+ #ifdef __sun__
+ #include <sys/filio.h>
+ #undef model_t
+ #endif
+
++#ifndef INADDR_LOOPBACK
++#define INADDR_LOOPBACK (u_int32_t)0x7f000001
++#endif
++
+ #if defined(sgi) && defined(sa_family)
+ /* Get rid of problematic SGI #def */
+ #undef sa_family
+@@ -62,6 +67,91 @@
+ #include "net_udp.h"
+
+ //=============================================================================
++/* get any of my non-loopback addr. */
++static int
++grab_myaddr(family, sa)
++ int family;
++ struct sockaddr *sa;
++{
++ int s;
++ unsigned int maxif;
++ struct ifreq *iflist;
++ struct ifconf ifconf;
++ struct ifreq *ifr, *ifr_end;
++ struct myaddrs *p;
++ struct sockaddr_in *sin;
++ struct sockaddr_in6 *sin6;
++
++#if 0
++ maxif = if_maxindex() + 1;
++#else
++ maxif = 10;
++#endif
++ iflist = (struct ifreq *)malloc(maxif * BUFSIZ); /* XXX */
++ if (!iflist) {
++ Sys_Error("grab_myaddr: not enough core\n");
++ /*NOTREACHED*/
++ }
++
++ if ((s = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
++ Sys_Error("socket(SOCK_DGRAM)\n");
++ /*NOTREACHED*/
++ }
++ memset(&ifconf, 0, sizeof(ifconf));
++ ifconf.ifc_req = iflist;
++ ifconf.ifc_len = maxif * BUFSIZ; /* XXX */
++ if (ioctl(s, SIOCGIFCONF, &ifconf) < 0) {
++ Sys_Error("ioctl(SIOCGIFCONF)\n");
++ /*NOTREACHED*/
++ }
++ close(s);
++
++ /* Look for this interface in the list */
++ ifr_end = (struct ifreq *) (ifconf.ifc_buf + ifconf.ifc_len);
++ for (ifr = ifconf.ifc_req;
++ ifr < ifr_end;
++ ifr = (struct ifreq *) ((char *) &ifr->ifr_addr
++ + ifr->ifr_addr.sa_len)) {
++ switch (ifr->ifr_addr.sa_family) {
++ case AF_INET:
++ sin = (struct sockaddr_in *)&ifr->ifr_addr;
++ if (sin->sin_addr.s_addr == htonl(0))
++ continue;
++ if (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK))
++ continue;
++ break;
++ case AF_INET6:
++ sin6 = (struct sockaddr_in6 *)&ifr->ifr_addr;
++ if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
++ continue;
++ if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
++ continue;
++ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
++ continue;
++ if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))
++ continue;
++ break;
++ }
++ if (ifr->ifr_addr.sa_family != family)
++ continue;
++
++ memcpy(sa, &ifr->ifr_addr, ifr->ifr_addr.sa_len);
++
++ {
++ char hbuf[NI_MAXHOST];
++ if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0,
++ NI_NUMERICHOST) == 0)
++ printf("got %s as local address\n", hbuf);
++ else {
++ printf("non-printable local address, family %d\n",
++ family);
++ }
++ }
++ break;
++ }
++
++ free(iflist);
++}
+
+ int UDP_Init (void)
+ {
+@@ -74,9 +164,18 @@
+ return -1;
+
+ // determine my name & address
++ memset(&myAddr, 0, sizeof(myAddr));
++#if 0
+ gethostname(buff, MAXHOSTNAMELEN);
+ local = gethostbyname(buff);
+ myAddr = *(int *)local->h_addr_list[0];
++#else
++ {
++ struct sockaddr_in sin;
++ if (grab_myaddr(AF_INET, (struct sockaddr *)&sin) == 0)
++ memcpy(&myAddr, &sin.sin_addr, sizeof(myAddr));
++ }
++#endif
+
+ // if the quake hostname isn't set, set it to the machine name
+ if (Q_strcmp(hostname.string, "UNNAMED") == 0)
+@@ -137,25 +236,45 @@
+
+ int UDP_OpenSocket (int port)
+ {
++ struct addrinfo hints, *res = NULL;
++ int error;
++ char pbuf[NI_MAXSERV];
+ int newsocket;
+- struct sockaddr_in address;
+ qboolean _true = true;
++ const int false = 0;
+
+- if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
++ snprintf(pbuf, sizeof(pbuf), "%d", port);
++ memset(&hints, 0, sizeof(hints));
++ hints.ai_family = PF_INET6;
++ hints.ai_socktype = SOCK_DGRAM;
++ hints.ai_flags = AI_PASSIVE;
++ error = getaddrinfo(NULL, pbuf, &hints, &res);
++ if (error)
+ return -1;
+
+- if (ioctl (newsocket, FIONBIO, (char *)&_true) == -1)
++ if ((newsocket = socket (res->ai_family, res->ai_socktype,
++ res->ai_protocol)) < 0)
++ return -1;
++
++ if (ioctl (newsocket, FIONBIO, (char *)&_true) < 0)
+ goto ErrorReturn;
+
+- address.sin_family = AF_INET;
+- address.sin_addr.s_addr = INADDR_ANY;
+- address.sin_port = htons(port);
+- if( bind (newsocket, (void *)&address, sizeof(address)) == -1)
++#ifdef IPV6_BINDV6ONLY
++ if (setsockopt(newsocket, IPPROTO_IPV6, IPV6_BINDV6ONLY, &false,
++ sizeof(false)) < 0) {
++ /* I don't care */
++ }
++#endif
++
++ if (bind (newsocket, res->ai_addr, res->ai_addrlen) < 0)
+ goto ErrorReturn;
+
++ freeaddrinfo(res);
+ return newsocket;
+
+ ErrorReturn:
++ if (res)
++ freeaddrinfo(res);
+ close (newsocket);
+ return -1;
+ }