--- Begin Message ---
Hello:
I am attaching to this email two patches .. these patches are to both
the APR and the HTTPD.. my apologies for the long winded email here but
I think a long explaination will be required :>
Now let me do a bit of explaining...
I wills start with the APR.. First and formost.. my complements
to the APR team.. what a pleasant architecture to work in.. it
was quite easy to find the problem and fix it..
Now what is the problem... it all revolves around a fundamental
assumption that was made in the socket() call in all cases at
the lowest level a call was made such as:
(*sock)->sockdesc = socket(family, type, 0);
Now this in theory works fine with one little wrinkle... that wrinkle
is the trailing 0. In this you are asking the O/S to return the
first protocol of type 'type'. If one considers that all we have
had is UDP and TCP (up to now) thats fine... but that assumption does
not hold anymore.. SCTP (which I will discuss why apache
should use it down below) is a new transport protocol that
also may come in the flavor of "SOCK_STREAM". Now this means two
things to the current APR.
1) You don't know for sure what you will get back when the socket()
call is made.... Yes most likely the kernel developers of the world
WILL make sure that TCP is returned.. but there are no assurances
that a programmer might make a mistake :-0
2) You can never use these other protocols... I say other because a
new SOCK_DGRAM is also in the works in the IETF (DCCP).
Now another thing you are not able to do in the current APR is
be able to send things or setsockopt on things based on the type.
The patch attached for the APR fixes this... It changes the
apr_create_socket(...) to have an additional field the protocol. This
protocol is also then stored in the underlying socket_t so that it
can be examined. I have also made the configure.in SCTP aware so that
if SCTP is on the system it will set a def APR_HAVE_NETINET_SCTP_H which
will (for unix systems) when setting TCP_NODELAY look at the socket
protocol type and either do a setsockopt() for TCP_NODELAY OR
do a setsockopt() for SCTP_NODELAY... (I wonder if the TCP_NODELAY
really should not be just "NODELAY" from the callers perspective...
but that is another matter).
So in summary for the APR what these changes do is make it so
that you select the protocol type as well as the socket type
and on some unix systems that have SCTP the TCP_NODELAY will be
properly translated into a SCTP_NODELAY... I also went through
the test and utilities that I could find calls to
apr_create_socket(..) and fixed the arguments by adding the
protocol field.
Note to ask for some help on one front on this... I don't have OS-2 or
a Windows development environment.. so I could not compile my changes
there.. not that there are many... I just added the additional
field in the call and the socket_t structures... For now I
am not aware the stack vendors in the OS-2 and Win land have
SCTP... so when they come along the NODELAY thing will need to
be looked at.... I do know that some WIN SCTP stacks have been
tested at backoffs and such (as add on options).. but none from MS
yet...
Now the httpd patch ties in with this APR patch as one might expect...
It provides changes throughout the code in the httpd-2.0 directory
that call apr_create_socket() to set the protocol type aka
IPPROTO_TCP or IPPROTO_UDP in all the places it is called... Now
in addition to these alignments to the APR I did do one other
thing...
In the listen() module I made httpd fundamentally aware of the
APR_HAVE_NETINET_SCTP_H and if SCTP does exist on the machine
it creates for every TCP listener a pair SCTP listener in the
ap_listeners list...
This then makes it so that on SCTP enabled machines httpd will
accept and respond to requests on both TCP and SCTP.... Of course
if SCTP is not on the machine none of this code gets compiled in..
Now you may ask what machines and why bother...
Well first on the what machines side... all of the major
unix's that I know of have or have coming along SCTP.
solaris
aix
linux
Free/Net/OpenBSD
HP-UX
All have SCTP stacks.. the next linux kernel (I guess it will be 2.6)
will ship standard with it. The BSD's have it as a kame addon and
will eventually integrate it.. Aix had an awesome stack at the
last bakeoff on one of their pieces of big-iron...
HP and solaris were not present at the last bakeoff.. but do have
stacks and were at the last few bakeoffs before the one in Sept...
So now that I have established with you that yes.. SCTP is slowly
showing up.. and possibly other things in the future aka DCCP which
might convince you that the APR needs adjustment.. why would HTTPD
want to put it in as a part of the stack...
First of all it IS a base level transport protocol and it CAN
seamlessly replace TCP (with the 1 to 1 model aka SOCK_STREAM) and
I think it should be supported.. if available...
But more importantly it is what new features it brings to the table.
The most NOTEABLE two features are
a) multi-homing support
and
b) streams.
Now multi-homing you get for free.. so for example later today when
I finish my network re-arrangement.. if you have a browser that supports
SCTP you could hit my web site (that includes these patches) and get
multi-homed support.. I have twin DSL's into the house (which I
seem to need... one of my links is down right now :-/)... and if
you were talking to my site it would transparently fail over
from one DSL to the other.. without doing anything ... under the
covers so to speak :>
And yes.. you can get a mozilla equiped SCTP browser from my
web site :-)
http://www.sctp.org
Granted.. most web sites may not be multi-homed.. so this is
a limited advantage... but the real advantage comes from (b) streams...
Now don't think TCP, "a stream of bytes", when I say streams.. instead
let me explain what the term means...
When I set up an SCTP association (this is SCTP speak for connection)
I specify the number of streams I want.. These are if you will
parrallel channels within the connection. I can send
msg1 -> stream1
msg2 -> stream2
msg3 -> stream3
msg4 -> stream5
msg6 -> stream1
msg7 -> stream2
Now lets say msg1 gets dropped in the big-I somewhere.. normally
in TCP you would get msg2-7 at the receiver.. and these would
all wait patiently for msg1 to be retransmitted... thus slowing
things down... With SCTP, since these were sent to different
streams... only msg6 would be stuck (since it also is in
stream1).. all the rest would have been delivered without delay.
Streams basically lets you escape the head-of-line blocking issues...
Now in order to use streams one would need additional changes to
the APR obviously .. i.e. the send call would need to become
aware of what a stream was and do the proper send_msg() call under
the covers to make it work .. if the protocol was SCTP.. otherwise
if it was TCP it would just send it...
But more so.. one would also have to get the way to do it
standardized so that the browser world could develop a method
for using SCTP ... one neat thing is the browsers would no
longer need to setup two connections for data (thus lowering the
connection overhead on servers)... This is of course for
future work... and would require the web community to
standize how they wish to exploit the advanced features
of SCTP...
But these patches I believe are a good start since they
seamlessly integrate SCTP into httpd and the APR and
provide the building block so that we can expand to
include the new features later..
Ok... what do you all think.. I know this was
a long email.. but I think it is worth your time..
I will be more than glad to answer any questions the community
may have...
Thanks
R
--
Randall R. Stewart
[EMAIL PROTECTED] 815-342-5222 (cell phone)
? include/apr_network_io.h.flc
? network_io/unix/sa_common.c.flc
Index: configure.in
===================================================================
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.484
diff -u -r1.484 configure.in
--- configure.in 3 Oct 2002 15:31:49 -0000 1.484
+++ configure.in 13 Oct 2002 20:54:22 -0000
@@ -974,7 +974,20 @@
else
AC_MSG_RESULT(no)
fi
-
+AC_MSG_CHECKING(for netinet/sctp.h)
+AC_TRY_CPP([
+#ifdef HAVE_NETINET_IN_H
+#include <sys/types.h>
+#endif
+#include <netinet/sctp.h>
+], netinet_sctph="1", netinet_sctph="0")
+if test $netinet_sctph = 1; then
+ AC_MSG_RESULT(yes)
+ echo "#define HAVE_NETINET_SCTP_H 1" >> confdefs.h
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST(netinet_sctph)
AC_SUBST(arpa_ineth)
AC_SUBST(conioh)
AC_SUBST(ctypeh)
Index: include/apr.h.in
===================================================================
RCS file: /home/cvspublic/apr/include/apr.h.in,v
retrieving revision 1.115
diff -u -r1.115 apr.h.in
--- include/apr.h.in 3 Aug 2002 20:29:54 -0000 1.115
+++ include/apr.h.in 13 Oct 2002 20:54:23 -0000
@@ -44,6 +44,7 @@
#define APR_HAVE_NETDB_H @netdbh@
#define APR_HAVE_NETINET_IN_H @netinet_inh@
#define APR_HAVE_NETINET_TCP_H @netinet_tcph@
+#define APR_HAVE_NETINET_SCTP_H @netinet_sctph@
#define APR_HAVE_PTHREAD_H @pthreadh@
#define APR_HAVE_SEMAPHORE_H @semaphoreh@
#define APR_HAVE_SIGNAL_H @signalh@
Index: include/apr_network_io.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_network_io.h,v
retrieving revision 1.129
diff -u -r1.129 apr_network_io.h
--- include/apr_network_io.h 11 Oct 2002 20:41:23 -0000 1.129
+++ include/apr_network_io.h 13 Oct 2002 20:54:24 -0000
@@ -271,7 +271,7 @@
* @param cont The pool to use
*/
APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock,
- int family, int type,
+ int family, int type, int protocol,
apr_pool_t *cont);
/**
@@ -728,6 +728,12 @@
apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name,
char *args);
#endif
+
+/**
+ * Return the protocol in the APR socket structure
+ */
+APR_DECLARE(apr_status_t) apr_socket_get_protocol(apr_socket_t *sock,
+ int *protocol);
/**
* Set a socket to be inherited by child processes.
Index: include/apr_portable.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_portable.h,v
retrieving revision 1.81
diff -u -r1.81 apr_portable.h
--- include/apr_portable.h 3 Oct 2002 17:55:42 -0000 1.81
+++ include/apr_portable.h 13 Oct 2002 20:54:24 -0000
@@ -214,6 +214,7 @@
struct sockaddr *remote; /**< NULL if not connected */
int family; /**< always required (APR_INET, APR_INET6, etc. */
int type; /**< always required (SOCK_STREAM, SOCK_DGRAM,
etc. */
+ int protocol; /** IPPROTO_SCTP/IPPROTO_TCP/IPPROTO_UDP **/
};
typedef struct apr_os_sock_info_t apr_os_sock_info_t;
Index: include/arch/os2/networkio.h
===================================================================
RCS file: /home/cvspublic/apr/include/arch/os2/networkio.h,v
retrieving revision 1.26
diff -u -r1.26 networkio.h
--- include/arch/os2/networkio.h 11 Jul 2002 06:28:40 -0000 1.26
+++ include/arch/os2/networkio.h 13 Oct 2002 20:54:25 -0000
@@ -67,6 +67,7 @@
apr_pool_t *cntxt;
int socketdes;
int type;
+ int protocol;
apr_sockaddr_t *local_addr;
apr_sockaddr_t *remote_addr;
apr_interval_time_t timeout;
Index: include/arch/unix/networkio.h
===================================================================
RCS file: /home/cvspublic/apr/include/arch/unix/networkio.h,v
retrieving revision 1.54
diff -u -r1.54 networkio.h
--- include/arch/unix/networkio.h 11 Jul 2002 05:19:44 -0000 1.54
+++ include/arch/unix/networkio.h 13 Oct 2002 20:54:25 -0000
@@ -87,6 +87,10 @@
#if APR_HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
+#if APR_HAVE_NETINET_SCTP_H
+#include <netinet/sctp_uio.h>
+#include <netinet/sctp.h>
+#endif
#if APR_HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@@ -120,6 +124,7 @@
apr_pool_t *cntxt;
int socketdes;
int type;
+ int protocol;
apr_sockaddr_t *local_addr;
apr_sockaddr_t *remote_addr;
apr_interval_time_t timeout;
Index: include/arch/win32/networkio.h
===================================================================
RCS file: /home/cvspublic/apr/include/arch/win32/networkio.h,v
retrieving revision 1.28
diff -u -r1.28 networkio.h
--- include/arch/win32/networkio.h 15 Jul 2002 07:26:12 -0000 1.28
+++ include/arch/win32/networkio.h 13 Oct 2002 20:54:25 -0000
@@ -62,6 +62,7 @@
apr_pool_t *cntxt;
SOCKET socketdes;
int type; /* SOCK_STREAM, SOCK_DGRAM */
+ int protocol;
apr_sockaddr_t *local_addr;
apr_sockaddr_t *remote_addr;
int timeout_ms; /* MUST MATCH if timeout > 0 */
Index: network_io/os2/sockets.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/os2/sockets.c,v
retrieving revision 1.56
diff -u -r1.56 sockets.c
--- network_io/os2/sockets.c 30 Jul 2002 13:56:14 -0000 1.56
+++ network_io/os2/sockets.c 13 Oct 2002 20:54:25 -0000
@@ -103,7 +103,19 @@
(*new)->remote_addr->pool = p;
}
-APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family,
int type,
+
+APR_DECLARE(apr_status_t) apr_socket_get_protocol(apr_socket_t *sock,
+ int *protocol)
+{
+ *protocol = sock->protocol;
+ return APR_SUCCESS;
+}
+
+
+APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new,
+ int family,
+ int type,
+ int protocol,
apr_pool_t *cont)
{
int downgrade = (family == AF_UNSPEC);
@@ -118,11 +130,11 @@
alloc_socket(new, cont);
- (*new)->socketdes = socket(family, type, 0);
+ (*new)->socketdes = socket(family, type, protocol);
#if APR_HAVE_IPV6
if ((*new)->socketdes < 0 && downgrade) {
family = AF_INET;
- (*new)->socketdes = socket(family, type, 0);
+ (*new)->socketdes = socket(family, type, protocol);
}
#endif
@@ -130,7 +142,7 @@
return APR_OS2_STATUS(sock_errno());
}
set_socket_vars(*new, family, type);
-
+ (*new)->protocol = protocol;
(*new)->timeout = -1;
(*new)->nonblock = FALSE;
apr_pool_cleanup_register((*new)->cntxt, (void *)(*new),
Index: network_io/unix/sockets.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/unix/sockets.c,v
retrieving revision 1.101
diff -u -r1.101 sockets.c
--- network_io/unix/sockets.c 30 Jul 2002 13:56:14 -0000 1.101
+++ network_io/unix/sockets.c 13 Oct 2002 20:54:26 -0000
@@ -103,8 +103,16 @@
(*new)->remote_addr->pool = p;
}
+apr_status_t apr_socket_get_protocol(apr_socket_t *sock,
+ int *protocol)
+{
+ *protocol = sock->protocol;
+ return APR_SUCCESS;
+}
+
+
apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type,
- apr_pool_t *cont)
+ int protocol, apr_pool_t *cont)
{
int family = ofamily;
@@ -118,12 +126,12 @@
alloc_socket(new, cont);
- (*new)->socketdes = socket(family, type, 0);
+ (*new)->socketdes = socket(family, type, protocol);
#if APR_HAVE_IPV6
if ((*new)->socketdes < 0 && ofamily == APR_UNSPEC) {
family = APR_INET;
- (*new)->socketdes = socket(family, type, 0);
+ (*new)->socketdes = socket(family, type, protocol);
}
#endif
@@ -131,7 +139,7 @@
return errno;
}
set_socket_vars(*new, family, type);
-
+ (*new)->protocol = protocol;
(*new)->timeout = -1;
(*new)->inherit = 0;
apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), socket_cleanup,
@@ -325,6 +333,7 @@
set_socket_vars(*apr_sock, os_sock_info->family, os_sock_info->type);
(*apr_sock)->timeout = -1;
(*apr_sock)->socketdes = *os_sock_info->os_sock;
+ (*apr_sock)->protocol = os_sock_info->protocol;
if (os_sock_info->local) {
memcpy(&(*apr_sock)->local_addr->sa.sin,
os_sock_info->local,
Index: network_io/unix/sockopt.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/unix/sockopt.c,v
retrieving revision 1.59
diff -u -r1.59 sockopt.c
--- network_io/unix/sockopt.c 15 Jul 2002 20:29:38 -0000 1.59
+++ network_io/unix/sockopt.c 13 Oct 2002 20:54:26 -0000
@@ -231,12 +231,28 @@
}
if (opt & APR_TCP_NODELAY) {
#if defined(TCP_NODELAY)
+#if APR_HAVE_NETINET_SCTP_H
+ if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on){
+ if(sock->protocol == IPPROTO_SCTP){
+ if (setsockopt(sock->socketdes, IPPROTO_SCTP, SCTP_NODELAY,
(void *)&on, sizeof(int)) == -1) {
+ return errno;
+ }
+ }else{
+ if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
(void *)&on, sizeof(int)) == -1) {
+ return errno;
+ }
+ }
+ apr_set_option(&sock->netmask, APR_TCP_NODELAY, on);
+ }
+#else
+
if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on){
if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, (void
*)&on, sizeof(int)) == -1) {
return errno;
}
apr_set_option(&sock->netmask, APR_TCP_NODELAY, on);
}
+#endif
#else
/* BeOS pre-BONE has TCP_NODELAY set by default.
* As it can't be turned off we might as well check if they're asking
@@ -260,10 +276,24 @@
* flag set we need to switch it off...
*/
int tmpflag = 0;
+#if APR_HAVE_NETINET_SCTP_H
+ if(sock->protocol == IPPROTO_SCTP){
+ if (setsockopt(sock->socketdes, IPPROTO_SCTP, SCTP_NODELAY,
+ (void*)&tmpflag, sizeof(int)) == -1){
+ return errno;
+ }
+ }else{
+ if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
+ (void*)&tmpflag, sizeof(int)) == -1){
+ return errno;
+ }
+ }
+#else
if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
(void*)&tmpflag, sizeof(int)) == -1){
return errno;
}
+#endif
apr_set_option(&sock->netmask, APR_RESET_NODELAY, 1);
apr_set_option(&sock->netmask, APR_TCP_NODELAY, 0);
} else if (on){
@@ -277,10 +307,25 @@
apr_set_option(&sock->netmask, APR_TCP_NOPUSH, on);
if (!on && apr_is_option_set(sock->netmask, APR_RESET_NODELAY)){
int tmpflag = 1;
+#if APR_HAVE_NETINET_SCTP_H
+ if(sock->protocol == IPPROTO_SCTP){
+ if (setsockopt(sock->socketdes, IPPROTO_SCTP, SCTP_NODELAY,
+ (void*)&tmpflag, sizeof(int)) == -1){
+ return errno;
+ }
+ }else{
+ if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
+ (void*)&tmpflag, sizeof(int)) == -1){
+ return errno;
+ }
+ }
+
+#else
if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
(void*)&tmpflag, sizeof(int)) == -1){
return errno;
}
+#endif
apr_set_option(&sock->netmask, APR_RESET_NODELAY,0);
apr_set_option(&sock->netmask, APR_TCP_NODELAY, 1);
}
Index: network_io/win32/sockets.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/win32/sockets.c,v
retrieving revision 1.85
diff -u -r1.85 sockets.c
--- network_io/win32/sockets.c 30 Jul 2002 13:56:17 -0000 1.85
+++ network_io/win32/sockets.c 13 Oct 2002 20:54:27 -0000
@@ -94,8 +94,15 @@
(*new)->remote_addr->pool = p;
}
+APR_DECLARE(apr_status_t) apr_socket_get_protocol(apr_socket_t *sock,
+ int *protocol)
+{
+ *protocol = sock->protocol;
+ return APR_SUCCESS;
+}
+
APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family,
- int type, apr_pool_t *cont)
+ int type, int protocol, apr_pool_t
*cont)
{
int downgrade = (family == AF_UNSPEC);
@@ -112,11 +119,11 @@
/* For right now, we are not using socket groups. We may later.
* No flags to use when creating a socket, so use 0 for that parameter as
well.
*/
- (*new)->socketdes = socket(family, type, 0);
+ (*new)->socketdes = socket(family, type, protocol);
#if APR_HAVE_IPV6
if ((*new)->socketdes == INVALID_SOCKET && downgrade) {
family = AF_INET;
- (*new)->socketdes = socket(family, type, 0);
+ (*new)->socketdes = socket(family, type, protocol);
}
#endif
@@ -161,6 +168,7 @@
set_socket_vars(*new, family, type);
+ (*new)->protocol = protocol;
(*new)->timeout = -1;
(*new)->disconnected = 0;
Index: network_io/win32/sockopt.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/win32/sockopt.c,v
retrieving revision 1.45
diff -u -r1.45 sockopt.c
--- network_io/win32/sockopt.c 15 Jul 2002 20:29:38 -0000 1.45
+++ network_io/win32/sockopt.c 13 Oct 2002 20:54:27 -0000
@@ -193,6 +193,43 @@
break;
}
case APR_TCP_NODELAY:
+> #if APR_HAVE_NETINET_SCTP_H
+> if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on){
+> if(sock->protocol == IPPROTO_SCTP){
+> if (setsockopt(sock->socketdes, IPPROTO_SCTP,
+> SCTP_NODELAY,
+> (void *)&on, sizeof(int)) == -1) {
+> return apr_get_netos_error();
+> }
+>
+> }else{
+> if (setsockopt(sock->socketdes, IPPROTO_TCP,
TCP_NODELAY,
+> (void *)&on, sizeof(int)) == -1) {
+> return apr_get_netos_error();
+> }
+> }
+> apr_set_option(&sock->netmask, APR_TCP_NODELAY, on);
+> }
+> }
+> #else
+#if APR_HAVE_NETINET_SCTP_H
+ if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on){
+ if(sock->protocol == IPPROTO_SCTP){
+ if (setsockopt(sock->socketdes, IPPROTO_SCTP,
+ SCTP_NODELAY,
+ (void *)&on, sizeof(int)) == -1) {
+ return apr_get_netos_error();
+ }
+
+ }else{
+ if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
+ (void *)&on, sizeof(int)) == -1) {
+ return apr_get_netos_error();
+ }
+ }
+ apr_set_option(&sock->netmask, APR_TCP_NODELAY, on);
+ }
+#else
if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on){
if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
(void *)&on, sizeof(int)) == -1) {
@@ -200,6 +237,7 @@
}
apr_set_option(&sock->netmask, APR_TCP_NODELAY, on);
}
+#endif
break;
default:
return APR_EINVAL;
Index: test/client.c
===================================================================
RCS file: /home/cvspublic/apr/test/client.c,v
retrieving revision 1.36
diff -u -r1.36 client.c
--- test/client.c 15 Jul 2002 07:56:13 -0000 1.36
+++ test/client.c 13 Oct 2002 20:54:28 -0000
@@ -110,7 +110,7 @@
fprintf(stdout,"OK\n");
fprintf(stdout, "\tClient: Creating new socket.......");
- if (apr_socket_create(&sock, remote_sa->family, SOCK_STREAM,
+ if (apr_socket_create(&sock, remote_sa->family, SOCK_STREAM,IPPROTO_TCP,
context) != APR_SUCCESS) {
fprintf(stderr, "Couldn't create socket\n");
exit(-1);
Index: test/sendfile.c
===================================================================
RCS file: /home/cvspublic/apr/test/sendfile.c,v
retrieving revision 1.22
diff -u -r1.22 sendfile.c
--- test/sendfile.c 15 Jul 2002 07:56:13 -0000 1.22
+++ test/sendfile.c 13 Oct 2002 20:54:28 -0000
@@ -115,7 +115,7 @@
}
*sock = NULL;
- rv = apr_socket_create(sock, *family, SOCK_STREAM, *p);
+ rv = apr_socket_create(sock, *family, SOCK_STREAM, IPPROTO_TCP, *p);
if (rv != APR_SUCCESS) {
fprintf(stderr, "apr_socket_create()->%d/%s\n",
rv,
Index: test/server.c
===================================================================
RCS file: /home/cvspublic/apr/test/server.c,v
retrieving revision 1.36
diff -u -r1.36 server.c
--- test/server.c 15 Jul 2002 07:56:13 -0000 1.36
+++ test/server.c 13 Oct 2002 20:54:29 -0000
@@ -113,7 +113,7 @@
}
APR_TEST_SUCCESS(rv, "Creating new socket",
- apr_socket_create(&sock, family, SOCK_STREAM, context))
+ apr_socket_create(&sock, family, SOCK_STREAM, IPPROTO_TCP, context))
APR_TEST_SUCCESS(rv, "Setting option APR_SO_NONBLOCK",
apr_socket_opt_set(sock, APR_SO_NONBLOCK, 1))
Index: test/testpoll.c
===================================================================
RCS file: /home/cvspublic/apr/test/testpoll.c,v
retrieving revision 1.19
diff -u -r1.19 testpoll.c
--- test/testpoll.c 6 Aug 2002 04:08:03 -0000 1.19
+++ test/testpoll.c 13 Oct 2002 20:54:29 -0000
@@ -73,7 +73,7 @@
printf("couldn't create control socket information, shutting down");
return 1;
}
- if (apr_socket_create(sock, (*sa)->family, SOCK_DGRAM, p)
+ if (apr_socket_create(sock, (*sa)->family, SOCK_DGRAM, IPPROTO_UDP, p)
!= APR_SUCCESS){
printf("couldn't create UDP socket, shutting down");
return 1;
Index: test/testsockets.c
===================================================================
RCS file: /home/cvspublic/apr/test/testsockets.c,v
retrieving revision 1.5
diff -u -r1.5 testsockets.c
--- test/testsockets.c 13 Mar 2002 20:39:27 -0000 1.5
+++ test/testsockets.c 13 Oct 2002 20:54:29 -0000
@@ -105,20 +105,20 @@
printf("Testing socket creation functions.\n");
STD_TEST_NEQ(" Creating a TCP socket",
- apr_socket_create(&sock, APR_INET, SOCK_STREAM, pool))
+ apr_socket_create(&sock, APR_INET, SOCK_STREAM, IPPROTO_TCP,
pool))
close_sock(sock);
STD_TEST_NEQ(" Creating UDP socket",
- apr_socket_create(&sock, APR_INET, SOCK_DGRAM, pool))
+ apr_socket_create(&sock, APR_INET, SOCK_DGRAM, IPPROTO_UDP,
pool))
close_sock(sock);
#if APR_HAVE_IPV6
STD_TEST_NEQ(" Creating an IPv6 TCP socket",
- apr_socket_create(&sock, APR_INET6, SOCK_STREAM, pool))
+ apr_socket_create(&sock, APR_INET6, SOCK_STREAM, IPPROTO_TCP,
pool))
close_sock(sock);
STD_TEST_NEQ(" Creating an IPv6 UDP socket",
- apr_socket_create(&sock, APR_INET6, SOCK_DGRAM, pool))
+ apr_socket_create(&sock, APR_INET6, SOCK_DGRAM, IPPROTO_UDP,
pool))
close_sock(sock);
#else
printf("NO IPv6 support.\n");
@@ -127,9 +127,9 @@
printf("Now trying sendto/recvfrom (simple tests only)\n");
STD_TEST_NEQ(" Creating socket #1 for test",
- apr_socket_create(&sock, family, SOCK_DGRAM, pool))
+ apr_socket_create(&sock, family, SOCK_DGRAM, IPPROTO_UDP,
pool))
STD_TEST_NEQ(" Creating socket #2 for test",
- apr_socket_create(&sock2, family, SOCK_DGRAM, pool))
+ apr_socket_create(&sock2, family, SOCK_DGRAM, IPPROTO_UDP,
pool))
apr_sockaddr_info_get(&to, US, APR_UNSPEC, 7772, 0, pool);
apr_sockaddr_info_get(&from, US, APR_UNSPEC, 7771, 0, pool);
? modules/proxy/proxy_ftp.c.flc
? modules/proxy/proxy_util.c.flc
? server/mpm_common.c.flc
? server/mpm/beos/beos.c.flc
? server/mpm/experimental/perchild/perchild.c.flc
? server/mpm/winnt/child.c.flc
? support/ab.c.flc
Index: modules/arch/netware/mod_nw_ssl.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/arch/netware/mod_nw_ssl.c,v
retrieving revision 1.6
diff -u -r1.6 mod_nw_ssl.c
--- modules/arch/netware/mod_nw_ssl.c 14 Oct 2002 00:12:02 -0000 1.6
+++ modules/arch/netware/mod_nw_ssl.c 14 Oct 2002 11:43:02 -0000
@@ -367,6 +367,7 @@
sock_info.remote = NULL;
sock_info.family = APR_INET;
sock_info.type = SOCK_STREAM;
+ sock_info.protocol = IPPROTO_TCP;
apr_os_sock_make(&sd, &sock_info, pconf);
Index: modules/proxy/proxy_ftp.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/proxy/proxy_ftp.c,v
retrieving revision 1.130
diff -u -r1.130 proxy_ftp.c
--- modules/proxy/proxy_ftp.c 18 Aug 2002 21:01:06 -0000 1.130
+++ modules/proxy/proxy_ftp.c 14 Oct 2002 11:43:05 -0000
@@ -954,7 +954,9 @@
int failed = 1;
while (connect_addr) {
- if ((rv = apr_socket_create(&sock, connect_addr->family,
SOCK_STREAM, r->pool)) != APR_SUCCESS) {
+ if ((rv = apr_socket_create(&sock, connect_addr->family,
+ SOCK_STREAM, IPPROTO_TCP ,
+ r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: FTP: error creating socket");
continue;
@@ -1270,7 +1272,11 @@
"proxy: FTP: EPSV contacting remote host on port %d",
data_port);
- if ((rv = apr_socket_create(&data_sock, connect_addr->family,
SOCK_STREAM, r->pool)) != APR_SUCCESS) {
+ if ((rv = apr_socket_create(&data_sock,
+ connect_addr->family,
+ SOCK_STREAM,
+ IPPROTO_TCP,
+ r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: FTP: error creating EPSV socket");
return HTTP_INTERNAL_SERVER_ERROR;
@@ -1357,7 +1363,11 @@
"proxy: FTP: PASV contacting host %d.%d.%d.%d:%d",
h3, h2, h1, h0, pasvport);
- if ((rv = apr_socket_create(&data_sock, connect_addr->family,
SOCK_STREAM, r->pool)) != APR_SUCCESS) {
+ if ((rv = apr_socket_create(&data_sock,
+ connect_addr->family,
+ SOCK_STREAM,
+ IPPROTO_TCP,
+ r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: error creating PASV socket");
return HTTP_INTERNAL_SERVER_ERROR;
@@ -1400,7 +1410,11 @@
apr_port_t local_port;
unsigned int h0, h1, h2, h3, p0, p1;
- if ((rv = apr_socket_create(&local_sock, connect_addr->family,
SOCK_STREAM, r->pool)) != APR_SUCCESS) {
+ if ((rv = apr_socket_create(&local_sock,
+ connect_addr->family,
+ SOCK_STREAM,
+ IPPROTO_TCP,
+ r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy: FTP: error creating local socket");
return HTTP_INTERNAL_SERVER_ERROR;
Index: modules/proxy/proxy_util.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/proxy/proxy_util.c,v
retrieving revision 1.98
diff -u -r1.98 proxy_util.c
--- modules/proxy/proxy_util.c 25 Aug 2002 20:40:11 -0000 1.98
+++ modules/proxy/proxy_util.c 14 Oct 2002 11:43:06 -0000
@@ -1130,8 +1130,11 @@
int loglevel;
while (backend_addr && !connected) {
+
if ((rv = apr_socket_create(newsock, backend_addr->family,
- SOCK_STREAM, p)) != APR_SUCCESS) {
+ SOCK_STREAM,
+ IPPROTO_TCP,
+ p)) != APR_SUCCESS) {
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
ap_log_error(APLOG_MARK, loglevel, rv, s,
"proxy: %s: error creating fam %d socket for target
%s",
Index: server/listen.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/listen.c,v
retrieving revision 1.82
diff -u -r1.82 listen.c
--- server/listen.c 31 Jul 2002 12:44:55 -0000 1.82
+++ server/listen.c 14 Oct 2002 11:43:07 -0000
@@ -229,7 +229,9 @@
apr_socket_t *tmp_sock;
apr_sockaddr_t *sa;
- if ((sock_rv = apr_socket_create(&tmp_sock, APR_INET6, SOCK_STREAM,
p))
+ if ((sock_rv = apr_socket_create(&tmp_sock, APR_INET6, SOCK_STREAM,
+ IPPROTO_TCP,
+ p))
== APR_SUCCESS &&
apr_sockaddr_info_get(&sa, NULL, APR_INET6, 0, 0, p) ==
APR_SUCCESS &&
apr_bind(tmp_sock, sa) == APR_SUCCESS) {
@@ -253,6 +255,9 @@
apr_status_t status;
apr_port_t oldport;
apr_sockaddr_t *sa;
+#if APR_HAVE_NETINET_SCTP_H
+ ap_listen_rec *new2;
+#endif
if (!addr) { /* don't bind to specific interface */
find_default_family(process->pool);
@@ -279,10 +284,27 @@
if (sa) {
apr_sockaddr_port_get(&oldport, sa);
if (!strcmp(sa->hostname, addr) && port == oldport) {
- /* re-use existing record */
+#if APR_HAVE_NETINET_SCTP_H
+ int protocol;
+ new = *walk;
+ if(new->next){
+ apr_socket_get_protocol(new->next->sd,&protocol);
+ }
+ if(new->next && (protocol == IPPROTO_SCTP )){
+ /* Next one is a clone of this one so
+ * take it too.
+ */
+ *walk = new->next->next;
+ new->next->next = ap_listeners;
+ }else{
+ *walk = new->next;
+ new->next = ap_listeners;
+ }
+#else
new = *walk;
*walk = new->next;
new->next = ap_listeners;
+#endif
ap_listeners = new;
return NULL;
}
@@ -302,12 +324,43 @@
}
if ((status = apr_socket_create(&new->sd,
new->bind_addr->family,
- SOCK_STREAM, process->pool))
+ SOCK_STREAM,
+ IPPROTO_TCP ,
+ process->pool))
!= APR_SUCCESS) {
ap_log_perror(APLOG_MARK, APLOG_CRIT, status, process->pool,
"alloc_listener: failed to get a socket for %s", addr);
return "Listen setup failed";
}
+#if APR_HAVE_NETINET_SCTP_H
+ new2 = apr_palloc(process->pool, sizeof(ap_listen_rec));
+ new2->active = 0;
+ if ((status = apr_sockaddr_info_get(&new2->bind_addr, addr, APR_UNSPEC,
+ port, 0, process->pool))
+ != APR_SUCCESS) {
+ ap_log_perror(APLOG_MARK, APLOG_WARNING, status, process->pool,
+ "alloc_listener: failed to set up SCTP sockaddr for %s",
+ addr);
+ new->next = ap_listeners;
+ ap_listeners = new;
+ return NULL;
+ }
+ if ((status = apr_socket_create(&new2->sd,
+ new2->bind_addr->family,
+ SOCK_STREAM,
+ IPPROTO_SCTP ,
+ process->pool))
+ != APR_SUCCESS) {
+ ap_log_perror(APLOG_MARK, APLOG_WARNING, status, process->pool,
+ "alloc_listener: failed to get a SCTP socket for
%s:sctp", addr);
+ new->next = ap_listeners;
+ ap_listeners = new;
+ return NULL;
+
+ }
+ new2->next = ap_listeners;
+ ap_listeners = new2;
+#endif
new->next = ap_listeners;
ap_listeners = new;
Index: server/mpm_common.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm_common.c,v
retrieving revision 1.102
diff -u -r1.102 mpm_common.c
--- server/mpm_common.c 15 Jul 2002 08:05:10 -0000 1.102
+++ server/mpm_common.c 14 Oct 2002 11:43:07 -0000
@@ -481,7 +481,8 @@
return rv;
}
- rv = apr_socket_create(&sock, pod->sa->family, SOCK_STREAM, p);
+ rv = apr_socket_create(&sock, pod->sa->family, SOCK_STREAM,
+ IPPROTO_TCP , p);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
"get socket to connect to listener");
Index: server/rfc1413.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/rfc1413.c,v
retrieving revision 1.47
diff -u -r1.47 rfc1413.c
--- server/rfc1413.c 15 Jul 2002 08:18:50 -0000 1.47
+++ server/rfc1413.c 14 Oct 2002 11:43:08 -0000
@@ -141,7 +141,9 @@
if ((rv = apr_socket_create(newsock,
localsa->family, /* has to match */
- SOCK_STREAM, conn->pool)) != APR_SUCCESS) {
+ SOCK_STREAM,
+ IPPROTO_TCP,
+ conn->pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv,
"rfc1413: error creating query socket");
return rv;
Index: server/mpm/beos/beos.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/beos/beos.c,v
retrieving revision 1.99
diff -u -r1.99 beos.c
--- server/mpm/beos/beos.c 12 Jul 2002 12:27:19 -0000 1.99
+++ server/mpm/beos/beos.c 14 Oct 2002 11:43:09 -0000
@@ -795,8 +795,8 @@
"couldn't create control socket information, shutting down");
return 1;
}
- if (apr_socket_create(&udp_sock, udp_sa->family, SOCK_DGRAM,
- _pconf) != APR_SUCCESS){
+ if (apr_socket_create(&udp_sock, udp_sa->family, SOCK_DGRAM,
+ IPPROTO_UDP,_pconf) != APR_SUCCESS){
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, s,
"couldn't create control socket, shutting down");
return 1;
Index: server/mpm/experimental/perchild/perchild.c
===================================================================
RCS file:
/home/cvspublic/httpd-2.0/server/mpm/experimental/perchild/perchild.c,v
retrieving revision 1.135
diff -u -r1.135 perchild.c
--- server/mpm/experimental/perchild/perchild.c 11 Oct 2002 15:41:52 -0000
1.135
+++ server/mpm/experimental/perchild/perchild.c 14 Oct 2002 11:43:12 -0000
@@ -681,12 +681,13 @@
struct cmsghdr *cmsg;
char headers[HUGE_STRING_LEN];
char request_body[HUGE_STRING_LEN];
- struct iovec iov[2];
+ struct iovec iov[3];
int ret, dp;
apr_os_sock_t sd;
apr_bucket_alloc_t *alloc = apr_bucket_alloc_create(ptrans);
apr_bucket_brigade *bb = apr_brigade_create(ptrans, alloc);
apr_bucket *bucket;
+ int protocol;
apr_os_sock_get(&sd, lr->sd);
@@ -694,11 +695,13 @@
iov[0].iov_len = HUGE_STRING_LEN;
iov[1].iov_base = request_body;
iov[1].iov_len = HUGE_STRING_LEN;
+ iov[2].iov_base = (char *)&protocol;
+ iov[2].iov_len = sizeof(protocol);
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = iov;
- msg.msg_iovlen = 2;
+ msg.msg_iovlen = 3;
cmsg = apr_palloc(ptrans, sizeof(*cmsg) + sizeof(sd));
cmsg->cmsg_len = sizeof(*cmsg) + sizeof(sd);
@@ -711,6 +714,9 @@
apr_os_sock_put((apr_socket_t **)csd, &dp, ptrans);
+ /* Copy the protocol across */
+ csd->protocol = protocol;
+
bucket = apr_bucket_eos_create(alloc);
APR_BRIGADE_INSERT_HEAD(bb, bucket);
bucket = apr_bucket_socket_create(*csd, alloc);
@@ -1630,7 +1636,7 @@
struct msghdr msg;
struct cmsghdr *cmsg;
int sfd;
- struct iovec iov[2];
+ struct iovec iov[3];
conn_rec *c = r->connection;
apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);
apr_bucket_brigade *sockbb;
@@ -1679,11 +1685,13 @@
iov[0].iov_len = strlen(h.headers) + 1;
iov[1].iov_base = request_body;
iov[1].iov_len = len + 1;
+ iov[2].iov_base = (char *)&thesock->protocol;
+ iov[2].iov_len = sizeof(thesock->protocol);
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = iov;
- msg.msg_iovlen = 2;
+ msg.msg_iovlen = 3;
cmsg = apr_palloc(r->pool, sizeof(*cmsg) + sizeof(sfd));
cmsg->cmsg_len = sizeof(*cmsg) + sizeof(sfd);
Index: server/mpm/mpmt_os2/mpmt_os2.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/mpmt_os2/mpmt_os2.c,v
retrieving revision 1.23
diff -u -r1.23 mpmt_os2.c
--- server/mpm/mpmt_os2/mpmt_os2.c 11 Aug 2002 04:40:59 -0000 1.23
+++ server/mpm/mpmt_os2/mpmt_os2.c 14 Oct 2002 11:43:12 -0000
@@ -182,7 +182,7 @@
apr_sockaddr_info_get(&lr->bind_addr, "0.0.0.0", APR_UNSPEC,
DEFAULT_HTTP_PORT, 0, s->process->pool);
apr_socket_create(&lr->sd, lr->bind_addr->family,
- SOCK_STREAM, s->process->pool);
+ SOCK_STREAM, IPPROTO_TCP, s->process->pool);
}
for (lr = ap_listeners; lr; lr = lr->next) {
Index: server/mpm/winnt/child.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/winnt/child.c,v
retrieving revision 1.8
diff -u -r1.8 child.c
--- server/mpm/winnt/child.c 14 Oct 2002 03:13:20 -0000 1.8
+++ server/mpm/winnt/child.c 14 Oct 2002 11:43:13 -0000
@@ -446,6 +446,7 @@
sockinfo.remote = context->sa_client;
sockinfo.family = APR_INET;
sockinfo.type = SOCK_STREAM;
+ sockinfo.protocol = IPPROTO_TCP;
apr_os_sock_make(&context->sock, &sockinfo, context->ptrans);
return context;
Index: support/ab.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/support/ab.c,v
retrieving revision 1.120
diff -u -r1.120 ab.c
--- support/ab.c 1 Sep 2002 21:11:17 -0000 1.120
+++ support/ab.c 14 Oct 2002 11:43:16 -0000
@@ -1242,7 +1242,7 @@
apr_pool_create(&c->ctx, cntxt);
if ((rv = apr_socket_create(&c->aprsock, destsa->family,
- SOCK_STREAM, c->ctx)) != APR_SUCCESS) {
+ SOCK_STREAM, IPPROTO_TCP, c->ctx)) !=
APR_SUCCESS) {
apr_err("socket", rv);
}
if ((rv = apr_socket_opt_set(c->aprsock, APR_SO_NONBLOCK, 1))
--- End Message ---