You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2002/11/14 00:47:30 UTC
cvs commit: apr/network_io/win32 sockopt.c
trawick 2002/11/13 15:47:30
Modified: . CHANGES
include apr_network_io.h
network_io/unix sockopt.c
network_io/win32 sockopt.c
Log:
add APR_IPV6_V6ONLY socket option
Revision Changes Path
1.356 +3 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.355
retrieving revision 1.356
diff -u -r1.355 -r1.356
--- CHANGES 12 Nov 2002 04:24:51 -0000 1.355
+++ CHANGES 13 Nov 2002 23:47:29 -0000 1.356
@@ -1,4 +1,7 @@
Changes with APR 0.9.2
+
+ *) Add APR_IPV6_V6ONLY socket option. [Jeff Trawick]
+
*) Update timeout algorithm in free_proc_chain. If a subprocess
did not exit immediately, the thread would sleep for 3 seconds
before checking the subprocess exit status again. In a very
1.133 +3 -0 apr/include/apr_network_io.h
Index: apr_network_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_network_io.h,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- apr_network_io.h 10 Nov 2002 08:35:16 -0000 1.132
+++ apr_network_io.h 13 Nov 2002 23:47:29 -0000 1.133
@@ -130,6 +130,9 @@
#define APR_INCOMPLETE_WRITE 8192 /**< like APR_INCOMPLETE_READ, but for write
* @see APR_INCOMPLETE_READ
*/
+#define APR_IPV6_V6ONLY 16384 /**< Don't accept IPv4 connections on an
+ * IPv6 listening socket.
+ */
/** @} */
1.62 +14 -0 apr/network_io/unix/sockopt.c
Index: sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sockopt.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- sockopt.c 22 Oct 2002 20:05:35 -0000 1.61
+++ sockopt.c 13 Nov 2002 23:47:29 -0000 1.62
@@ -310,6 +310,20 @@
if (opt & APR_INCOMPLETE_READ) {
apr_set_option(&sock->netmask, APR_INCOMPLETE_READ, on);
}
+ if (opt & APR_IPV6_V6ONLY) {
+#if APR_HAVE_IPV6 && defined(IPV6_V6ONLY)
+ /* we don't know the initial setting of this option,
+ * so don't check/set sock->netmask since that optimization
+ * won't work
+ */
+ if (setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_V6ONLY,
+ (void *)&on, sizeof(int)) == -1) {
+ return errno;
+ }
+#else
+ return APR_ENOTIMPL;
+#endif
+ }
return APR_SUCCESS;
}
1.48 +14 -0 apr/network_io/win32/sockopt.c
Index: sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sockopt.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- sockopt.c 22 Oct 2002 20:05:35 -0000 1.47
+++ sockopt.c 13 Nov 2002 23:47:30 -0000 1.48
@@ -210,6 +210,20 @@
apr_set_option(&sock->netmask, APR_TCP_NODELAY, on);
}
break;
+ case APR_IPV6_V6ONLY:
+#if APR_HAVE_IPV6 && defined(IPV6_V6ONLY)
+ /* we don't know the initial setting of this option,
+ * so don't check/set sock->netmask since that optimization
+ * won't work
+ */
+ if (setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_V6ONLY,
+ (void *)&on, sizeof(int)) == -1) {
+ return apr_get_netos_error();
+ }
+#else
+ return APR_ENOTIMPL;
+#endif
+ break;
default:
return APR_EINVAL;
break;