summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2013-05-30 09:31:30 +0000
committerJoe Orton <jorton@apache.org>2013-05-30 09:31:30 +0000
commit2e35e5bdbb97d43590d5eca861414b61feb3e4e3 (patch)
treea8552dc37cf1a18d63562288cdbcb7c003c70d05
parentdbea7b1248c836c7d6cd44fff98f3551bd0153d7 (diff)
downloadapr-2e35e5bdbb97d43590d5eca861414b61feb3e4e3.tar.gz
Merge 1487796 from trunk:
* network_io/unix/multicast.c (do_mcast_opt): Fix regression in handling IPv4 options introduced in r1309386. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.2.x@1487801 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--network_io/unix/multicast.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/network_io/unix/multicast.c b/network_io/unix/multicast.c
index 4bbecba1a..d6afae6bc 100644
--- a/network_io/unix/multicast.c
+++ b/network_io/unix/multicast.c
@@ -218,8 +218,11 @@ static apr_status_t do_mcast(int type, apr_socket_t *sock,
return rv;
}
+/* Set the IP_MULTICAST_TTL or IP_MULTICAST_LOOP option, or IPv6
+ * equivalents, for the socket, to the given value. Note that this
+ * function *only works* for those particular option types. */
static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
- apr_uint32_t value)
+ apr_byte_t value)
{
apr_status_t rv = APR_SUCCESS;
@@ -230,6 +233,8 @@ static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
}
if (sock_is_ipv4(sock)) {
+ /* For the IP_MULTICAST_* options, this must be a (char *)
+ * pointer. */
if (setsockopt(sock->socketdes, IPPROTO_IP, type,
(const void *) &value, sizeof(value)) == -1) {
rv = errno;
@@ -237,6 +242,9 @@ static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
}
#if APR_HAVE_IPV6
else if (sock_is_ipv6(sock)) {
+ /* For the IPV6_* options, an (int *) pointer must be used. */
+ int ivalue = value;
+
if (type == IP_MULTICAST_TTL) {
type = IPV6_MULTICAST_HOPS;
}
@@ -248,7 +256,7 @@ static apr_status_t do_mcast_opt(int type, apr_socket_t *sock,
}
if (setsockopt(sock->socketdes, IPPROTO_IPV6, type,
- (const void *) &value, sizeof(value)) == -1) {
+ (const void *) &ivalue, sizeof(ivalue)) == -1) {
rv = errno;
}
}