httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: cvs commit: httpd-2.0/server listen.c
Date Mon, 25 Aug 2003 08:27:03 GMT
On Sun, Aug 24, 2003 at 10:43:36PM -0000, jerenkrantz@apache.org wrote:
...
>   +#if APR_HAVE_IPV6
>   +            int v6only_setting;
>   +            /* If we are trying to bind to 0.0.0.0 and the previous listener
>   +             * was :: on the same port and in turn that socket does not have
>   +             * the IPV6_V6ONLY flag set; we must skip the current attempt to
>   +             * listen (which would generate an error). IPv4 will be handled
>   +             * on the established IPv6 socket.
>   +             */
>   +            if (previous != NULL &&
>   +                lr->bind_addr->family == APR_INET &&
>   +                *((in_addr_t *)lr->bind_addr->ipaddr_ptr) == INADDR_ANY &&
>   +                lr->bind_addr->port == previous->bind_addr->port &&
>   +                previous->bind_addr->family == APR_INET6 &&
>   +                IN6_IS_ADDR_UNSPECIFIED(
>   +                        (struct in6_addr*)(previous->bind_addr->ipaddr_ptr))
&&

This doesn't compile on some older Unixes since in_addr_t is a recent
invention; the casts aren't really necessary anyway.

Also the below conditional looks dubious - previous->bind_addr should be
lr->bind_addr, and the lr->next family is never checked?  Attached a
patch which looks logically right and fixes the compile error, not
tested though - can you test it?

>                else {
>   +#if APR_HAVE_IPV6
>   +                /* If we tried to bind to ::, and the next listener is
>   +                 * on 0.0.0.0 with the same port, don't give a fatal
>   +                 * error. The user will still get a warning from make_sock
>   +                 * though.
>   +                 */
>   +                if (lr->next != NULL && lr->bind_addr->family ==
APR_INET6 &&
>   +                    IN6_IS_ADDR_UNSPECIFIED(
>   +                        (struct in6_addr*)(previous->bind_addr->ipaddr_ptr))
&&
>   +                    lr->bind_addr->port == lr->next->bind_addr->port
&&
>   +                    *((in_addr_t *)lr->next->bind_addr->ipaddr_ptr)
>   +                    == INADDR_ANY) {


Mime
View raw message