diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-10-14 23:07:43 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-10-14 23:07:43 +0000 |
commit | e430df492fc690489ecde432807f7bd1ac2a7b53 (patch) | |
tree | e28d83a967ab654adbb528532eaf0e54e5565104 /test | |
parent | c04a5f62854af0f06c7a100cbbfa9575fe2104ce (diff) | |
download | libapr-e430df492fc690489ecde432807f7bd1ac2a7b53.tar.gz |
recvfrom() failed on most platforms with a sockaddr only
large enough to hold an ipv6 address. Big shock.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@584634 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r-- | test/testsockets.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/testsockets.c b/test/testsockets.c index f54a2de5f..86c924516 100644 --- a/test/testsockets.c +++ b/test/testsockets.c @@ -103,7 +103,8 @@ static void udp6_socket(abts_case *tc, void *data) #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 @@ static void sendto_receivefrom_helper(abts_case *tc, const char *addr, int famil /* 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_helper(abts_case *tc, const char *addr, int famil 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) |