You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@attglobal.net> on 2001/12/26 17:06:44 UTC

Re: cvs commit: httpd-2.0/server vhost.c

trawick@apache.org writes:

> trawick     01/12/26 07:51:08
> 
>   Modified:    .        CHANGES
>                server   vhost.c
>   Log:
>   Fix matching of vhosts by ip address so we find IPv4
>   vhost address when target address is v4-mapped form of
>   that address.

>   +#if APR_HAVE_IPV6
>   +            else if (cur->sa.sin.sin_family == AF_INET &&
>   +                     sa->sa.sin.sin_family == AF_INET6 &&
>   +                     IN6_IS_ADDR_V4MAPPED((struct in6_addr *)sa->ipaddr_ptr) &&
>   +                     !memcmp(&((struct in6_addr *)sa->ipaddr_ptr)->s6_addr[12],
>   +                             cur->ipaddr_ptr,
>   +                             4)) {
>   +                return trav;
>   +            }
>   +#endif
>            }    
>        }
>        return NULL;

apr_ipsub_test() should work fine here, though I suspect that a
cleaner solution to both Apache uses of IN6_IS_ADDR_V4MAPPED() would
be to have a way to get a v4 addr from an APR sockaddr (returning NULL
if it is a non-mapped IPv6 address), or better yet, have a way to
compare the IP addresses associated with two APR sockaddrs.  The APR
routine would handle any checks for IN6_IS_ADDR_V4MAPPED() under the
covers.

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...