apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r584634 - /apr/apr/trunk/test/testsockets.c
Date Sun, 14 Oct 2007 23:07:43 GMT
Author: wrowe
Date: Sun Oct 14 16:07:43 2007
New Revision: 584634

URL: http://svn.apache.org/viewvc?rev=584634&view=rev
Log:
recvfrom() failed on most platforms with a sockaddr only
large enough to hold an ipv6 address.  Big shock.

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

Modified: apr/apr/trunk/test/testsockets.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testsockets.c?rev=584634&r1=584633&r2=584634&view=diff
==============================================================================
--- apr/apr/trunk/test/testsockets.c (original)
+++ apr/apr/trunk/test/testsockets.c Sun Oct 14 16:07:43 2007
@@ -103,7 +103,8 @@
 #endif
 }
 
-static void sendto_receivefrom_helper(abts_case *tc, const char *addr, int family)
+static void sendto_receivefrom_helper(abts_case *tc, const char *addr, 
+                                      const char *junkaddr, int family)
 {
     apr_status_t rv;
     apr_socket_t *sock = NULL;
@@ -152,7 +153,8 @@
 
     /* fill the "from" sockaddr with a random address to ensure that
      * recvfrom sets it up properly. */
-    apr_sockaddr_info_get(&from, "127.1.2.3", APR_INET, 4242, 0, p);
+    rv = apr_sockaddr_info_get(&from, junkaddr, family, 4242, 0, p);
+    ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
 
     len = 80;
     rv = apr_socket_recvfrom(from, sock, 0, recvbuf, &len);
@@ -171,10 +173,10 @@
 
 static void sendto_receivefrom(abts_case *tc, void *data)
 {
+    sendto_receivefrom_helper(tc, "127.0.0.1",  "127.1.2.3", APR_INET);
 #if APR_HAVE_IPV6
-    sendto_receivefrom_helper(tc, "::1", APR_INET6);
+    sendto_receivefrom_helper(tc, "::1", "FA0E::1234:127.1.2.3", APR_INET6);
 #endif
-    sendto_receivefrom_helper(tc, "127.0.0.1", APR_INET);
 }
 
 static void socket_userdata(abts_case *tc, void *data)



Mime
View raw message