apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1084670 - in /apr/apr/branches/1.4.x: CHANGES network_io/unix/sockets.c
Date Wed, 23 Mar 2011 18:52:44 GMT
Author: trawick
Date: Wed Mar 23 18:52:44 2011
New Revision: 1084670

URL: http://svn.apache.org/viewvc?rev=1084670&view=rev
Log:
from jorton's trunk r1059351:

* network_io/unix/sockets.c (apr_socket_accept): Ensure the correct
 address family is used for the new socket when adjusting
 local_addr/remote_addr, fixing handling of an AF_INET socket
 accepted from a bound AF_INET6 socket.

PR: 49678

Modified:
    apr/apr/branches/1.4.x/CHANGES
    apr/apr/branches/1.4.x/network_io/unix/sockets.c

Modified: apr/apr/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?rev=1084670&r1=1084669&r2=1084670&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.4.x/CHANGES [utf-8] Wed Mar 23 18:52:44 2011
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.4.3
 
+  *) Fix address handling when accepting an AF_INET socket from a socket
+     bound as AF_INET6.   PR 49678.  [Joe Orton]
+
   *) Fix error return values from apr_sockaddr_info_get() on Windows for
      IPv6 builds.  [Ivan Zhakov <ivan visualsvn.com>]
 

Modified: apr/apr/branches/1.4.x/network_io/unix/sockets.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/network_io/unix/sockets.c?rev=1084670&r1=1084669&r2=1084670&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/network_io/unix/sockets.c (original)
+++ apr/apr/branches/1.4.x/network_io/unix/sockets.c Wed Mar 23 18:52:44 2011
@@ -222,7 +222,13 @@ apr_status_t apr_socket_accept(apr_socke
     }
 #endif
     alloc_socket(new, connection_context);
-    set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol);
+
+    /* Set up socket variables -- note that it may be possible for
+     * *new to be an AF_INET socket when sock is AF_INET6 in some
+     * dual-stack configurations, so ensure that the remote_/local_addr
+     * structures are adjusted for the family of the accepted
+     * socket: */
+    set_socket_vars(*new, sa.sa.sin.sin_family, SOCK_STREAM, sock->protocol);
 
 #ifndef HAVE_POLL
     (*new)->connected = 1;



Mime
View raw message