summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorItamar Reis Peixoto <itamar@ispbrasil.com.br>2016-02-08 22:40:05 -0200
committerItamar Reis Peixoto <itamar@ispbrasil.com.br>2016-02-08 22:40:05 -0200
commit08121e08406eec8a5ab8a7af9d2230735918d56c (patch)
tree0adad67c258fa73bde2ce2d64f7eeef62639f998
parentee436aeec9385a77cb547384575bcc2f9ad2746c (diff)
parent536ee41c5e53647c54f63eb9179224756d02a8f6 (diff)
downloadxrdp-proprietary-08121e08406eec8a5ab8a7af9d2230735918d56c.tar.gz
xrdp-proprietary-08121e08406eec8a5ab8a7af9d2230735918d56c.zip
Merge pull request #254 from metalefty/freebsd/ipv6
Unbreak IPv6 on FreeBSD and add IPv6-only option
-rw-r--r--common/os_calls.c10
-rw-r--r--configure.ac14
2 files changed, 16 insertions, 8 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 6a8bf136..0034cb5b 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -411,7 +411,7 @@ g_tcp_socket(void)
unsigned int option_len;
#endif
-#if defined(XRDP_ENABLE_IPV6) && !defined(NO_ARPA_INET_H_IP6)
+#if defined(XRDP_ENABLE_IPV6)
rv = (int)socket(AF_INET6, SOCK_STREAM, 0);
#else
rv = (int)socket(AF_INET, SOCK_STREAM, 0);
@@ -420,14 +420,18 @@ g_tcp_socket(void)
{
return -1;
}
-#if defined(XRDP_ENABLE_IPV6) && !defined(NO_ARPA_INET_H_IP6)
+#if defined(XRDP_ENABLE_IPV6)
option_len = sizeof(option_value);
if (getsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&option_value,
&option_len) == 0)
{
if (option_value != 0)
{
+#if defined(XRDP_ENABLE_IPV6ONLY)
+ option_value = 1;
+#else
option_value = 0;
+#endif
option_len = sizeof(option_value);
if (setsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&option_value,
option_len) < 0)
@@ -659,7 +663,7 @@ g_sck_close(int sck)
/*****************************************************************************/
/* returns error, zero is good */
-#if defined(XRDP_ENABLE_IPV6) && !defined(NO_ARPA_INET_H_IP6)
+#if defined(XRDP_ENABLE_IPV6)
int APP_CC
g_tcp_connect(int sck, const char *address, const char *port)
{
diff --git a/configure.ac b/configure.ac
index cd873a68..7535620d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,9 @@ AM_CONDITIONAL(SESMAN_NOPAM, [test x$enable_pam != xyes])
AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6],
[Build IPv6 support (default: no, experimental)]),
[], [enable_ipv6=no])
+AC_ARG_ENABLE(ipv6only, AS_HELP_STRING([--enable-ipv6only],
+ [Build IPv6-only (default: no)]),
+ [], [enable_ipv6only=no])
AC_ARG_ENABLE(kerberos, AS_HELP_STRING([--enable-kerberos],
[Build kerberos support (default: no)]),
[], [enable_kerberos=no])
@@ -126,16 +129,17 @@ then
fi
fi
+if test "x$enable_ipv6only" = "xyes"
+then
+ enable_ipv6=yes
+ AC_DEFINE([XRDP_ENABLE_IPV6ONLY],1,[Enable IPv6 only])
+fi
+
if test "x$enable_ipv6" = "xyes"
then
AC_DEFINE([XRDP_ENABLE_IPV6],1,[Enable IPv6])
fi
-AC_CHECK_MEMBER([struct in6_addr.s6_addr],
- [],
- [AC_DEFINE(NO_ARPA_INET_H_IP6, 1, [for IPv6])],
- [#include <arpa/inet.h>])
-
if test "x$enable_pam" != "xyes" || test "x$bsd" = "xtrue"
then
AC_DEFINE([USE_NOPAM],1,[Disable PAM])