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 2011/01/15 16:12:56 UTC
svn commit: r1059351 - in /apr/apr/trunk: CHANGES network_io/unix/sockets.c
Author: jorton
Date: Sat Jan 15 15:12:56 2011
New Revision: 1059351
URL: http://svn.apache.org/viewvc?rev=1059351&view=rev
Log:
* 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/trunk/CHANGES
apr/apr/trunk/network_io/unix/sockets.c
Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1059351&r1=1059350&r2=1059351&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Sat Jan 15 15:12:56 2011
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes for APR 2.0.0
+ *) Fix address handling when accepting an AF_INET socket from a socket
+ bound as AF_INET6. PR 49678. [Joe Orton]
+
*) Hide apr_wait_for_io_or_timeout() from public view and add instead
apr_socket_wait() and apr_file_pipe_wait(). [Brian Havard]
Modified: apr/apr/trunk/network_io/unix/sockets.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/sockets.c?rev=1059351&r1=1059350&r2=1059351&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sockets.c (original)
+++ apr/apr/trunk/network_io/unix/sockets.c Sat Jan 15 15:12:56 2011
@@ -259,7 +259,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 the 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;