apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r290399 - /apr/apr/trunk/test/testsock.c
Date Tue, 20 Sep 2005 08:35:59 GMT
Author: jorton
Date: Tue Sep 20 01:35:57 2005
New Revision: 290399

URL: http://svn.apache.org/viewcvs?rev=290399&view=rev
Log:
* test/testsock.c (test_print_addr): Add regression test for v4-mapped
address handling bug in apr_sockaddr_ip_getbuf (thanks Martin for
fixing it!).

Modified:
    apr/apr/trunk/test/testsock.c

Modified: apr/apr/trunk/test/testsock.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/test/testsock.c?rev=290399&r1=290398&r2=290399&view=diff
==============================================================================
--- apr/apr/trunk/test/testsock.c (original)
+++ apr/apr/trunk/test/testsock.c Tue Sep 20 01:35:57 2005
@@ -215,6 +215,20 @@
     s = apr_psprintf(p, "foo %pI bar", sa);
 
     ABTS_STR_EQUAL(tc, "foo 0.0.0.0:80 bar", s);
+
+#if APR_HAVE_IPV6
+    if (apr_sockaddr_info_get(&sa, "::ffff:0.0.0.0", APR_INET6, 80, 0, p) == APR_SUCCESS)
{
+        /* sa should now be a v4-mapped IPv6 address. */
+        char buf[128];
+
+        memset(buf, 'z', sizeof buf);
+        
+        APR_ASSERT_SUCCESS(tc, "could not get IP address",
+                           apr_sockaddr_ip_getbuf(buf, 22, sa));
+        
+        ABTS_STR_EQUAL(tc, "0.0.0.0", buf);
+    }
+#endif
 }
 
 static void test_get_addr(abts_case *tc, void *data)



Mime
View raw message