Author: mturk
Date: Wed Apr 4 14:41:10 2012
New Revision: 1309412
URL: http://svn.apache.org/viewvc?rev=1309412&view=rev
Log:
Backport fix for apr_mcast_hops returning EINVAL from trunk
Modified:
apr/apr/branches/1.5.x/network_io/unix/multicast.c
apr/apr/branches/1.5.x/test/testsockets.c
Modified: apr/apr/branches/1.5.x/network_io/unix/multicast.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/unix/multicast.c?rev=1309412&r1=1309411&r2=1309412&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/network_io/unix/multicast.c (original)
+++ apr/apr/branches/1.5.x/network_io/unix/multicast.c Wed Apr 4 14:41:10 2012
@@ -194,7 +194,7 @@ static apr_status_t do_mcast(int type, a
}
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 typ
}
}
#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;
}
}
Modified: apr/apr/branches/1.5.x/test/testsockets.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/test/testsockets.c?rev=1309412&r1=1309411&r2=1309412&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/test/testsockets.c (original)
+++ apr/apr/branches/1.5.x/test/testsockets.c Wed Apr 4 14:41:10 2012
@@ -131,6 +131,10 @@ static void sendto_receivefrom_helper(ab
APR_ASSERT_SUCCESS(tc, "Could not bind socket", rv);
if (rv != APR_SUCCESS)
return;
+ rv = apr_mcast_hops(sock, 10);
+ APR_ASSERT_SUCCESS(tc, "Could not set multicast hops", rv);
+ if (rv != APR_SUCCESS)
+ return;
rv = apr_socket_bind(sock2, from);
APR_ASSERT_SUCCESS(tc, "Could not bind second socket", rv);
|