This allows us to use getaddrinfo(), getnameinfo() and related functions, which
allow tinc to make connections over existing IPv6 networks. These functions are
not available on Windows 2000 however. By default, support is enabled, but when
compiling for Windows 2000 the configure switch --with-windows2000 should be
used.
Since getaddrinfo() et al. are not functions but macros on Windows, we have to
use AC_CHECK_DECLS() instead of AC_CHECK_FUNCS() in configure.in.
+AC_ARG_WITH(windows2000,
+ AS_HELP_STRING([--with-windows2000], [compile with support for Windows 2000. This disables support for tunneling over existing IPv6 networks.]),
+ [AC_DEFINE(WITH_WINDOWS2000, 1, [Compile with support for Windows 2000])]
+)
+
AM_CONDITIONAL(TUNEMU, test "$tunemu" = true)
AC_CACHE_SAVE
AM_CONDITIONAL(TUNEMU, test "$tunemu" = true)
AC_CACHE_SAVE
AC_CHECK_LIB(nsl, gethostbyname)
])
AC_CHECK_LIB(nsl, gethostbyname)
])
-AC_CHECK_FUNCS([freeaddrinfo gai_strerror getaddrinfo getnameinfo inet_aton],
+AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
[], [], [#include "have.h"]
)
[], [], [#include "have.h"]
)
#include <fcntl.h>
#include <unistd.h>
#include <fcntl.h>
#include <unistd.h>
+#ifdef HAVE_MINGW
+#ifdef WITH_WINDOWS2000
+#define WINVER Windows2000
+#else
+#define WINVER WindowsXP
+#endif
+#include <w32api.h>
+#include <windows.h>
+#include <ws2tcpip.h>
+#endif
+
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#include <netinet/if_ether.h>
#endif
#include <netinet/if_ether.h>
#endif
-#ifdef HAVE_MINGW
-#include <windows.h>
-#include <winsock2.h>
-#endif
-
#endif /* __TINC_SYSTEM_H__ */
#endif /* __TINC_SYSTEM_H__ */
extern int vasprintf(char **, const char *, va_list ap);
#endif
extern int vasprintf(char **, const char *, va_list ap);
#endif
-#ifndef HAVE_GETNAMEINFO
-extern int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
- size_t hostlen, char *serv, size_t servlen, int flags);
-#endif
-
#ifndef HAVE_GETTIMEOFDAY
extern int gettimeofday(struct timeval *, void *);
#endif
#ifndef HAVE_GETTIMEOFDAY
extern int gettimeofday(struct timeval *, void *);
#endif
#include "fake-getaddrinfo.h"
#include "xalloc.h"
#include "fake-getaddrinfo.h"
#include "xalloc.h"
-#ifndef HAVE_GAI_STRERROR
+#if !HAVE_DECL_GAI_STRERROR
char *gai_strerror(int ecode)
{
switch (ecode) {
char *gai_strerror(int ecode)
{
switch (ecode) {
}
#endif /* !HAVE_GAI_STRERROR */
}
#endif /* !HAVE_GAI_STRERROR */
-#ifndef HAVE_FREEADDRINFO
+#if !HAVE_DECL_FREEADDRINFO
void freeaddrinfo(struct addrinfo *ai)
{
struct addrinfo *next;
void freeaddrinfo(struct addrinfo *ai)
{
struct addrinfo *next;
}
#endif /* !HAVE_FREEADDRINFO */
}
#endif /* !HAVE_FREEADDRINFO */
-#ifndef HAVE_GETADDRINFO
+#if !HAVE_DECL_GETADDRINFO
static struct addrinfo *malloc_ai(uint16_t port, uint32_t addr)
{
struct addrinfo *ai;
static struct addrinfo *malloc_ai(uint16_t port, uint32_t addr)
{
struct addrinfo *ai;
};
#endif /* !HAVE_STRUCT_ADDRINFO */
};
#endif /* !HAVE_STRUCT_ADDRINFO */
-#ifndef HAVE_GETADDRINFO
+#if !HAVE_DECL_GETADDRINFO
int getaddrinfo(const char *hostname, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
#endif /* !HAVE_GETADDRINFO */
int getaddrinfo(const char *hostname, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
#endif /* !HAVE_GETADDRINFO */
-#ifndef HAVE_GAI_STRERROR
+#if !HAVE_DECL_GAI_STRERROR
char *gai_strerror(int ecode);
#endif /* !HAVE_GAI_STRERROR */
char *gai_strerror(int ecode);
#endif /* !HAVE_GAI_STRERROR */
-#ifndef HAVE_FREEADDRINFO
+#if !HAVE_DECL_FREEADDRINFO
void freeaddrinfo(struct addrinfo *ai);
#endif /* !HAVE_FREEADDRINFO */
void freeaddrinfo(struct addrinfo *ai);
#endif /* !HAVE_FREEADDRINFO */
#include "fake-getnameinfo.h"
#include "fake-getaddrinfo.h"
#include "fake-getnameinfo.h"
#include "fake-getaddrinfo.h"
-#ifndef HAVE_GETNAMEINFO
+#if !HAVE_DECL_GETNAMEINFO
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
{
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
{
#ifndef _FAKE_GETNAMEINFO_H
#define _FAKE_GETNAMEINFO_H
#ifndef _FAKE_GETNAMEINFO_H
#define _FAKE_GETNAMEINFO_H
-#ifndef HAVE_GETNAMEINFO
+#if !HAVE_DECL_GETNAMEINFO
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags);
#endif /* !HAVE_GETNAMEINFO */
int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags);
#endif /* !HAVE_GETNAMEINFO */