apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1309394 - in /apr/apr/branches/1.3.x: CHANGES network_io/unix/multicast.c test/testsockets.c
Date Wed, 04 Apr 2012 14:06:23 GMT
Author: mturk
Date: Wed Apr  4 14:06:23 2012
New Revision: 1309394

URL: http://svn.apache.org/viewvc?rev=1309394&view=rev
Log:
Backport fix for apr_mcast_hops returning EINVAL from trunk

Modified:
    apr/apr/branches/1.3.x/CHANGES
    apr/apr/branches/1.3.x/network_io/unix/multicast.c
    apr/apr/branches/1.3.x/test/testsockets.c

Modified: apr/apr/branches/1.3.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/CHANGES?rev=1309394&r1=1309393&r2=1309394&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.3.x/CHANGES [utf-8] Wed Apr  4 14:06:23 2012
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.3.13
 
+  *) apr_mcast_hops: Fix EINVAL for IPv6 sockets caused by using byte
+     instead integer for setsockopt. [Mladen Turk]
+
   *) Fix flag character '#' in combination with format character 'x' in
      apr snprintf implementations.  [Rainer Jung]
 

Modified: apr/apr/branches/1.3.x/network_io/unix/multicast.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/network_io/unix/multicast.c?rev=1309394&r1=1309393&r2=1309394&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/network_io/unix/multicast.c (original)
+++ apr/apr/branches/1.3.x/network_io/unix/multicast.c Wed Apr  4 14:06:23 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.3.x/test/testsockets.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/test/testsockets.c?rev=1309394&r1=1309393&r2=1309394&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/test/testsockets.c (original)
+++ apr/apr/branches/1.3.x/test/testsockets.c Wed Apr  4 14:06:23 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);



Mime
View raw message