aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-05 16:01:58 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-04-05 16:01:58 +0000
commit55634342dda65d9f885024e88573bb7db8b26799 (patch)
tree966bd28496795e9013ca73fcc50ec1a3224c8c77 /code
parentbed97d1806cd0e06a3e3acf1893a0d5e3d9b1744 (diff)
downloadioquake3-aero-55634342dda65d9f885024e88573bb7db8b26799.tar.gz
ioquake3-aero-55634342dda65d9f885024e88573bb7db8b26799.zip
* Fix to MinGW build following IPv6 changes
git-svn-id: svn://svn.icculus.org/quake3/trunk@1294 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/qcommon/net_ip.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c
index 5c66f80..b2fa6a2 100644
--- a/code/qcommon/net_ip.c
+++ b/code/qcommon/net_ip.c
@@ -24,12 +24,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/qcommon.h"
#ifdef _WIN32
-#include <Winsock2.h>
-#include <Ws2tcpip.h>
-#include <Wspiapi.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#if WINVER < 0x501
+#include <wspiapi.h>
+#else
+#include <ws2spi.h>
+#endif
typedef int socklen_t;
-#define sa_family_t ADDRESS_FAMILY
+typedef unsigned short sa_family_t;
#define EAGAIN WSAEWOULDBLOCK
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define EAFNOSUPPORT WSAEAFNOSUPPORT
@@ -524,7 +528,7 @@ Sys_SendPacket
==================
*/
void Sys_SendPacket( int length, const void *data, netadr_t to ) {
- int ret;
+ int ret = SOCKET_ERROR;
struct sockaddr_storage addr;
if( to.type != NA_BROADCAST && to.type != NA_IP && to.type != NA_IP6 ) {
@@ -790,12 +794,14 @@ int NET_IP6Socket( char *net_interface, int port, int *err ) {
return INVALID_SOCKET;
}
+#ifdef IPV6_V6ONLY
// ipv4 addresses should not be allowed to connect via this socket.
if(setsockopt(newsocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &i, sizeof(i)) == SOCKET_ERROR)
{
// win32 systems don't seem to support this anyways.
Com_DPrintf("WARNING: NET_IP6Socket: setsockopt IPV6_V6ONLY: %s\n", NET_ErrorString());
}
+#endif
// make it broadcast capable
if( setsockopt( newsocket, SOL_SOCKET, SO_BROADCAST, (char *) &i, sizeof(i) ) == SOCKET_ERROR ) {