You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2007/10/15 04:35:36 UTC

svn commit: r584657 - in /apr/apr/trunk: include/apr_errno.h test/testsockets.c

Author: wrowe
Date: Sun Oct 14 19:35:35 2007
New Revision: 584657

URL: http://svn.apache.org/viewvc?rev=584657&view=rev
Log:
Fix testsockets the right way, moving forwards share a
clue with the user.

Modified:
    apr/apr/trunk/include/apr_errno.h
    apr/apr/trunk/test/testsockets.c

Modified: apr/apr/trunk/include/apr_errno.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_errno.h?rev=584657&r1=584656&r2=584657&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_errno.h (original)
+++ apr/apr/trunk/include/apr_errno.h Sun Oct 14 19:35:35 2007
@@ -824,6 +824,13 @@
 #define APR_ENOTEMPTY     (APR_OS_START_CANONERR + 26)
 #endif
 
+/** @see APR_STATUS_IS_EAFNOSUPPORT */
+#ifdef EAFNOSUPPORT
+#define APR_EAFNOSUPPORT EAFNOSUPPORT
+#else
+#define APR_EAFNOSUPPORT  (APR_OS_START_CANONERR + 27)
+#endif
+
 /** @} */
 
 #if defined(OS2) && !defined(DOXYGEN)
@@ -966,6 +973,8 @@
 #define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY \
                 || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \
                 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+#define APR_STATUS_IS_EAFNOSUPPORT(s)   ((s) == APR_AFNOSUPPORT \
+                || (s) == APR_OS_START_SYSERR + SOCEAFNOSUPPORT)
 
 /*
     Sorry, too tired to wrap this up for OS2... feel free to
@@ -981,7 +990,6 @@
     { SOCESOCKTNOSUPPORT,       ESOCKTNOSUPPORT },
     { SOCEOPNOTSUPP,            EOPNOTSUPP      },
     { SOCEPFNOSUPPORT,          EPFNOSUPPORT    },
-    { SOCEAFNOSUPPORT,          EAFNOSUPPORT    },
     { SOCEADDRINUSE,            EADDRINUSE      },
     { SOCEADDRNOTAVAIL,         EADDRNOTAVAIL   },
     { SOCENETDOWN,              ENETDOWN        },
@@ -1109,6 +1117,8 @@
                 || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
 #define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY \
                 || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
+#define APR_STATUS_IS_EAFNOSUPPORT(s)   ((s) == APR_EAFNOSUPPORT \
+                || (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
 
 #elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */
 
@@ -1168,6 +1178,8 @@
 #define APR_STATUS_IS_EPIPE(s)          ((s) == APR_EPIPE)
 #define APR_STATUS_IS_EXDEV(s)          ((s) == APR_EXDEV)
 #define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY)
+#define APR_STATUS_IS_EAFNOSUPPORT(s)   ((s) == APR_EAFNOSUPPORT \
+                || (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
 
 #else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
 
@@ -1285,6 +1297,8 @@
 /** Directory Not Empty */
 #define APR_STATUS_IS_ENOTEMPTY(s)       ((s) == APR_ENOTEMPTY || \
                                           (s) == APR_EEXIST)
+/** Address Family not supported */
+#define APR_STATUS_IS_EAFNOSUPPORT(s)    ((s) == APR_EAFNOSUPPORT)
 /** @} */
 
 #endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */

Modified: apr/apr/trunk/test/testsockets.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testsockets.c?rev=584657&r1=584656&r2=584657&view=diff
==============================================================================
--- apr/apr/trunk/test/testsockets.c (original)
+++ apr/apr/trunk/test/testsockets.c Sun Oct 14 19:35:35 2007
@@ -56,21 +56,6 @@
     apr_socket_close(sock);
 }
 
-/* On recent Linux systems, whilst IPv6 is always supported by glibc,
- * socket(AF_INET6, ...) calls will fail with EAFNOSUPPORT if the
- * "ipv6" kernel module is not loaded.  */
-#if defined(WSAEAFNOSUPPORT)
-#define V6_NOT_ENABLED(e) ((e) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
-#elif defined(SOCEAFNOSUPPORT)
-#define V6_NOT_ENABLED(e) ((e) == APR_OS_START_SYSERR + SOCEAFNOSUPPORT)
-#elif defined(EAFNOSUPPORT)
-#define V6_NOT_ENABLED(e) ((e) == EAFNOSUPPORT)
-#elif !APR_HAVE_IPV6
-#define V6_NOT_ENABLED(e) (1)
-#else
-#error MUST have an EAFNOSUPPORT class of error code to enable IPv6!
-#endif
-
 static void tcp6_socket(abts_case *tc, void *data)
 {
 #if APR_HAVE_IPV6
@@ -78,7 +63,7 @@
     apr_socket_t *sock = NULL;
 
     rv = apr_socket_create(&sock, APR_INET6, SOCK_STREAM, 0, p);
-    if (V6_NOT_ENABLED(rv)) {
+    if (APR_STATUS_IS_EAFNOSUPPORT(rv)) {
         ABTS_NOT_IMPL(tc, "IPv6 not enabled");
         return;
     }
@@ -97,7 +82,7 @@
     apr_socket_t *sock = NULL;
 
     rv = apr_socket_create(&sock, APR_INET6, SOCK_DGRAM, 0, p);
-    if (V6_NOT_ENABLED(rv)) {
+    if (APR_STATUS_IS_EAFNOSUPPORT(rv)) {
         ABTS_NOT_IMPL(tc, "IPv6 not enabled");
         return;
     }
@@ -124,7 +109,7 @@
     apr_size_t len = 30;
 
     rv = apr_socket_create(&sock, family, SOCK_DGRAM, 0, p);
-    if ((family == APR_INET6) && V6_NOT_ENABLED(rv)) {
+    if ((family == APR_INET6) && APR_STATUS_IS_EAFNOSUPPORT(rv)) {
         ABTS_NOT_IMPL(tc, "IPv6 not enabled");
         return;
     }
@@ -183,7 +168,6 @@
 
 static void sendto_receivefrom(abts_case *tc, void *data)
 {
-    apr_status_t rv;
     sendto_receivefrom_helper(tc, "127.0.0.1",  "127.1.2.3", APR_INET);
 #if APR_HAVE_IPV6
     sendto_receivefrom_helper(tc, "::1", "FA0E::1234:127.1.2.3", APR_INET6);