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 2002/01/04 18:36:51 UTC

cvs commit: apr/network_io/unix sockets.c

trawick     02/01/04 09:36:51

  Modified:    network_io/unix sockets.c
  Log:
  fix an IPv6 hole in apr_accept(); the bug prevented the proper
  sockaddr from being returned in some cases
  
  Revision  Changes    Path
  1.91      +4 -2      apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockets.c,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- sockets.c	26 Nov 2001 16:34:36 -0000	1.90
  +++ sockets.c	4 Jan 2002 17:36:51 -0000	1.91
  @@ -203,6 +203,7 @@
   
   apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context)
   {
  +    static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */
       alloc_socket(new, connection_context);
       set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM);
   
  @@ -249,8 +250,9 @@
   #endif /* TCP_NODELAY_INHERITED */
   
       if (sock->local_interface_unknown ||
  -        /* XXX IPv6 issue */
  -        sock->local_addr->sa.sin.sin_addr.s_addr == 0) {
  +        !memcmp(sock->local_addr->ipaddr_ptr,
  +                generic_inaddr_any,
  +                sock->local_addr->ipaddr_len)) {
           /* If the interface address inside the listening socket's local_addr wasn't 
            * up-to-date, we don't know local interface of the connected socket either.
            *