summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormturk <mturk@13f79535-47bb-0310-9956-ffa450edef68>2012-04-04 13:51:52 +0000
committermturk <mturk@13f79535-47bb-0310-9956-ffa450edef68>2012-04-04 13:51:52 +0000
commit696047093a985293e6c92162e993b7804551e74a (patch)
treec1af48a9943057be900875d7641b35e90141e956
parent1232a2fa695b6e464a6ac432a9e8c0170b8ffefd (diff)
downloadlibapr-696047093a985293e6c92162e993b7804551e74a.tar.gz
Backport fix for apr_mcast_hops returning EINVAL from trunk
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@1309386 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES3
-rw-r--r--network_io/unix/multicast.c15
2 files changed, 8 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index d9a310f2a..bb1910774 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes for APR 1.4.7
+ *) apr_mcast_hops: Fix EINVAL for IPv6 sockets caused by using byte
+ instead integer for setsockopt. [Mladen Turk]
+
*) Windows: Fix compile-time checks for 64-bit builds, resolving a
crash in httpd's mod_rewrite. PR 49155. [<anindyabaruah gmail.com>]
diff --git a/network_io/unix/multicast.c b/network_io/unix/multicast.c
index 67ab24574..e5f4cc06d 100644
--- a/network_io/unix/multicast.c
+++ b/network_io/unix/multicast.c
@@ -194,7 +194,7 @@ static apr_status_t do_mcast(int type, apr_socket_t *sock,
}
static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
- apr_byte_t value)
+ apr_uint32_t value)
{
apr_status_t rv = APR_SUCCESS;
@@ -205,24 +205,19 @@ static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
}
}
#if APR_HAVE_IPV6
- else if (sock_is_ipv6(sock) && type == IP_MULTICAST_LOOP) {
- unsigned int loopopt = value;
- type = IPV6_MULTICAST_LOOP;
- if (setsockopt(sock->socketdes, IPPROTO_IPV6, type,
- (const void *) &loopopt, sizeof(loopopt)) == -1) {
- rv = errno;
- }
- }
else if (sock_is_ipv6(sock)) {
if (type == IP_MULTICAST_TTL) {
type = IPV6_MULTICAST_HOPS;
}
+ else if (type == IP_MULTICAST_LOOP) {
+ type = IPV6_MULTICAST_LOOP;
+ }
else {
return APR_ENOTIMPL;
}
if (setsockopt(sock->socketdes, IPPROTO_IPV6, type,
- &value, sizeof(value)) == -1) {
+ (const void *) &value, sizeof(value)) == -1) {
rv = errno;
}
}