apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r1816527 - in /apr/apr/trunk: CHANGES configure.in include/apr_network_io.h include/arch/win32/apr_private.h network_io/unix/sockaddr.c test/testsock.c
Date Fri, 08 Dec 2017 06:49:29 GMT


On 11/28/2017 09:53 AM, jorton@apache.org wrote:
> Author: jorton
> Date: Tue Nov 28 08:53:13 2017
> New Revision: 1816527
> 
> URL: http://svn.apache.org/viewvc?rev=1816527&view=rev
> Log:
> Support IPv6 link-local address scope/zone mapping.
> 
> * network_io/unix/sockaddr.c (apr_sockaddr_zone_set,
>   apr_sockaddr_zone_get): New functions.
>   (apr_sockaddr_ip_getbuf): Append %scope for link-local address.
>   (apr_sockaddr_equal): Compare link-local address with different
>   scopes as not equal.
> 
> * include/apr_network_io.h: Add function declarations.
> 
> * configure.in: Test for if_indextoname and if_nametoindex.
> 
> * test/testsock.c (test_zone): New test case.
> 
> * include/arch/win32/apr_private.h: Assume Windows supports
>   if_nametoindex and if_indextoname.
> 
> Modified:
>     apr/apr/trunk/CHANGES
>     apr/apr/trunk/configure.in
>     apr/apr/trunk/include/apr_network_io.h
>     apr/apr/trunk/include/arch/win32/apr_private.h
>     apr/apr/trunk/network_io/unix/sockaddr.c
>     apr/apr/trunk/test/testsock.c
> 

> Modified: apr/apr/trunk/test/testsock.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testsock.c?rev=1816527&r1=1816526&r2=1816527&view=diff
> ==============================================================================
> --- apr/apr/trunk/test/testsock.c (original)
> +++ apr/apr/trunk/test/testsock.c Tue Nov 28 08:53:13 2017
> @@ -640,6 +640,98 @@ static void test_freebind(abts_case *tc,
>  #endif
>  }
>  
> +#define TEST_ZONE_ADDR "fe80::1"
> +
> +#ifdef __linux__
> +/* Reasonable bet that "lo" will exist. */
> +#define TEST_ZONE_NAME "lo"
> +/* ... fill in other platforms here */
> +#endif
> +
> +#ifdef TEST_ZONE_NAME 
> +#define TEST_ZONE_FULLADDR TEST_ZONE_ADDR "%" TEST_ZONE_NAME
> +#endif
> +
> +static void test_zone(abts_case *tc, void *data)
> +{
> +#if APR_HAVE_IPV6
> +    apr_sockaddr_t *sa;
> +    apr_status_t rv;
> +    const char *name = NULL;
> +    apr_uint32_t id = 0;
> +    
> +    /* RFC 5737 address */
> +    rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_INET, 8080, 0, p);
> +    APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
> +
> +    /* Fail for an IPv4 address! */
> +    ABTS_INT_EQUAL(tc, APR_EBADIP,
> +                   apr_sockaddr_zone_set(sa, "1"));
> +    ABTS_INT_EQUAL(tc, APR_EBADIP,
> +                   apr_sockaddr_zone_get(sa, &name, &id, p));
> +
> +    rv = apr_sockaddr_info_get(&sa, TEST_ZONE_ADDR, APR_INET6, 8080, 0, p);
> +    APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
> +
> +    rv = apr_sockaddr_info_get(&sa, TEST_ZONE_ADDR, APR_INET6, 8080, 0, p);
> +    APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);

Why do we do the above test twice?

> +
> +    ABTS_INT_EQUAL(tc, APR_EBADIP, apr_sockaddr_zone_get(sa, &name, &id, p));
> +

Regards

RĂ¼diger


Mime
View raw message