summaryrefslogtreecommitdiff
path: root/network_io
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2013-05-30 09:28:22 +0000
committerJoe Orton <jorton@apache.org>2013-05-30 09:28:22 +0000
commit2d85ef04bcac89429ad4d0f81b929f2fc439d528 (patch)
treed0a87a5b2445e7c57102dee67330367f342b0e65 /network_io
parente9d8c1bb55b7195a8b32a128e9059d7a87f02d25 (diff)
downloadapr-2d85ef04bcac89429ad4d0f81b929f2fc439d528.tar.gz
* 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/trunk@1487796 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-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 d6e2ca7b7..e4e8c80f1 100644
--- a/network_io/unix/multicast.c
+++ b/network_io/unix/multicast.c
@@ -196,12 +196,17 @@ 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;
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;
@@ -209,6 +214,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;
}
@@ -220,7 +228,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;
}
}