summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-12-24 17:17:18 +0000
committerfrosch <frosch@openttd.org>2014-12-24 17:17:18 +0000
commit396dde16363a6890f71a9d3273b62e00f9d4acc3 (patch)
treee613431bb76b33478f513b28aecefdf5ab0c3180 /src/network/core
parentac13e399d05e226a1c1140f818a9e20ac110110d (diff)
downloadopenttd-396dde16363a6890f71a9d3273b62e00f9d4acc3.tar.xz
(svn r27092) -Fix/Add [FS#6186]: Compilation on OS/2 (smedles)
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/address.cpp2
-rw-r--r--src/network/core/os_abstraction.h27
2 files changed, 29 insertions, 0 deletions
diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp
index d25ade4a3..62af3a40b 100644
--- a/src/network/core/address.cpp
+++ b/src/network/core/address.cpp
@@ -356,10 +356,12 @@ static SOCKET ListenLoopProc(addrinfo *runp)
DEBUG(net, 3, "[%s] could not set reusable %s sockets for port %s: %s", type, family, address, strerror(errno));
}
+#ifndef __OS2__
if (runp->ai_family == AF_INET6 &&
setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&on, sizeof(on)) == -1) {
DEBUG(net, 3, "[%s] could not disable IPv4 over IPv6 on port %s: %s", type, address, strerror(errno));
}
+#endif
if (bind(sock, runp->ai_addr, (int)runp->ai_addrlen) != 0) {
DEBUG(net, 1, "[%s] could not bind on %s port %s: %s", type, family, address, strerror(errno));
diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h
index 980c6f7f6..9608f08fa 100644
--- a/src/network/core/os_abstraction.h
+++ b/src/network/core/os_abstraction.h
@@ -239,11 +239,38 @@ static inline void OTTDfreeaddrinfo(struct addrinfo *ai)
# include <netdb.h>
# include <nerrno.h>
# define INADDR_NONE 0xffffffff
+# include "../../3rdparty/os2/getaddrinfo.h"
+# include "../../3rdparty/os2/getnameinfo.h"
+
+#define IPV6_V6ONLY 27
+
+/*
+ * IPv6 address
+ */
+struct in6_addr {
+ union {
+ uint8_t __u6_addr8[16];
+ uint16_t __u6_addr16[8];
+ uint32_t __u6_addr32[4];
+ } __u6_addr; /* 128-bit IP6 address */
+};
+
+#define s6_addr __u6_addr.__u6_addr8
+
+struct sockaddr_in6 {
+ uint8_t sin6_len; /* length of this struct */
+ sa_family_t sin6_family; /* AF_INET6 */
+ in_port_t sin6_port; /* Transport layer port # */
+ uint32_t sin6_flowinfo; /* IP6 flow information */
+ struct in6_addr sin6_addr; /* IP6 address */
+ uint32_t sin6_scope_id; /* scope zone index */
+};
typedef int socklen_t;
#if !defined(__INNOTEK_LIBC__)
typedef unsigned long in_addr_t;
#endif /* __INNOTEK_LIBC__ */
+
#endif /* OS/2 */
/* MorphOS and Amiga stuff */