You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2013/05/30 11:29:24 UTC

svn commit: r1487798 - in /apr/apr/branches/1.4.x: ./ network_io/unix/multicast.c

Author: jorton
Date: Thu May 30 09:29:24 2013
New Revision: 1487798

URL: http://svn.apache.org/r1487798
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.4.x/   (props changed)
    apr/apr/branches/1.4.x/network_io/unix/multicast.c

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

Modified: apr/apr/branches/1.4.x/network_io/unix/multicast.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/network_io/unix/multicast.c?rev=1487798&r1=1487797&r2=1487798&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/network_io/unix/multicast.c (original)
+++ apr/apr/branches/1.4.x/network_io/unix/multicast.c Thu May 30 09:29:24 2013
@@ -193,12 +193,17 @@ 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;
 
     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;
@@ -206,6 +211,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;
         }
@@ -217,7 +225,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;
         }
     }