httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: [PATCH] IPV6 enabled check on Solaris
Date Sat, 12 Apr 2003 11:12:44 GMT
Jim Carlson wrote:
> 
> p.s.  An "ack" by anyone on this would be appreciated.  I've submitted 
> several patches in recent weeks, none of which are of great moment, but 
> at least one of which (the last one) I believe is a no-brainer for 
> correctness.  I'm a little new to OSS contribution, but eager to help -- 
> confirmation that I'm on the right track would be useful to me.  Thanks!

understood :)  unfortunately some nagging is needed sometimes...

> --- listen.c.orig       2002-12-02 15:53:37.000000000 -0800
> +++ listen.c    2003-04-12 02:55:20.949997000 -0700
> @@ -240,20 +240,31 @@
>  #if APR_HAVE_IPV6
>      /* We know the platform supports IPv6, but this particular
>       * system may not have IPv6 enabled.  See if we can get an
> -     * AF_INET6 socket and bind to an ephemeral port.  (On most
> -     * systems, getting an AF_INET6 socket is a sufficient test.
> -     * On certain levels of OpenUNIX, getting the socket is
> -     * successful but bind always returns ENETUNREACH.)
> +     * AF_INET6 socket, bind and listen to an ephemeral port,
> +     * and then connect to that port.  (On most systems, getting
> +     * an AF_INET6 socket is a sufficient test.  On certain levels
> +     * of OpenUNIX, getting the socket is successful but bind always
> +     * returns ENETUNREACH.  On Solaris 8, a bind/listen will be
> +     * successful, but a connect will fail.)
>       */

this sounds like a fair test to me

> +
>      if (default_family == APR_UNSPEC) {
> -        apr_status_t sock_rv;
> -        apr_socket_t *tmp_sock;
> +        apr_status_t sock_rv, sock2_rv;
> +        apr_socket_t *tmp_sock, *tmp_sock2;
>          apr_sockaddr_t *sa;
> 
>          if ((sock_rv = apr_socket_create(&tmp_sock, APR_INET6, 
> SOCK_STREAM, p))
> -            == APR_SUCCESS &&
> +                == APR_SUCCESS &&
>              apr_sockaddr_info_get(&sa, NULL, APR_INET6, 0, 0, p) == 
> APR_SUCCESS &&
> -            apr_bind(tmp_sock, sa) == APR_SUCCESS) {
> +            apr_bind(tmp_sock, sa) == APR_SUCCESS &&
> +            apr_socket_listen(tmp_sock, 1) == APR_SUCCESS &&
> +            apr_socket_addr_get(&sa, APR_LOCAL, tmp_sock) == 
> APR_SUCCESS &&
> +            apr_sockaddr_info_get(&sa, "localhost", APR_INET6, 
> sa->port, 0, p)

instead of building a sockaddr for "localhost", you need to build a 
sockaddr just like the pod code will use later, or perhaps use "::"

it is not our concern whether or not the system has an IPv6 mapping for 
"localhost"

I think this is the code that creates the sockaddr we'll use later for 
connecting, but it may be sufficient to use "::".

AP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod)
{
...
     apr_sockaddr_info_get(&(*pod)->sa,
                           ap_listeners->bind_addr->hostname,
                           APR_UNSPEC, ap_listeners->bind_addr->port, 0,
                           p);
...
}

(While this particular pod issue is is specific to some MPMs, it is 
certainly fair to ensure that we can actually connect since that will 
weed out other operational difficulties.)

Thanks,

Jeff


Mime
View raw message