apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r1487801 - in /apr/apr/branches/1.2.x: ./ network_io/unix/multicast.c
Date Thu, 30 May 2013 09:31:31 GMT
Author: jorton
Date: Thu May 30 09:31:30 2013
New Revision: 1487801

URL: http://svn.apache.org/r1487801
Log:
Merge 1487796 from trunk:

* network_io/unix/multicast.c (do_mcast_opt): Fix regression in
  handling IPv4 options introduced in r1309386.


Modified:
    apr/apr/branches/1.2.x/   (props changed)
    apr/apr/branches/1.2.x/network_io/unix/multicast.c

Propchange: apr/apr/branches/1.2.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1487796

Modified: apr/apr/branches/1.2.x/network_io/unix/multicast.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/network_io/unix/multicast.c?rev=1487801&r1=1487800&r2=1487801&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/network_io/unix/multicast.c (original)
+++ apr/apr/branches/1.2.x/network_io/unix/multicast.c Thu May 30 09:31:30 2013
@@ -218,8 +218,11 @@ static apr_status_t do_mcast(int type, a
     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 typ
     }
 
     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 typ
     }
 #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 typ
         }
 
         if (setsockopt(sock->socketdes, IPPROTO_IPV6, type,
-                       (const void *) &value, sizeof(value)) == -1) {
+                       (const void *) &ivalue, sizeof(ivalue)) == -1) {
             rv = errno;
         }
     }



Mime
View raw message