You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2011/03/23 19:50:21 UTC
svn commit: r1084669 - /apr/apr/branches/1.5.x/network_io/unix/sockets.c
Author: trawick
Date: Wed Mar 23 18:50:21 2011
New Revision: 1084669
URL: http://svn.apache.org/viewvc?rev=1084669&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.5.x/network_io/unix/sockets.c
Modified: apr/apr/branches/1.5.x/network_io/unix/sockets.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/unix/sockets.c?rev=1084669&r1=1084668&r2=1084669&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/network_io/unix/sockets.c (original)
+++ apr/apr/branches/1.5.x/network_io/unix/sockets.c Wed Mar 23 18:50:21 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;