summaryrefslogtreecommitdiffstats
path: root/contrib/apr/network_io/unix/multicast.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2013-07-28 06:02:40 +0000
committerpeter <peter@FreeBSD.org>2013-07-28 06:02:40 +0000
commit0aadc82afbae4dbc41da86cd4f9b2ceb8ddcb17d (patch)
tree6a96e078c28ea05d418b4e2722bc03b0b930a78b /contrib/apr/network_io/unix/multicast.c
parent7594fa5c70305cda65deedc5cc7e08dc037727cd (diff)
parentb910f82d487cf989800adbd1a65b3a7f71b46277 (diff)
downloadFreeBSD-src-0aadc82afbae4dbc41da86cd4f9b2ceb8ddcb17d.zip
FreeBSD-src-0aadc82afbae4dbc41da86cd4f9b2ceb8ddcb17d.tar.gz
Update subversion-1.8.0 -> 1.8.1. Update supporting
components: apr-1.4.6 -> 1.4.8 and apr-util-1.4.1 -> 1.5.2. This is a post point-zero bug-fix / fix-sharp-edges release, including some workarounds for UTF-8 for people who haven't yet turned on WITH_ICONV.
Diffstat (limited to 'contrib/apr/network_io/unix/multicast.c')
-rw-r--r--contrib/apr/network_io/unix/multicast.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/contrib/apr/network_io/unix/multicast.c b/contrib/apr/network_io/unix/multicast.c
index 67ab245..3767bfd 100644
--- a/contrib/apr/network_io/unix/multicast.c
+++ b/contrib/apr/network_io/unix/multicast.c
@@ -193,36 +193,39 @@ 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_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;
}
}
#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)) {
+ /* For the IPV6_* options, an (int *) pointer must be used. */
+ int ivalue = value;
+
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 *) &ivalue, sizeof(ivalue)) == -1) {
rv = errno;
}
}
OpenPOWER on IntegriCloud