summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjerenkrantz <jerenkrantz@13f79535-47bb-0310-9956-ffa450edef68>2004-04-03 17:22:06 +0000
committerjerenkrantz <jerenkrantz@13f79535-47bb-0310-9956-ffa450edef68>2004-04-03 17:22:06 +0000
commit649665eb4bdeb6a77826fe2d722c3e25d982d13d (patch)
tree49a18fcb73069a612f0d4cc7b1bfd25f0d6ee0a9
parent7f9fe4ce69ddf6c946d060303d0dfb837e67bf73 (diff)
downloadlibapr-649665eb4bdeb6a77826fe2d722c3e25d982d13d.tar.gz
APR 1.0 Backport: network/unix/sockopt.c r1.79, network/win32/sockopt.c r1.59
Even if we do not check the value of APR_IPV6_V6ONLY before setting, we still must set the option cache if we're setting APR_IPV6_V6ONLY. Otherwise, later apr_socket_opt_get calls will fail. This fixes Listen directives on IPv6 machines where IPV6_V6ONLY may be enabled (i.e. FreeBSD 5.x, OpenBSD, NetBSD) where it would not properly bind to the IPv4 socket. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/APR_0_9_BRANCH@65035 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES4
-rw-r--r--network_io/unix/sockopt.c3
-rw-r--r--network_io/win32/sockopt.c3
3 files changed, 8 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 06f6344d4..0ce48d80c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
Changes with APR 0.9.5
+ *) Fix apr_socket_opt_set with APR_IPV6_V6ONLY flag. Fixes httpd
+ Listen IPv6 socket behavior on FreeBSD 5.x, OpenBSD, NetBSD.
+ [Justin Erenkrantz]
+
*) Fix apr_time_exp_get() for dates in 2038.
[Philip Martin <philip codematters.co.uk>]
diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c
index c80c25058..241402e10 100644
--- a/network_io/unix/sockopt.c
+++ b/network_io/unix/sockopt.c
@@ -288,13 +288,14 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock,
case APR_IPV6_V6ONLY:
#if APR_HAVE_IPV6 && defined(IPV6_V6ONLY)
/* we don't know the initial setting of this option,
- * so don't check/set sock->netmask since that optimization
+ * so don't check sock->netmask since that optimization
* won't work
*/
if (setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&on, sizeof(int)) == -1) {
return errno;
}
+ apr_set_option(sock, APR_IPV6_V6ONLY, on);
#else
return APR_ENOTIMPL;
#endif
diff --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c
index a1aa15d13..66e2e2e1b 100644
--- a/network_io/win32/sockopt.c
+++ b/network_io/win32/sockopt.c
@@ -174,13 +174,14 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock,
case APR_IPV6_V6ONLY:
#if APR_HAVE_IPV6 && defined(IPV6_V6ONLY)
/* we don't know the initial setting of this option,
- * so don't check/set sock->netmask since that optimization
+ * so don't check sock->netmask since that optimization
* won't work
*/
if (setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&on, sizeof(int)) == -1) {
return apr_get_netos_error();
}
+ apr_set_option(&sock->netmask, APR_IPV6_V6ONLY, on);
#else
return APR_ENOTIMPL;
#endif