You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2012/12/11 13:00:27 UTC
svn commit: r1420111 - in /apr/apr/branches/1.5.x: ./
network_io/unix/sockaddr.c test/testipsub.c
Author: jorton
Date: Tue Dec 11 12:00:26 2012
New Revision: 1420111
URL: http://svn.apache.org/viewvc?rev=1420111&view=rev
Log:
Merge 1405985 from trunk:
* network_io/unix/sockaddr.c (apr_ipsubnet_test): Fix false positive
when testing a v4 subnet against a v6 address.
* test/testipsub.c (test_interesting_subnets): Add test.
PR: 54047
Modified:
apr/apr/branches/1.5.x/ (props changed)
apr/apr/branches/1.5.x/network_io/unix/sockaddr.c
apr/apr/branches/1.5.x/test/testipsub.c
Propchange: apr/apr/branches/1.5.x/
------------------------------------------------------------------------------
Merged /apr/apr/trunk:r1405985
Modified: apr/apr/branches/1.5.x/network_io/unix/sockaddr.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/unix/sockaddr.c?rev=1420111&r1=1420110&r2=1420111&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/network_io/unix/sockaddr.c (original)
+++ apr/apr/branches/1.5.x/network_io/unix/sockaddr.c Tue Dec 11 12:00:26 2012
@@ -1028,7 +1028,7 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_i
/* XXX This line will segv on Win32 build with APR_HAVE_IPV6,
* but without the IPV6 drivers installed.
*/
- if (sa->sa.sin.sin_family == AF_INET) {
+ if (sa->family == AF_INET) {
if (ipsub->family == AF_INET &&
((sa->sa.sin.sin_addr.s_addr & ipsub->mask[0]) == ipsub->sub[0])) {
return 1;
@@ -1040,7 +1040,7 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_i
return 1;
}
}
- else {
+ else if (sa->family == AF_INET6 && ipsub->family == AF_INET6) {
apr_uint32_t *addr = (apr_uint32_t *)sa->ipaddr_ptr;
if ((addr[0] & ipsub->mask[0]) == ipsub->sub[0] &&
Modified: apr/apr/branches/1.5.x/test/testipsub.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/test/testipsub.c?rev=1420111&r1=1420110&r2=1420111&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/test/testipsub.c (original)
+++ apr/apr/branches/1.5.x/test/testipsub.c Tue Dec 11 12:00:26 2012
@@ -119,6 +119,7 @@ static void test_interesting_subnets(abt
,{"127", NULL, APR_INET, "127.0.0.1", "10.1.2.3"}
,{"127.0.0.1", "8", APR_INET, "127.0.0.1", "10.1.2.3"}
#if APR_HAVE_IPV6
+ ,{"38.0.0.0", "8", APR_INET6, "::ffff:38.1.1.1", "2600::1"} /* PR 54047 */
,{"fe80::", "8", APR_INET6, "fe80::1", "ff01::1"}
,{"ff01::", "8", APR_INET6, "ff01::1", "fe80::1"}
,{"3FFE:8160::", "28", APR_INET6, "3ffE:816e:abcd:1234::1", "3ffe:8170::1"}