distcache-cvs Mailing List for distcache, Distributed session caching
Brought to you by:
geoffthorpe
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
(36) |
Sep
|
Oct
(29) |
Nov
(5) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(16) |
Feb
(53) |
Mar
(180) |
Apr
(64) |
May
(68) |
Jun
(93) |
Jul
(44) |
Aug
|
Sep
|
Oct
(9) |
Nov
(43) |
Dec
|
2004 |
Jan
|
Feb
(38) |
Mar
(63) |
Apr
(63) |
May
(30) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(1) |
From: DistCacheCVS - G. T. <geo...@us...> - 2005-12-07 03:37:54
|
Update of /cvsroot/distcache/distcache/ssl/swamp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15227/ssl/swamp Modified Files: sslswamp.pod Log Message: Rattle off some quick man-page enhancements for sslswamp. Link the man-page to the older but more complete swamp-1.1.0 README. Index: sslswamp.pod =================================================================== RCS file: /cvsroot/distcache/distcache/ssl/swamp/sslswamp.pod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sslswamp.pod 17 Feb 2004 20:20:09 -0000 1.2 +++ sslswamp.pod 7 Dec 2005 03:37:44 -0000 1.3 @@ -32,6 +32,101 @@ # swamp -connect UNIX:/path/to/some/socket +=item B<-CAfile> path + +Specifies a PEM file containing trusted CA certificates. + +=item B<-cert> path + +Specifies a PEM file containing the client certificate and private key. This will +permit swamp to perform client-authentication if the server requests it (and if +the client certificate is signed by a CA the server approves of). + +=item B<-sslmeth> method + +Specifies an SSL/TLS version, either 'sslv2', 'sslv3', or 'tlsv1'. The default +is to interoperate with the version used by the server. + +=item B<-num> num + +Specifies the number of simultaneous connections to use. Default is 5. + +=item B<-count> num + +Specifies the number of requests to perform before terminating. Default is 0, +which indicates to continue indefinitely. + +=item B<-time> secs + +Specifies the number of seconds to run before terminating. Default is 0, which +indicates to continue indefinitely. + +=item B<-request> string + +Specifies a clear-text string to send to the server once the SSL/TLS protocol as +negotiated a session. The default is "GET /\r\n". + +=item B<-expect> num + +Specifies the amount of clear-text output to expect from the server through the +negotiated session. The default is 20 bytes. + +=item B<-session> string + +Specifies a pattern of 's' (new session) and 'r' (resume) to allow swamp to +test certain combinations of resuming cached sessions. Eg. 'srrsrrr' causes +swamp to attempt to resume a previous SSL/TLS session 5 times out of 7. If +B<-num> is used to specify multiple simultaneous connections, each one will +independently iterate over the same pattern. NB, if a server is unable to +resumbe an SSL/TLS session, the connection results in a full handshake anyway. +Use of B<-update> should indicate how many resume-attempts were honoured. + +The default is 's', ie. all new sessions. + +=item B<-update> num + +Specifies the number of seconds between an updated line of statistics. Default +is 0, which indicates to produce no updates. + +=item B<-cipher> string + +Specifies the list of SSL/TLS cipher-suites to perform, see openssl documentation +for more information. The default is to use OpenSSL defaults. + +=item B<-csv> path + +Specifies a file to produce CSV statistics each second. Default is to produce +no CSV output. + +=item B<-session_ids> + +Display all SSL/TLS session IDs negotiated. This produces a lot of output, and +is intended for diagnostics only (eg. when session-caching is not working - this +can be used together with B<-session>). + +=item B<-engine> id + +Specifies an ENGINE id to initialise and use. + +=item B<-distribute> str + +If multiple B<-connect> switches are specified, each destination address is associated +with an index from B<1> to B<n>. Use of the B<-distribute> switch allows a connection +context (ie. B<-num> specifies how many) to iterate requests across a certain pattern +of destination addresses. Eg. "1,2,3,2,3,3" would target 3 addresses, with the second +and third addresses getting progressively heavier weighting. + +Note, within a given connection context, successive connections iterate across +any B<-destribute> pattern for destination addresses at the same time as it iterates +across any B<-session> pattern for session-resumes. By choosing both patterns +carefully, it is possible to test whether a server cluster supports a shared +session cache (eg. using I<distcache>). + +=item B<-nologo> + +This disables the banner output, mostly useful when grepping swamp output from a +script or some such magic. + =item B<-h>, B<-help>, B<-?> Any of these flags will cause B<swamp> to display a brief usage summary to @@ -42,8 +137,8 @@ =head1 BUGS -This man page is utterly incomplete. - +Someone should find time to filter down and integrate some of the extra cruft +at; F<http://www.geoffthorpe.net/crypto/swamp/swamp-1.1.0/README> =head1 SEE ALSO @@ -62,6 +157,11 @@ Distcache home page. +=item F<http://www.geoffthorpe.net/crypto/swamp/swamp-1.1.0/README> + +Older swamp-1.1.0 documentation, but contains more info (some of which may be +stale). + =back |
From: DistCacheCVS - G. T. <geo...@us...> - 2005-11-02 01:24:09
|
Update of /cvsroot/distcache/distcache/libnal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27412/libnal Modified Files: sel_poll.c sel_select.c Log Message: We use a void* context to stash an integer index, so fix compilation warnings for platforms (eg. x86_64) where pointers are larger than integers. Index: sel_poll.c =================================================================== RCS file: /cvsroot/distcache/distcache/libnal/sel_poll.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- sel_poll.c 30 Apr 2004 12:57:59 -0000 1.7 +++ sel_poll.c 2 Nov 2005 01:23:54 -0000 1.8 @@ -66,8 +66,8 @@ } sel_ctx; #define OBJ_TABLE_START 32 #define POLLFD_TABLE_START 4 /* Just for testing */ -#define IDX2TOKEN(idx) (NAL_SELECTOR_TOKEN)((unsigned int)idx | 0x8000) -#define TOKEN2IDX(tok) ((unsigned int)tok & 0x7FFF) +#define IDX2TOKEN(idx) (NAL_SELECTOR_TOKEN)((unsigned long)idx | 0x8000) +#define TOKEN2IDX(tok) (unsigned int)((unsigned long)tok & 0x7FFF) /* Helper functions for the object table */ static void obj_table_zilch(sel_obj *items, unsigned int num) Index: sel_select.c =================================================================== RCS file: /cvsroot/distcache/distcache/libnal/sel_select.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- sel_select.c 30 Apr 2004 12:57:59 -0000 1.7 +++ sel_select.c 2 Nov 2005 01:23:54 -0000 1.8 @@ -65,8 +65,8 @@ unsigned int obj_used, obj_size; } sel_ctx; #define OBJ_TABLE_START 32 -#define IDX2TOKEN(idx) (NAL_SELECTOR_TOKEN)((unsigned int)idx | 0x8000) -#define TOKEN2IDX(tok) ((unsigned int)tok & 0x7FFF) +#define IDX2TOKEN(idx) (NAL_SELECTOR_TOKEN)((unsigned long)idx | 0x8000) +#define TOKEN2IDX(tok) (unsigned int)((unsigned long)tok & 0x7FFF) /* Helper functions for the object table */ static void obj_table_zilch(sel_obj *items, unsigned int num) |
From: DistCacheCVS - G. T. <geo...@us...> - 2005-11-02 01:06:55
|
Update of /cvsroot/distcache/distcache/libsys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24067/libsys Modified Files: sys.c Log Message: When performing calculations for expiry periods greater than 4294 seconds, we should avoid calculating microseconds directly as we cause wrap-around with 32-bit types. [Priit Randla, priit dot randla at seb dot ee] Index: sys.c =================================================================== RCS file: /cvsroot/distcache/distcache/libsys/sys.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- sys.c 30 Apr 2004 12:57:59 -0000 1.12 +++ sys.c 2 Nov 2005 01:06:41 -0000 1.13 @@ -236,10 +236,9 @@ const struct timeval *timenow) { struct timeval threshold; - unsigned long usec_expiry = msec_expiry * 1000; SYS_memcpy(struct timeval, &threshold, timeitem); - threshold.tv_sec = threshold.tv_sec + (usec_expiry / 1000000L); - threshold.tv_usec += (usec_expiry % 1000000); + threshold.tv_sec = threshold.tv_sec + (msec_expiry / 1000); + threshold.tv_usec += (msec_expiry % 1000) * 1000; if(threshold.tv_usec > 1000000) { threshold.tv_usec -= 1000000; threshold.tv_sec++; |
From: DistCacheCVS - G. T. <geo...@us...> - 2005-11-02 01:06:55
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24067 Modified Files: CHANGES Log Message: When performing calculations for expiry periods greater than 4294 seconds, we should avoid calculating microseconds directly as we cause wrap-around with 32-bit types. [Priit Randla, priit dot randla at seb dot ee] Index: CHANGES =================================================================== RCS file: /cvsroot/distcache/distcache/CHANGES,v retrieving revision 1.141 retrieving revision 1.142 diff -u -d -r1.141 -r1.142 --- CHANGES 20 Oct 2004 03:20:42 -0000 1.141 +++ CHANGES 2 Nov 2005 01:06:41 -0000 1.142 @@ -19,7 +19,10 @@ Changes between 1.5.1 and 1.5.x ------------------------------- - *) + *) When performing calculations for expiry periods greater than 4294 seconds, + we should avoid calculating microseconds directly as we cause wrap-around + with 32-bit types. + [Priit Randla, priit dot randla at seb dot ee] Changes between 1.5.0 and 1.5.1 ------------------------------- |
From: DistCacheCVS - G. T. <geo...@us...> - 2005-11-02 01:06:49
|
Update of /cvsroot/distcache/distcache/include/libsys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24067/include/libsys Modified Files: post.h Log Message: When performing calculations for expiry periods greater than 4294 seconds, we should avoid calculating microseconds directly as we cause wrap-around with 32-bit types. [Priit Randla, priit dot randla at seb dot ee] Index: post.h =================================================================== RCS file: /cvsroot/distcache/distcache/include/libsys/post.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- post.h 30 Apr 2004 12:57:58 -0000 1.12 +++ post.h 2 Nov 2005 01:06:41 -0000 1.13 @@ -187,9 +187,11 @@ do { \ struct timeval *_tmp_res = (res); \ const struct timeval *_tmp_I = (I); \ - unsigned long _tmp_carry = _tmp_I->tv_usec + ((msecs) * 1000); \ - _tmp_res->tv_usec = _tmp_carry % 1000000; \ - _tmp_carry /= 1000000; \ + /* This loses sub-millisecond accuracy, to avoid 32-bit wraparound when + * adding >4294 secs. */ \ + unsigned long _tmp_carry = _tmp_I->tv_usec / 1000 + (msecs); \ + _tmp_res->tv_usec = (_tmp_carry % 1000) * 1000; \ + _tmp_carry /= 1000; \ _tmp_res->tv_sec = _tmp_I->tv_sec + _tmp_carry; \ } while(0) #ifdef WIN32 |
From: DistCacheCVS - G. T. <geo...@us...> - 2005-05-26 21:42:20
|
Update of /cvsroot/distcache/distcache/libdistcacheserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1342/libdistcacheserver Modified Files: Makefile.am Log Message: Correct some automake linker-dependencies for libdistcache and libdistcacheserver. [Joe Orton] Index: Makefile.am =================================================================== RCS file: /cvsroot/distcache/distcache/libdistcacheserver/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 6 Jun 2003 19:50:06 -0000 1.7 +++ Makefile.am 26 May 2005 21:42:06 -0000 1.8 @@ -3,4 +3,5 @@ lib_LTLIBRARIES = libdistcacheserver.la libdistcacheserver_la_SOURCES = dc_server.c dc_server_default.c libdistcacheserver_la_LDFLAGS = -version-info 1:1:0 +libdistcacheserver_la_LIBADD = ../libdistcache/libdistcache.la ../libnal/libnal.la |
From: DistCacheCVS - G. T. <geo...@us...> - 2005-05-26 21:42:19
|
Update of /cvsroot/distcache/distcache/libdistcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1342/libdistcache Modified Files: Makefile.am Log Message: Correct some automake linker-dependencies for libdistcache and libdistcacheserver. [Joe Orton] Index: Makefile.am =================================================================== RCS file: /cvsroot/distcache/distcache/libdistcache/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile.am 6 Jun 2003 19:50:06 -0000 1.9 +++ Makefile.am 26 May 2005 21:42:06 -0000 1.10 @@ -3,4 +3,4 @@ lib_LTLIBRARIES = libdistcache.la libdistcache_la_SOURCES = dc_client.c dc_enc.c libdistcache_la_LDFLAGS = -version-info 1:1:0 - +libdistcache_la_LIBADD = ../libnal/libnal.la |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 03:20:51
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21056 Modified Files: CHANGES configure.ac Log Message: Tagging is done (TAG_1_5_1), bump versions Index: CHANGES =================================================================== RCS file: /cvsroot/distcache/distcache/CHANGES,v retrieving revision 1.140 retrieving revision 1.141 diff -u -d -r1.140 -r1.141 --- CHANGES 20 Oct 2004 03:13:21 -0000 1.140 +++ CHANGES 20 Oct 2004 03:20:42 -0000 1.141 @@ -12,10 +12,15 @@ -- W. Edwards Deming -Current version: 1.5.1 +Current version: 1.5.x ---------------------- +Changes between 1.5.1 and 1.5.x +------------------------------- + + *) + Changes between 1.5.0 and 1.5.1 ------------------------------- Index: configure.ac =================================================================== RCS file: /cvsroot/distcache/distcache/configure.ac,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- configure.ac 20 Oct 2004 03:13:21 -0000 1.53 +++ configure.ac 20 Oct 2004 03:20:42 -0000 1.54 @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(distcache, 1.5.1, dis...@li...) +AC_INIT(distcache, 1.5.2dev, dis...@li...) WANT_AUTOCONF=2.5 WANT_AUTOMAKE=1.8 @@ -9,7 +9,7 @@ echo "Configuring Distcache libraries and utilities" echo "---------------------------------------------" -AM_INIT_AUTOMAKE(distcache, 1.5.1) +AM_INIT_AUTOMAKE(distcache, 1.5.2dev) AC_CONFIG_SRCDIR(sessserver/server.c) AM_CONFIG_HEADER(config.h) |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 03:13:34
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19190 Modified Files: ANNOUNCE CHANGES configure.ac Log Message: Prepare to release 1.5.1 Index: ANNOUNCE =================================================================== RCS file: /cvsroot/distcache/distcache/ANNOUNCE,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ANNOUNCE 24 Mar 2004 04:27:34 -0000 1.13 +++ ANNOUNCE 20 Oct 2004 03:13:21 -0000 1.14 @@ -13,19 +13,21 @@ -- George Orwell -distcache release: 1.5.0 +distcache release: 1.5.1 ------------------------ -We are pleased to announce the release of version 1.5.0 of the distcache +We are pleased to announce the release of version 1.5.1 of the distcache package. For more information on what distcache is and how to use it, please see the README as it provides a good introduction and a guide to the other documents in this package. -This is the first release of distcache from the 1.5 branch of development. -This release introduces a major overhaul of the network abstraction (libnal) -for improved performance and flexibility. There are various other enhancements -and additions that represent ongoing work, so those requiring solid stable -versions should use the latest release from the 1.4 branch. +This is the second release of distcache from the 1.5 branch of development. +This release continues on from the overhaul of the network abstraction library +(libnal) with support for asynchronous closes in the API via +NAL_SELECTOR_num_objects(). There are also numerous fixes since 1.5.0 that +increase usability. More work is required before 1.5 can replace 1.4 as the +stable branch, but 1.5.1 addresses most visible issues and should be quite +usable. ---------------------------------------------------------------------------- Index: CHANGES =================================================================== RCS file: /cvsroot/distcache/distcache/CHANGES,v retrieving revision 1.139 retrieving revision 1.140 diff -u -d -r1.139 -r1.140 --- CHANGES 20 Oct 2004 02:35:01 -0000 1.139 +++ CHANGES 20 Oct 2004 03:13:21 -0000 1.140 @@ -12,11 +12,11 @@ -- W. Edwards Deming -Current version: 1.5.x +Current version: 1.5.1 ---------------------- -Changes between 1.5.0 and 1.5.x +Changes between 1.5.0 and 1.5.1 ------------------------------- *) Add a new 'nal_proxy' application. This configures various address pairs Index: configure.ac =================================================================== RCS file: /cvsroot/distcache/distcache/configure.ac,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- configure.ac 2 Jun 2004 17:43:18 -0000 1.52 +++ configure.ac 20 Oct 2004 03:13:21 -0000 1.53 @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(distcache, 1.5.1dev, dis...@li...) +AC_INIT(distcache, 1.5.1, dis...@li...) WANT_AUTOCONF=2.5 WANT_AUTOMAKE=1.8 @@ -9,7 +9,7 @@ echo "Configuring Distcache libraries and utilities" echo "---------------------------------------------" -AM_INIT_AUTOMAKE(distcache, 1.5.1dev) +AM_INIT_AUTOMAKE(distcache, 1.5.1) AC_CONFIG_SRCDIR(sessserver/server.c) AM_CONFIG_HEADER(config.h) |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 02:58:33
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15757 Modified Files: BUGS Log Message: Add a new note to the BUGS file and reorder according to importance. Index: BUGS =================================================================== RCS file: /cvsroot/distcache/distcache/BUGS,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- BUGS 20 Oct 2004 02:48:31 -0000 1.16 +++ BUGS 20 Oct 2004 02:58:23 -0000 1.17 @@ -1,3 +1,22 @@ +- I need to migrate and/or rewrite the swamp 1.1.0 documentation to the + sslswamp man-page. Right now the man page is very incomplete. + +- Need to fix up snoop for the new libnal model. + +- All the executables need a review to make sure they're safe w.r.t. proper + use of NAL_LISTENER_finished() and also NAL_SELECTOR_new_objects() for + program termination. + +- snoop does not do any flush-handling when one side of the proxy disconnects, + but immediately closes the other side and destroys the context. What should + happen is that we should not close the other side until all data accepted + from the closing side has been sent out the other side. + +- I'm pretty sure the building of the documents is not 100% kosher. Eg. the + links don't seem to do anything useful in the HTML versions at least, and + there's loads of cross-link errors/warnings when building. (NOTE: I've + disabled compilation of HTML documents for now). + - dummy FIFO connections created using NAL_CONNECTION_create_dummy should be trivially selectable if anyone's daft enough to try. Ie. if you add a FIFO to a selector, the select() should break instantly if the FIFO is non-empty @@ -5,11 +24,6 @@ Right now, NAL_SELECTOR_add_conn() silently ignores dummy connections completely. -- snoop does not do any flush-handling when one side of the proxy disconnects, - but immediately closes the other side and destroys the context. What should - happen is that we should not close the other side until all data accepted - from the closing side has been sent out the other side. - - dc_test should in theory avoid the case that a session it added could have been expired (we can't say definitively because of races). If it gets within a couple of seconds of expected session expiry, the session should be marked @@ -17,16 +31,7 @@ seconds after the expiry where dc_test should then assume it was removed by the server so future ADDs succeed, DELETEs fail, etc. -- I'm pretty sure the building of the documents is not 100% kosher. Eg. the - links don't seem to do anything useful in the HTML versions at least, and - there's loads of cross-link errors/warnings when building. (NOTE: I've - disabled compilation of HTML documents for now). - -- I need to migrate and/or rewrite the swamp 1.1.0 documentation to the - sslswamp man-page. Right now the man page is very incomplete. - - Since overhauling libnal for the alternative selector model, piper ceases working between dc_test and dc_server. It works between nal_ping and nal_echo though, so it's probably a layer in libdistcache or something (sigh). -- Need to fix up snoop for the new libnal model. |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 02:48:40
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13340 Modified Files: BUGS Log Message: Squish. Index: BUGS =================================================================== RCS file: /cvsroot/distcache/distcache/BUGS,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- BUGS 8 Mar 2004 23:07:06 -0000 1.15 +++ BUGS 20 Oct 2004 02:48:31 -0000 1.16 @@ -29,4 +29,4 @@ working between dc_test and dc_server. It works between nal_ping and nal_echo though, so it's probably a layer in libdistcache or something (sigh). -- Need to fix up snoop and swamp for the new libnal model. +- Need to fix up snoop for the new libnal model. |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 02:45:06
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12524 Modified Files: proxy.c Log Message: Make nal_proxy calmer by default. Index: proxy.c =================================================================== RCS file: /cvsroot/distcache/distcache/test/proxy.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- proxy.c 20 Oct 2004 02:35:01 -0000 1.1 +++ proxy.c 20 Oct 2004 02:44:51 -0000 1.2 @@ -25,6 +25,9 @@ #include "timing.h" #include <libsys/post.h> +/* Uncomment if you wish to debug setup/teardown of tunnels */ +/* #define DEBUG_TUNNELS */ + #define MAX_PAIRS 10 #define MAX_CONNS 512 #define BUFFER_SIZE (16*1024) @@ -175,8 +178,10 @@ conns[conns_used].dead2 = 0; conns[conns_used].pair = tmp; conns_used++; +#ifdef DEBUG_TUNNELS SYS_fprintf(SYS_stderr, "Adding a tunnel -> total %d " "(from pair %d)\n", conns_used, tmp); +#endif return 1; } } @@ -235,8 +240,10 @@ NAL_CONNECTION_free(item->conn2); if(foo < conns_used--) SYS_memcpy_n(tunnel_t, item, item + 1, conns_used - foo); +#ifdef DEBUG_TUNNELS SYS_fprintf(SYS_stderr, "Dropping a tunnel -> total %d " "(from pair %d)\n", conns_used, item->pair); +#endif } else { /* Move on */ foo++; |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 02:35:11
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10518/test Modified Files: .cvsignore Makefile.am Added Files: proxy.c Log Message: Add a general-purpose port-forwarder for TCP, 'nal_proxy'. --- NEW FILE: proxy.c --- /* distcache, Distributed Session Caching technology * Copyright (C) 2004 The Distcache.org project * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; using version 2.1 of the License. The copyright holders * may elect to allow the application of later versions of the License to this * software, please contact the author (ge...@di...) if you wish us to * review any later version released by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define SYS_GENERATING_EXE #include <libsys/pre.h> #include <libnal/nal.h> #include "timing.h" #include <libsys/post.h> #define MAX_PAIRS 10 #define MAX_CONNS 512 #define BUFFER_SIZE (16*1024) #define DEF_UNITS UNITS_bits #ifdef SUPPORT_UPDATE IMPLEMENT_UNITS() #endif static void usage(void) { SYS_fprintf(SYS_stderr, "Usage: nal_proxy [options ...]\n" "where options include;\n" " -pair <addr1> <addr2>\n"); #ifdef SUPPORT_UPDATE SYS_fprintf(SYS_stderr, " -update <secs> - default=<none>\n" " -units [k|m|g]<b|B> - default='%s'\n", UNITS2STR(DEF_UNITS)); #endif #ifdef SUPPORT_UPDATE SYS_fprintf(SYS_stderr, "'units' displays traffic rates as bits or bytes per second.\n" "An optional prefix can scale to kilo, mega, or giga bits/bytes.\n"); #endif } /*******************/ /* Interface pairs */ /*******************/ typedef struct st_pair_t { /* cmd-line parameters */ const char *addr1, *addr2; /* addresses */ NAL_ADDRESS *addr_listener, *addr_connection; /* listening interface */ NAL_LISTENER *listener; } pair_t; static pair_t pairs[MAX_PAIRS]; static unsigned int pairs_used = 0, pairs_cursor = 0; static void pairs_destroy(void) { unsigned int loop = 0; pair_t *item = pairs; while(loop++ < pairs_used) { NAL_LISTENER_free(item->listener); NAL_ADDRESS_free(item->addr_listener); NAL_ADDRESS_free(item->addr_connection); item++; } pairs_used = pairs_cursor = 0; } static int util_parsepair(const char *p1, const char *p2) { NAL_ADDRESS *addr1, *addr2; if(pairs_used >= MAX_PAIRS) { SYS_fprintf(SYS_stderr, "Error, too many interface pairs\n"); return 0; } addr1 = NAL_ADDRESS_new(); addr2 = NAL_ADDRESS_new(); if(!addr1 || !addr2) abort(); if(!NAL_ADDRESS_create(addr1, p1, BUFFER_SIZE) || !NAL_ADDRESS_can_listen(addr1)) { SYS_fprintf(SYS_stderr, "Error, '%s' is an invalid addres\n", p1); return 0; } if(!NAL_ADDRESS_create(addr2, p2, BUFFER_SIZE) || !NAL_ADDRESS_can_connect(addr2)) { SYS_fprintf(SYS_stderr, "Error, '%s' is an invalid addres\n", p2); return 0; } pairs[pairs_used].addr1 = p1; pairs[pairs_used].addr2 = p2; pairs[pairs_used].addr_listener = addr1; pairs[pairs_used].addr_connection = addr2; pairs[pairs_used].listener = NULL; SYS_fprintf(SYS_stderr, "Parsed pair %d: %s -> %s\n", pairs_used, p1, p2); pairs_used++; return 1; } static int util_startpairs(NAL_SELECTOR *sel) { unsigned int foo = 0; while(foo < pairs_used) { if((pairs[foo].listener = NAL_LISTENER_new()) == NULL) abort(); if(!NAL_LISTENER_create(pairs[foo].listener, pairs[foo].addr_listener) || !NAL_LISTENER_add_to_selector(pairs[foo].listener, sel)) { SYS_fprintf(SYS_stderr, "Error, can't listen on %s\n", pairs[foo].addr1); return 0; } foo++; } return 1; } /******************************/ /* Connection pairs (tunnels) */ /******************************/ typedef struct st_tunnel_t { NAL_CONNECTION *conn1, *conn2; int use1, use2; int dead1, dead2; unsigned int pair; } tunnel_t; static tunnel_t conns[MAX_CONNS]; static unsigned int conns_used = 0; static void conns_destroy(void) { unsigned int loop = 0; tunnel_t *item = conns; while(loop++ < conns_used) { NAL_CONNECTION_free(item->conn1); NAL_CONNECTION_free(item->conn2); item++; } conns_used = 0; } static int conns_accept(NAL_CONNECTION *conn, NAL_SELECTOR *sel) { unsigned int loop = 0; if(conns_used == MAX_CONNS) return 0; while(loop++ < pairs_used) { int tmp = pairs_cursor; pair_t *item = pairs + tmp; if(++pairs_cursor == pairs_used) pairs_cursor = 0; if(NAL_CONNECTION_accept(conn, item->listener)) { if(!NAL_CONNECTION_add_to_selector(conn, sel)) abort(); conns[conns_used].conn1 = conn; if((conns[conns_used].conn2 = NAL_CONNECTION_new()) == NULL) abort(); if(!NAL_CONNECTION_create(conns[conns_used].conn2, item->addr_connection)) abort(); if(!NAL_CONNECTION_add_to_selector(conns[conns_used].conn2, sel)) abort(); conns[conns_used].use1 = 0; conns[conns_used].use2 = 0; conns[conns_used].dead1 = 0; conns[conns_used].dead2 = 0; conns[conns_used].pair = tmp; conns_used++; SYS_fprintf(SYS_stderr, "Adding a tunnel -> total %d " "(from pair %d)\n", conns_used, tmp); return 1; } } return 0; } static unsigned int conns_io(NAL_SELECTOR *sel) { unsigned int total = 0; unsigned int foo = 0; tunnel_t *item = conns; while(foo < conns_used) { if(!item->dead1 && !NAL_CONNECTION_io(item->conn1)) item->dead1 = 1; if(!item->dead2 && !NAL_CONNECTION_io(item->conn2)) item->dead2 = 1; if(item->dead1) { /* Check if conn2 has flushed */ if(!item->dead2 && NAL_BUFFER_empty( NAL_CONNECTION_get_send(item->conn2))) item->dead2 = 1; } else if(item->dead2) { /* Check if conn1 has flushed */ if(!item->dead1 && NAL_BUFFER_empty( NAL_CONNECTION_get_send(item->conn1))) item->dead1 = 1; } else { unsigned int tmp; /* Both are up, try forwarding */ if(item->use1 && NAL_BUFFER_empty( NAL_CONNECTION_get_send(item->conn1))) item->use1 = 0; if(item->use2 && NAL_BUFFER_empty( NAL_CONNECTION_get_send(item->conn2))) item->use2 = 0; if(!item->use1 && NAL_BUFFER_notempty( NAL_CONNECTION_get_read(item->conn2)) && (tmp = NAL_BUFFER_transfer( NAL_CONNECTION_get_send(item->conn1), NAL_CONNECTION_get_read(item->conn2), 0))) { item->use1 = 1; total += tmp; } if(!item->use2 && NAL_BUFFER_notempty( NAL_CONNECTION_get_read(item->conn1)) && (tmp = NAL_BUFFER_transfer( NAL_CONNECTION_get_send(item->conn2), NAL_CONNECTION_get_read(item->conn1), 0))) { item->use2 = 1; total += tmp; } } if(item->dead1 && item->dead2) { /* Remove */ NAL_CONNECTION_free(item->conn1); NAL_CONNECTION_free(item->conn2); if(foo < conns_used--) SYS_memcpy_n(tunnel_t, item, item + 1, conns_used - foo); SYS_fprintf(SYS_stderr, "Dropping a tunnel -> total %d " "(from pair %d)\n", conns_used, item->pair); } else { /* Move on */ foo++; item++; } } return total; } /****************/ /* main() stuff */ /****************/ static int util_parsenum(const char *s, unsigned int *num) { char *endptr; unsigned long int val; val = strtoul(s, &endptr, 10); if((val == ULONG_MAX) || !endptr || (*endptr != '\0')) { SYS_fprintf(SYS_stderr, "Error, bad number '%s'\n", s); return 0; } *num = val; return 1; } static int err_noarg(const char *s) { SYS_fprintf(SYS_stderr, "Error: missing argument for '%s'\n", s); usage(); return 1; } static int err_unknown(const char *s) { SYS_fprintf(SYS_stderr, "Error: unknown switch '%s'\n", s); usage(); return 1; } #define ARG_INC do {argc--;argv++;} while(0) #define ARG_CHECK(a) \ if(argc < 2) \ return err_noarg(a); \ ARG_INC int main(int argc, char *argv[]) { int ret = 1; NAL_SELECTOR *sel; NAL_CONNECTION *conn = NULL; #ifdef SUPPORT_UPDATE unsigned int update = 0; UNITS units = DEF_UNITS; /* Timing variables for '-update' */ /* initialising tt1 because gcc can't see that I don't need to */ time_t tt1 = 0, tt2; struct timeval tv1, tv2; struct rusage ru1, ru2; unsigned int traffic = 0; #endif ARG_INC; while(argc) { if(strcmp(*argv, "-pair") == 0) { const char *pair1, *pair2; ARG_CHECK("-pair"); pair1 = *argv; ARG_CHECK("-pair"); pair2 = *argv; if(!util_parsepair(pair1, pair2)) return 1; #ifdef SUPPORT_UPDATE } else if(strcmp(*argv, "-update") == 0) { ARG_CHECK("-update"); if(!util_parsenum(*argv, &update)) return 1; } else if(strcmp(*argv, "-units") == 0) { ARG_CHECK("-units"); if(!util_parseunits(*argv, &units)) return 1; #endif } else return err_unknown(*argv); ARG_INC; } if(!pairs_used) { SYS_fprintf(SYS_stderr, "Error, you must specify at least one pair\n"); return 1; } SYS_sigpipe_ignore(); sel = NAL_SELECTOR_new(); if(!sel) abort(); if(!util_startpairs(sel)) abort(); #ifdef SUPPORT_UPDATE if(update) { tt1 = time(NULL); SYS_gettime(&tv1); getrusage(RUSAGE_SELF, &ru1); } #endif do { int tmp; /* Select */ if((tmp = NAL_SELECTOR_select(sel, 0, 0)) <= 0) { SYS_fprintf(SYS_stderr, "Error, NAL_SELECTOR_select() " "returned <= 0\n"); goto err; } /* Post-process */ #ifdef SUPPORT_UPDATE traffic += conns_io(sel); #else conns_io(sel); #endif if(!conn && ((conn = NAL_CONNECTION_new()) == NULL)) goto err; if(conns_accept(conn, sel)) conn = NULL; #ifdef SUPPORT_UPDATE /* Check if an update is required */ if(update && ((tt2 = time(NULL)) >= (time_t)(tt1 + update))) { unsigned long msecs, muser, msys; double rate; SYS_gettime(&tv2); getrusage(RUSAGE_SELF, &ru2); msecs = SYS_msecs_between(&tv1, &tv2); muser = SYS_msecs_between(&ru1.ru_utime, &ru2.ru_utime); msys = SYS_msecs_between(&ru1.ru_stime, &ru2.ru_stime); /* Convert bytes to the required double */ rate = util_tounits(traffic, units); /* Adjust according to milli-seconds (and duplexity) */ rate = 2000.0 * rate / (double)msecs; SYS_fprintf(SYS_stdout, "Update: %ld msecs elapsed, %.2f %s/s, " "%.1f%% user, %.1f%% kernel\n", msecs, rate, UNITS2STR(units), (100.0 * muser)/((float)msecs), (100.0 * msys)/((float)msecs)); tt1 = tt2; SYS_timecpy(&tv1, &tv2); SYS_memcpy(struct rusage, &ru1, &ru2); traffic = 0; } #endif /* keep looping until the connections are done and the selector is * empty. This allows non-blocking closes to complete for libnal * implementations that support it. */ } while(NAL_SELECTOR_num_objects(sel)); /* Done */ ret = 0; err: conns_destroy(); pairs_destroy(); NAL_SELECTOR_free(sel); if(conn) NAL_CONNECTION_free(conn); return ret; } Index: .cvsignore =================================================================== RCS file: /cvsroot/distcache/distcache/test/.cvsignore,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- .cvsignore 27 May 2004 19:03:02 -0000 1.7 +++ .cvsignore 20 Oct 2004 02:35:01 -0000 1.8 @@ -10,3 +10,4 @@ nal_ping nal_hose nal_pong +nal_proxy Index: Makefile.am =================================================================== RCS file: /cvsroot/distcache/distcache/test/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Makefile.am 27 May 2004 19:03:02 -0000 1.17 +++ Makefile.am 20 Oct 2004 02:35:01 -0000 1.18 @@ -1,6 +1,6 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir) -bin_PROGRAMS = nal_echo nal_ping nal_hose nal_pong dc_test nal_test +bin_PROGRAMS = nal_echo nal_ping nal_hose nal_pong dc_test nal_test nal_proxy dc_test_SOURCES = dc_test.c dc_test_LDADD = $(top_builddir)/libsys/libsys.la \ $(top_builddir)/libdistcache/libdistcache.la \ @@ -20,4 +20,7 @@ nal_pong_SOURCES = pong.c nal_pong_LDADD = $(top_builddir)/libsys/libsys.la \ $(top_builddir)/libnal/libnal.la +nal_proxy_SOURCES = proxy.c +nal_proxy_LDADD = $(top_builddir)/libsys/libsys.la \ + $(top_builddir)/libnal/libnal.la |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 02:35:11
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10518 Modified Files: CHANGES Log Message: Add a general-purpose port-forwarder for TCP, 'nal_proxy'. Index: CHANGES =================================================================== RCS file: /cvsroot/distcache/distcache/CHANGES,v retrieving revision 1.138 retrieving revision 1.139 diff -u -d -r1.138 -r1.139 --- CHANGES 27 May 2004 19:03:02 -0000 1.138 +++ CHANGES 20 Oct 2004 02:35:01 -0000 1.139 @@ -19,6 +19,12 @@ Changes between 1.5.0 and 1.5.x ------------------------------- + *) Add a new 'nal_proxy' application. This configures various address pairs + from the command-line and will then accept connections on all the ingress + addresses and make outbound connections on the egress addresses. Traffic + is forwarded until either side disconnects. + [Geoff Thorpe] + *) Add another libnal test, nal_pong, that plays request/response transactions with configurable sizes. It doesn't check payloads, and requires clients and servers to be set up with matching parameters, but |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 02:32:50
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9712 Modified Files: ping.c Log Message: Use hex when tracking mismatched ping packets, and always dump the error information ("-quiet" is really just to silence the output when it's working correctly). Index: ping.c =================================================================== RCS file: /cvsroot/distcache/distcache/test/ping.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- ping.c 20 May 2004 19:56:54 -0000 1.19 +++ ping.c 20 Oct 2004 02:32:40 -0000 1.20 @@ -125,7 +125,7 @@ unsigned int tot = 0, pos = 0; while(len--) { if(!pos) - SYS_fprintf(SYS_stdout, "%04d: ", tot); + SYS_fprintf(SYS_stdout, "0x%04x: ", tot); SYS_fprintf(SYS_stdout, "0x%02x ", *(data++)); if(++pos == LINEWIDTH) { SYS_fprintf(SYS_stdout, "\n"); @@ -218,14 +218,12 @@ while(ctx->packet[loop] == ctx->response[loop]) loop++; SYS_fprintf(SYS_stderr, -"(%d) Read error: bad match at offset %d\n", +"(%d) Read error: bad match at offset 0x%04x\n", ctx->id, loop); - if(!ctx->quiet) { - SYS_fprintf(SYS_stdout, "output packet was;\n"); - bindump(ctx->packet, ctx->num_size); - SYS_fprintf(SYS_stdout, "response packet was;\n"); - bindump(ctx->response, ctx->num_size); - } + SYS_fprintf(SYS_stdout, "output packet was;\n"); + bindump(ctx->packet, ctx->num_size); + SYS_fprintf(SYS_stdout, "response packet was;\n"); + bindump(ctx->response, ctx->num_size); return 0; } ctx->loop++; |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 02:31:28
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9501 Modified Files: echo.c Log Message: This prevents 32-bit wrap-around if errinject is disabled (set to zero). Index: echo.c =================================================================== RCS file: /cvsroot/distcache/distcache/test/echo.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- echo.c 11 Jun 2004 16:09:29 -0000 1.16 +++ echo.c 20 Oct 2004 02:31:17 -0000 1.17 @@ -257,7 +257,7 @@ * injections *OR* transfers unless there's at least 4 * bytes available. */ if(NAL_BUFFER_unused(buf_send) >= sizeof(deadbeef)) { - if(++inject == errinject) { + if(errinject && (++inject == errinject)) { NAL_BUFFER_write(buf_send, deadbeef, sizeof(deadbeef)); inject = 0; |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-10-20 01:47:25
|
Update of /cvsroot/distcache/distcache-httpd-2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31930 Modified Files: README Added Files: httpd-2.0.52-patch.diff Removed Files: httpd-2.0.48-patch.diff Log Message: Update httpd-2 support to 2.0.52 --- NEW FILE: httpd-2.0.52-patch.diff --- diff -urN httpd-2.0.52/LAYOUT httpd-2.0.52-patched/LAYOUT --- httpd-2.0.52/LAYOUT 2002-05-30 14:17:16.000000000 -0400 +++ httpd-2.0.52-patched/LAYOUT 2004-10-19 21:37:25.000000000 -0400 @@ -129,6 +129,7 @@ ssl_scache_dbm.c ........ session cache via DBM file ssl_scache_shmcb.c ...... session cache via shared memory cyclic buffer ssl_scache_shmht.c ...... session cache via shared memory hash table + ssl_scache_dc.c ......... session cache offloading via 'distcache' ssl_util.c .............. utility functions ssl_util_ssl.c .......... the OpenSSL companion source ssl_util_ssl.h .......... the OpenSSL companion header diff -urN httpd-2.0.52/acconfig.h httpd-2.0.52-patched/acconfig.h --- httpd-2.0.52/acconfig.h 2002-01-31 09:51:37.000000000 -0500 +++ httpd-2.0.52-patched/acconfig.h 2004-10-19 21:37:25.000000000 -0400 @@ -1,2 +1,5 @@ /* Define this if struct tm has a field tm_gmtoff */ #undef HAVE_GMTOFF + +/* Define this if distcache support is enabled */ +#undef HAVE_DISTCACHE diff -urN httpd-2.0.52/acinclude.m4 httpd-2.0.52-patched/acinclude.m4 --- httpd-2.0.52/acinclude.m4 2004-08-23 10:59:51.000000000 -0400 +++ httpd-2.0.52-patched/acinclude.m4 2004-10-19 21:37:25.000000000 -0400 @@ -477,6 +477,74 @@ fi AC_MSG_RESULT($ap_ssltk_libdir) + AC_MSG_CHECKING(whether Distcache is required) + ap_ssltk_dc="no" + tmp_nomessage="" + tmp_forced="no" + AC_ARG_ENABLE(distcache, + APACHE_HELP_STRING(--enable-distcache=yes/no,Select distcache support), + ap_ssltk_dc="$enableval" + tmp_nomessage="" + tmp_forced="yes" + if test "x$ap_ssltk_dc" = "x"; then + ap_ssltk_dc="yes" + dnl our "error"s become "tests revealed that..." + tmp_forced="no" + fi + if test "$ap_ssltk_dc" != "yes" -a "$ap_ssltk_dc" != "no"; then + tmp_nomessage="--enable-distcache had illegal syntax - disabling" + ap_ssltk_dc="no" + fi) + if test "$tmp_forced" = "no"; then + AC_MSG_RESULT($ap_ssltk_dc (default)) + else + AC_MSG_RESULT($ap_ssltk_dc (specified)) + fi + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno" -a "x$tmp_nomessage" != "x"; then + AC_MSG_ERROR(distcache support failed: $tmp_nomessage) + fi + if test "$ap_ssltk_dc" = "yes"; then + AC_CHECK_HEADER( + [distcache/dc_client.h], + [], + [tmp_nomessage="can't include distcache headers" + ap_ssltk_dc="no"]) + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then + AC_MSG_ERROR(distcache support failed: $tmp_nomessage) + fi + fi + if test "$ap_ssltk_dc" = "yes"; then + AC_MSG_CHECKING(for Distcache version) + AC_TRY_COMPILE( +[#include <distcache/dc_client.h>], +[#if DISTCACHE_CLIENT_API != 0x0001 +#error "distcache API version is unrecognised" +#endif], +[], +[tmp_nomessage="distcache has an unsupported API version" +ap_ssltk_dc="no"]) + AC_MSG_RESULT($ap_ssltk_dc) + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then + AC_MSG_ERROR(distcache support failed: $tmp_nomessage) + fi + fi + if test "$ap_ssltk_dc" = "yes"; then + AC_MSG_CHECKING(for Distcache libraries) + save_libs=$LIBS + LIBS="$LIBS -ldistcache -lnal" + AC_TRY_LINK( + [#include <distcache/dc_client.h>], + [DC_CTX *foo = DC_CTX_new((const char *)0,0);], + [], + [tmp_no_message="failed to link with distcache libraries" + ap_ssltk_dc="no"]) + LIBS=$save_libs + AC_MSG_RESULT($ap_ssltk_dc) + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then + AC_MSG_ERROR(distcache support failed: $tmp_nomessage) + fi + fi + dnl # annotate the Apache build environment with determined information APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir/openssl]) if test "x$ap_ssltk_incdir" != "x/usr/include"; then @@ -488,7 +556,6 @@ APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_ssltk_libdir]) fi fi - APR_ADDTO(LIBS, [-lssl -lcrypto]) pkg-config openssl 2> /dev/null if test $? -eq 0; then ap_ssltk_incdep=`pkg-config --cflags-only-I openssl` @@ -496,6 +563,12 @@ ap_ssltk_libdep=`pkg-config --libs openssl` APR_ADDTO(LIBS, $ap_ssltk_libdep) fi + if test "$ap_ssltk_dc" = "yes"; then + AC_DEFINE(HAVE_DISTCACHE) + APR_ADDTO(LIBS, [-lssl -lcrypto -ldistcache -lnal]) + else + APR_ADDTO(LIBS, [-lssl -lcrypto]) + fi ap_cv_ssltk="$ap_ssltk_base" fi ]) diff -urN httpd-2.0.52/configure httpd-2.0.52-patched/configure --- httpd-2.0.52/configure 2004-09-23 14:35:39.000000000 -0400 +++ httpd-2.0.52-patched/configure 2004-10-19 21:37:25.000000000 -0400 @@ -947,6 +947,7 @@ --with-port=PORT Port on which to listen (default is 80) --with-z=DIR use a specific zlib library --with-ssl=DIR SSL/TLS toolkit (OpenSSL) + --enable-distcache Distributed SSL/TLS session caching support --with-mpm=MPM Choose the process model for Apache to use. MPM={beos|worker|prefork|mpmt_os2|perchild|leader|threadpool} --with-module=module-type:module-file @@ -10244,7 +10245,7 @@ > $modpath_current/modules.mk -ssl_objs="mod_ssl.lo ssl_engine_config.lo ssl_engine_dh.lo ssl_engine_init.lo ssl_engine_io.lo ssl_engine_kernel.lo ssl_engine_log.lo ssl_engine_mutex.lo ssl_engine_pphrase.lo ssl_engine_rand.lo ssl_engine_vars.lo ssl_expr.lo ssl_expr_eval.lo ssl_expr_parse.lo ssl_expr_scan.lo ssl_scache.lo ssl_scache_dbm.lo ssl_scache_shmcb.lo ssl_scache_shmht.lo ssl_util.lo ssl_util_ssl.lo ssl_util_table.lo " +ssl_objs="mod_ssl.lo ssl_engine_config.lo ssl_engine_dh.lo ssl_engine_init.lo ssl_engine_io.lo ssl_engine_kernel.lo ssl_engine_log.lo ssl_engine_mutex.lo ssl_engine_pphrase.lo ssl_engine_rand.lo ssl_engine_vars.lo ssl_expr.lo ssl_expr_eval.lo ssl_expr_parse.lo ssl_expr_scan.lo ssl_scache.lo ssl_scache_dbm.lo ssl_scache_shmcb.lo ssl_scache_shmht.lo ssl_scache_dc.lo ssl_util.lo ssl_util_ssl.lo ssl_util_table.lo " echo "$as_me:$LINENO: checking whether to enable mod_ssl" >&5 echo $ECHO_N "checking whether to enable mod_ssl... $ECHO_C" >&6 @@ -10400,6 +10401,132 @@ echo "$as_me:$LINENO: result: $ap_ssltk_libdir" >&5 echo "${ECHO_T}$ap_ssltk_libdir" >&6 + echo $ECHO_N "checking whether Distcache is required... $ECHO_C" 1>&6 +echo "$as_me:$LINENO: checking whether Distcache is required" >&5 + ap_ssltk_dc="no" + tmp_nomessage="" + tmp_forced="no" + # Check whether --enable-distcache or --disable-distcache was given. +if test "${enable_distcache+set}" = set; then + enableval="$enable_distcache" + ap_ssltk_dc="$enableval" + tmp_nomessage="" + tmp_forced="yes" + if test "x$ap_ssltk_dc" = "x"; then + ap_ssltk_dc="yes" + tmp_forced="no" + fi + if test "$ap_ssltk_dc" != "yes" -a "$ap_ssltk_dc" != "no"; then + tmp_nomessage="--enable-distcache had illegal syntax - disabling" + ap_ssltk_dc="no" + fi +fi + + if test "$tmp_forced" = "no"; then + echo "${ECHO_T}$ap_ssltk_dc (default)" 1>&6 + else + echo "${ECHO_T}$ap_ssltk_dc (specified)" 1>&6 + fi + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno" -a "x$tmp_nomessage" != "x"; then + { echo "$as_me: error: distcache support failed: $tmp_nomessage" 1>&2; exit 1; } + fi + if test "$ap_ssltk_dc" = "yes"; then + ac_safe=`echo "distcache/dc_client.h" | sed 'y%./+-%__p_%'` +echo $ECHO_N "checking for distcache/dc_client.h""... $ECHO_C" 1>&6 +echo "$as_me:$LINENO: checking for distcache/dc_client.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7713 "configure" +#include "confdefs.h" +#include <distcache/dc_client.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:7718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "${ECHO_T}yes" 1>&6 + : +else + echo "${ECHO_T}no" 1>&6 +tmp_nomessage="can't include distcache headers" + ap_ssltk_dc="no" +fi + + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then + { echo "$as_me: error: distcache support failed: $tmp_nomessage" 1>&2; exit 1; } + fi + fi + if test "$ap_ssltk_dc" = "yes"; then + echo $ECHO_N "checking for Distcache version""... $ECHO_C" 1>&6 +echo "$as_me:$LINENO: checking for Distcache version" >&5 + cat > conftest.$ac_ext <<EOF +#line 7749 "configure" +#include "confdefs.h" +#include <distcache/dc_client.h> +int main() { +#if DISTCACHE_CLIENT_API != 0x0001 +#error "distcache API version is unrecognised" +#endif +; return 0; } +EOF +if { (eval echo configure:7758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tmp_nomessage="distcache has an unsupported API version" +ap_ssltk_dc="no" +fi +rm -f conftest* + echo "$ac_t""$ap_ssltk_dc" 1>&6 + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then + { echo "$as_me: error: distcache support failed: $tmp_nomessage" 1>&2; exit 1; } + fi + fi + if test "$ap_ssltk_dc" = "yes"; then + echo $ECHO_N "checking for Distcache libraries""... $ECHO_C" 1>&6 +echo "$as_me:$LINENO: checking for Distcache libraries" >&5 + save_libs=$LIBS + LIBS="$LIBS -ldistcache -lnal" + cat > conftest.$ac_ext <<EOF +#line 7779 "configure" +#include "confdefs.h" +#include <distcache/dc_client.h> +int main() { +DC_CTX *foo = DC_CTX_new((const char *)0,0); +; return 0; } +EOF +if { (eval echo configure:7786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tmp_no_message="failed to link with distcache libraries" + ap_ssltk_dc="no" +fi +rm -f conftest* + LIBS=$save_libs + echo "$ac_t""$ap_ssltk_dc" 1>&6 + if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then + { echo "configure: error: distcache support failed: $tmp_nomessage" 1>&2; exit 1; } + fi + fi if test "x$INCLUDES" = "x"; then echo " setting INCLUDES to \"-I$ap_ssltk_incdir/openssl\"" @@ -10491,6 +10618,34 @@ fi fi + if test "$ap_ssltk_dc" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_DISTCACHE 1 +EOF + + + if test "x$LIBS" = "x"; then + echo " setting LIBS to \"-lssl -lcrypto -ldistcache -lnal\"" + LIBS="-lssl -lcrypto -ldistcache -lnal" + else + apr_addto_bugger="-lssl -lcrypto -ldistcache -lnal" + for i in $apr_addto_bugger; do + apr_addto_duplicate="0" + for j in $LIBS; do + if test "x$i" = "x$j"; then + apr_addto_duplicate="1" + break + fi + done + if test $apr_addto_duplicate = "0"; then + echo " adding \"$i\" to LIBS" + LIBS="$LIBS $i" + fi + done + fi + + else + if test "x$LIBS" = "x"; then echo " setting LIBS to \"-lssl -lcrypto\"" LIBS="-lssl -lcrypto" @@ -10511,6 +10666,8 @@ done fi + fi + pkg-config openssl 2> /dev/null if test $? -eq 0; then ap_ssltk_incdep=`pkg-config --cflags-only-I openssl` diff -urN httpd-2.0.52/docs/conf/ssl-std.conf.in httpd-2.0.52-patched/docs/conf/ssl-std.conf.in --- httpd-2.0.52/docs/conf/ssl-std.conf.in 2004-01-19 13:07:40.000000000 -0500 +++ httpd-2.0.52-patched/docs/conf/ssl-std.conf.in 2004-10-19 21:37:25.000000000 -0400 @@ -68,6 +68,7 @@ #SSLSessionCache none #SSLSessionCache shmht:@exp_runtimedir@/ssl_scache(512000) #SSLSessionCache shmcb:@exp_runtimedir@/ssl_scache(512000) +#SSLSessionCache dc:UNIX:/tmp/scache SSLSessionCache dbm:@exp_runtimedir@/ssl_scache SSLSessionCacheTimeout 300 diff -urN httpd-2.0.52/include/ap_config_auto.h.in httpd-2.0.52-patched/include/ap_config_auto.h.in --- httpd-2.0.52/include/ap_config_auto.h.in 2004-09-23 14:35:37.000000000 -0400 +++ httpd-2.0.52-patched/include/ap_config_auto.h.in 2004-10-19 21:37:25.000000000 -0400 @@ -221,3 +221,6 @@ /* Define to 'int' if <sys/resource.h> doesn't define it for us */ #undef rlim_t + +/* Define if distcache support is enabled */ +#undef HAVE_DISTCACHE diff -urN httpd-2.0.52/modules/ssl/config.m4 httpd-2.0.52-patched/modules/ssl/config.m4 --- httpd-2.0.52/modules/ssl/config.m4 2004-03-10 16:22:12.000000000 -0500 +++ httpd-2.0.52-patched/modules/ssl/config.m4 2004-10-19 21:37:25.000000000 -0400 @@ -35,6 +35,7 @@ ssl_scache_dbm.lo dnl ssl_scache_shmcb.lo dnl ssl_scache_shmht.lo dnl +ssl_scache_dc.lo dnl ssl_util.lo dnl ssl_util_ssl.lo dnl ssl_util_table.lo dnl diff -urN httpd-2.0.52/modules/ssl/mod_ssl.dsp httpd-2.0.52-patched/modules/ssl/mod_ssl.dsp --- httpd-2.0.52/modules/ssl/mod_ssl.dsp 2003-04-05 17:27:42.000000000 -0500 +++ httpd-2.0.52-patched/modules/ssl/mod_ssl.dsp 2004-10-19 21:37:25.000000000 -0400 @@ -168,6 +168,10 @@ # End Source File # Begin Source File +SOURCE=.\ssl_scache_dc.c +# End Source File +# Begin Source File + SOURCE=.\ssl_util.c # End Source File # Begin Source File diff -urN httpd-2.0.52/modules/ssl/mod_ssl.h httpd-2.0.52-patched/modules/ssl/mod_ssl.h --- httpd-2.0.52/modules/ssl/mod_ssl.h 2004-08-27 05:03:24.000000000 -0400 +++ httpd-2.0.52-patched/modules/ssl/mod_ssl.h 2004-10-19 21:37:26.000000000 -0400 @@ -117,9 +117,11 @@ #if APR_HAVE_SYS_TIME_H #include <sys/time.h> #endif +#if 0 #if APR_HAVE_UNISTD_H #include <unistd.h> /* needed for STDIN_FILENO et.al., at least on FreeBSD */ #endif +#endif /* * Provide reasonable default for some defines @@ -316,7 +318,8 @@ SSL_SCMODE_NONE = 0, SSL_SCMODE_DBM = 1, SSL_SCMODE_SHMHT = 2, - SSL_SCMODE_SHMCB = 3 + SSL_SCMODE_SHMCB = 3, + SSL_SCMODE_DC = 4 } ssl_scmode_t; /* @@ -623,6 +626,16 @@ void ssl_scache_shmcb_expire(server_rec *); void ssl_scache_shmcb_status(server_rec *, apr_pool_t *, void (*)(char *, void *), void *); +#ifdef HAVE_DISTCACHE +void ssl_scache_dc_init(server_rec *, apr_pool_t *); +void ssl_scache_dc_kill(server_rec *); +BOOL ssl_scache_dc_store(server_rec *, UCHAR *, int, time_t, SSL_SESSION *); +SSL_SESSION *ssl_scache_dc_retrieve(server_rec *, UCHAR *, int); +void ssl_scache_dc_remove(server_rec *, UCHAR *, int); +void ssl_scache_dc_expire(server_rec *); +void ssl_scache_dc_status(server_rec *, apr_pool_t *, void (*)(char *, void *), void *); +#endif + /* Pass Phrase Support */ void ssl_pphrase_Handle(server_rec *, apr_pool_t *); diff -urN httpd-2.0.52/modules/ssl/ssl_engine_config.c httpd-2.0.52-patched/modules/ssl/ssl_engine_config.c --- httpd-2.0.52/modules/ssl/ssl_engine_config.c 2004-08-23 11:18:54.000000000 -0400 +++ httpd-2.0.52-patched/modules/ssl/ssl_engine_config.c 2004-10-19 21:37:26.000000000 -0400 @@ -976,6 +976,20 @@ arg+4); } } + else if ((arglen > 3) && strcEQn(arg, "dc:", 3)) { +#ifdef HAVE_DISTCACHE + mc->nSessionCacheMode = SSL_SCMODE_DC; + mc->szSessionCacheDataFile = apr_psprintf(mc->pPool, "%s", arg+3); + if (!mc->szSessionCacheDataFile) { + return apr_psprintf(cmd->pool, + "SSLSessionCache: Invalid cache file path %s", + arg+3); + } +#else + return apr_psprintf(cmd->pool, + "SSLSessionCache: distcache support disabled"); +#endif + } else if ((arglen > 6) && strcEQn(arg, "shmht:", 6)) { #if !APR_HAS_SHARED_MEMORY return MODSSL_NO_SHARED_MEMORY_ERROR; diff -urN httpd-2.0.52/modules/ssl/ssl_scache.c httpd-2.0.52-patched/modules/ssl/ssl_scache.c --- httpd-2.0.52/modules/ssl/ssl_scache.c 2004-02-09 15:53:20.000000000 -0500 +++ httpd-2.0.52-patched/modules/ssl/ssl_scache.c 2004-10-19 21:37:26.000000000 -0400 @@ -53,6 +53,10 @@ if (mc->nSessionCacheMode == SSL_SCMODE_DBM) ssl_scache_dbm_init(s, p); +#ifdef HAVE_DISTCACHE + else if (mc->nSessionCacheMode == SSL_SCMODE_DC) + ssl_scache_dc_init(s, p); +#endif else if ((mc->nSessionCacheMode == SSL_SCMODE_SHMHT) || (mc->nSessionCacheMode == SSL_SCMODE_SHMCB)) { void *data; @@ -77,6 +81,10 @@ if (mc->nSessionCacheMode == SSL_SCMODE_DBM) ssl_scache_dbm_kill(s); +#ifdef HAVE_DISTCACHE + else if (mc->nSessionCacheMode == SSL_SCMODE_DC) + ssl_scache_dc_kill(s); +#endif else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) ssl_scache_shmht_kill(s); else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) @@ -91,6 +99,10 @@ if (mc->nSessionCacheMode == SSL_SCMODE_DBM) rv = ssl_scache_dbm_store(s, id, idlen, expiry, sess); +#ifdef HAVE_DISTCACHE + else if (mc->nSessionCacheMode == SSL_SCMODE_DC) + rv = ssl_scache_dc_store(s, id, idlen, expiry, sess); +#endif else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) rv = ssl_scache_shmht_store(s, id, idlen, expiry, sess); else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) @@ -105,6 +117,10 @@ if (mc->nSessionCacheMode == SSL_SCMODE_DBM) sess = ssl_scache_dbm_retrieve(s, id, idlen); +#ifdef HAVE_DISTCACHE + else if (mc->nSessionCacheMode == SSL_SCMODE_DC) + sess = ssl_scache_dc_retrieve(s, id, idlen); +#endif else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) sess = ssl_scache_shmht_retrieve(s, id, idlen); else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) @@ -118,6 +134,10 @@ if (mc->nSessionCacheMode == SSL_SCMODE_DBM) ssl_scache_dbm_remove(s, id, idlen); +#ifdef HAVE_DISTCACHE + else if (mc->nSessionCacheMode == SSL_SCMODE_DC) + ssl_scache_dc_remove(s, id, idlen); +#endif else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) ssl_scache_shmht_remove(s, id, idlen); else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) @@ -131,6 +151,10 @@ if (mc->nSessionCacheMode == SSL_SCMODE_DBM) ssl_scache_dbm_status(s, p, func, arg); +#ifdef HAVE_DISTCACHE + else if (mc->nSessionCacheMode == SSL_SCMODE_DC) + ssl_scache_dc_status(s, p, func, arg); +#endif else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) ssl_scache_shmht_status(s, p, func, arg); else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) @@ -144,6 +168,10 @@ if (mc->nSessionCacheMode == SSL_SCMODE_DBM) ssl_scache_dbm_expire(s); +#ifdef HAVE_DISTCACHE + else if (mc->nSessionCacheMode == SSL_SCMODE_DC) + ssl_scache_dc_expire(s); +#endif else if (mc->nSessionCacheMode == SSL_SCMODE_SHMHT) ssl_scache_shmht_expire(s); else if (mc->nSessionCacheMode == SSL_SCMODE_SHMCB) diff -urN httpd-2.0.52/modules/ssl/ssl_scache_dc.c httpd-2.0.52-patched/modules/ssl/ssl_scache_dc.c --- httpd-2.0.52/modules/ssl/ssl_scache_dc.c 1969-12-31 19:00:00.000000000 -0500 +++ httpd-2.0.52-patched/modules/ssl/ssl_scache_dc.c 2004-10-19 21:37:26.000000000 -0400 @@ -0,0 +1,185 @@ +/* _ _ +** _ __ ___ ___ __| | ___ ___| | mod_ssl +** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL +** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org +** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org +** |_____| +** ssl_scache_dc.c +** Distributed Session Cache (client support) +*/ + +/* ==================================================================== + * THIS SOFTWARE IS PROVIDED BY GEOFF THORPE ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR + * HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + */ + +#include "mod_ssl.h" + +/* Only build this code if it's enabled at configure-time. */ +#ifdef HAVE_DISTCACHE + +#include "distcache/dc_client.h" + +#if !defined(DISTCACHE_CLIENT_API) || (DISTCACHE_CLIENT_API < 0x0001) +#error "You must compile with a more recent version of the distcache-base package" +#endif + +/* + * This cache implementation allows modssl to access 'distcache' servers (or + * proxies) to facilitate distributed session caching. It is based on code + * released as open source by Cryptographic Appliances Inc, and was developed by + * Geoff Thorpe, Steve Robb, and Chris Zimmerman. + */ + +/* +** +** High-Level "handlers" as per ssl_scache.c +** +*/ + +void ssl_scache_dc_init(server_rec *s, apr_pool_t *p) +{ + DC_CTX *ctx; + SSLModConfigRec *mc = myModConfig(s); + /* + * Create a session context + */ + if(mc->szSessionCacheDataFile == NULL) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "SSLSessionCache required"); + ssl_die(); + } +#if 0 + /* If a "persistent connection" mode of operation is preferred, you *must* + * also use the PIDCHECK flag to ensure fork()'d processes don't interlace + * comms on the same connection as each other. */ +#define SESSION_CTX_FLAGS SESSION_CTX_FLAG_PERSISTENT | \ + SESSION_CTX_FLAG_PERSISTENT_PIDCHECK | \ + SESSION_CTX_FLAG_PERSISTENT_RETRY | \ + SESSION_CTX_FLAG_PERSISTENT_LATE +#else + /* This mode of operation will open a temporary connection to the 'target' + * for each cache operation - this makes it safe against fork() + * automatically. This mode is preferred when running a local proxy (over + * unix domain sockets) because overhead is negligable and it reduces the + * performance/stability danger of file-descriptor bloatage. */ +#define SESSION_CTX_FLAGS 0 +#endif + ctx = DC_CTX_new(mc->szSessionCacheDataFile, SESSION_CTX_FLAGS); + if(!ctx) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "distributed scache failed to obtain context"); + ssl_die(); + } + ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "distributed scache context initialised"); + /* + * Success ... we hack the context into place by cheating for now and + * stealing a member variable the original shared memory cache was using. + * :-) + */ + mc->tSessionCacheDataTable = (table_t *) ctx; + return; +} + +void ssl_scache_dc_kill(server_rec *s) +{ + SSLModConfigRec *mc = myModConfig(s); + + if(mc->tSessionCacheDataTable) + DC_CTX_free((DC_CTX *)mc->tSessionCacheDataTable); + mc->tSessionCacheDataTable = NULL; +} + +BOOL ssl_scache_dc_store(server_rec *s, UCHAR *id, int idlen, + time_t timeout, SSL_SESSION * pSession) +{ + unsigned char der[SSL_SESSION_MAX_DER]; + int der_len; + unsigned char *pder = der; + SSLModConfigRec *mc = myModConfig(s); + DC_CTX *ctx = (DC_CTX *)mc->tSessionCacheDataTable; + + /* Serialise the SSL_SESSION object */ + if((der_len = i2d_SSL_SESSION(pSession, NULL)) > SSL_SESSION_MAX_DER) + return FALSE; + i2d_SSL_SESSION(pSession, &pder); + /* !@#$%^ - why do we deal with *absolute* time anyway??? */ + timeout -= time(NULL); + /* Send the serialised session to the distributed cache context */ + if(!DC_CTX_add_session(ctx, id, idlen, der, der_len, + (unsigned long)timeout * 1000)) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "distributed scache 'add_session' failed"); + return FALSE; + } + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "distributed scache 'add_session' successful"); + return TRUE; +} + +SSL_SESSION *ssl_scache_dc_retrieve(server_rec *s, UCHAR *id, int idlen) +{ + unsigned char der[SSL_SESSION_MAX_DER]; + unsigned int der_len; + SSL_SESSION *pSession; + unsigned char *pder = der; + SSLModConfigRec *mc = myModConfig(s); + DC_CTX *ctx = (DC_CTX *)mc->tSessionCacheDataTable; + + /* Retrieve any corresponding session from the distributed cache context */ + if(!DC_CTX_get_session(ctx, id, idlen, der, SSL_SESSION_MAX_DER, + &der_len)) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "distributed scache 'get_session' MISS"); + return NULL; + } + if(der_len > SSL_SESSION_MAX_DER) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "distributed scache 'get_session' OVERFLOW"); + return NULL; + } + pSession = d2i_SSL_SESSION(NULL, &pder, der_len); + if(!pSession) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "distributed scache 'get_session' CORRUPT"); + return NULL; + } + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "distributed scache 'get_session' HIT"); + return pSession; +} + +void ssl_scache_dc_remove(server_rec *s, UCHAR *id, int idlen) +{ + SSLModConfigRec *mc = myModConfig(s); + DC_CTX *ctx = (DC_CTX *)mc->tSessionCacheDataTable; + + /* Remove any corresponding session from the distributed cache context */ + if(!DC_CTX_remove_session(ctx, id, idlen)) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "distributed scache 'remove_session' MISS"); + } else { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "distributed scache 'remove_session' HIT"); + } +} + +void ssl_scache_dc_expire(server_rec *s) +{ + /* NOP */ + return; +} + +void ssl_scache_dc_status(server_rec *s, apr_pool_t *p, + void (*func) (char *, void *), void *arg) +{ + SSLModConfigRec *mc = myModConfig(s); + + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "distributed scache 'ssl_scache_dc_status'"); + func(apr_psprintf(p, "cache type: <b>DC (Distributed Cache)</b>, target: <b>%s</b><br>", + mc->szSessionCacheDataFile), arg); +} + +#endif + Index: README =================================================================== RCS file: /cvsroot/distcache/distcache-httpd-2/README,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- README 4 Nov 2003 23:33:27 -0000 1.17 +++ README 20 Oct 2004 01:47:01 -0000 1.18 @@ -1,8 +1,8 @@ _ _ _ - __| |o ___ __| |__ ___ __ _ ___| |__ ___ distcache-httpd-2.0.48-1 + __| |o ___ __| |__ ___ __ _ ___| |__ ___ distcache-httpd-2.0.52-1 / _` |_/ __|__ __/ __|/ _` |/ __| '_ \ / , \ Distributed session caching -| (_| | \__ \ | | | (__| (_| | (__| | | | __/ (support for Apache 2.0.48) +| (_| | \__ \ | | | (__| (_| | (__| | | | __/ (support for Apache 2.0.52) \__,_|_|___/ |_| \___|\__,_|\___|_| |_|\___| distcache.sourceforge.net ------------------------------------------------------------------------------- @@ -17,7 +17,7 @@ ------------ This package is merely a placeholder for the patchfile used to provide -'distcache' support to Apache 2 (specifically, version 2.0.48). This package is +'distcache' support to Apache 2 (specifically, version 2.0.52). This package is released under the LGPL ("Lesser GNU Public License"). However, a special exemption is granted to the Apache Software Foundation (ASF) if they wish to incorporate this code into the Apache 2 distribution (and any versions @@ -35,16 +35,16 @@ There are two distinct steps involved in incorporating this code into Apache 2. The first step is to patch the Apache 2 source code - this is performed by way -of the "httpd-2.0.48-patch.diff" patch file in this package. As this patches +of the "httpd-2.0.52-patch.diff" patch file in this package. As this patches various files that are used by "configure" (in fact, it patches the "configure" script too!) it is advised to apply this patch file on a clean *untouched* -2.0.48 source tree. Ie. +2.0.52 source tree. Ie. - [bob@wherever ~] $ tar zxf distcache-httpd-2.0.48-1.tar.gz - [bob@wherever ~] $ tar zxf httpd-2.0.48.tar.gz - [bob@wherever ~] $ cd httpd-2.0.48 - [bob@wherever ~/httpd-2.0.48] $ patch \ - -p1 < ../distcache-httpd-2.0.48-1/httpd-2.0.48-patch.diff + [bob@wherever ~] $ tar zxf distcache-httpd-2.0.52-1.tar.gz + [bob@wherever ~] $ tar zxf httpd-2.0.52.tar.gz + [bob@wherever ~] $ cd httpd-2.0.52 + [bob@wherever ~/httpd-2.0.52] $ patch \ + -p1 < ../distcache-httpd-2.0.52-1/httpd-2.0.52-patch.diff The result is a Apache 2 source tree with the necessary source changes to be able to support the 'distcache' distributed session caching framework. @@ -71,7 +71,7 @@ command-line switch to enable distcache; -- normal non-distache apache 2 configuration line -- - [bob@wherever ~/httpd-2.0.48] $ ./configure \ + [bob@wherever ~/httpd-2.0.52] $ ./configure \ --enable-ssl --enable-distcache [...] However, if the installation of distcache is not in a standard location (eg. if @@ -81,7 +81,7 @@ configuring distcache; -- distache-enabled apache 2 configuration line -- - [bob@wherever ~/httpd-2.0.48] $ CPPFLAGS="-I/home/bob/include" \ + [bob@wherever ~/httpd-2.0.52] $ CPPFLAGS="-I/home/bob/include" \ LDFLAGS="-L/home/bob/lib" \ ./configure --enable-ssl --enable-distcache [...] @@ -124,6 +124,12 @@ http://www.distcache.org/. Feedback and contributions are always welcome, of course :-). +Changes between 2.0.48-1 and 2.0.52-1 +------------------------------------- + + *) Update the patch to support Apache httpd 2.0.52. + [Geoff Thorpe] + Changes between 2.0.45-1 and 2.0.48-1 ------------------------------------- --- httpd-2.0.48-patch.diff DELETED --- |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-06-29 20:41:20
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12195 Modified Files: pong.c Log Message: Fix up nal_pong. It's slightly less "flexible", but more practical and in fact works properly. Index: pong.c =================================================================== RCS file: /cvsroot/distcache/distcache/test/pong.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pong.c 2 Jun 2004 17:46:25 -0000 1.2 +++ pong.c 29 Jun 2004 20:41:08 -0000 1.3 @@ -26,6 +26,9 @@ #include "timing.h" #include <libsys/post.h> +/* To debug each request/response, define this */ +/* #define DEBUG_PONG */ + typedef enum { NET_NULL, NET_CLIENT, @@ -39,8 +42,8 @@ #define DEF_NUM_CONNS 1 #define DEF_REQUEST 10 #define DEF_RESPONSE 1024 -#define DEF_LOOP 1 #define DEF_REPEAT 10 +#define DEF_WINDOW 1 #define DEF_UNITS UNITS_bits #ifdef SUPPORT_UPDATE @@ -50,15 +53,14 @@ static void usage(void) { SYS_fprintf(SYS_stderr, -"Usage: nal_ping [options ...] < [ -connect | -accept ] address >\n" +"Usage: nal_pong [options ...] < [ -connect | -accept ] address >\n" "where options include;\n" " -num <num> - default=%d\n" " -request <num> - default=%d\n" " -response <num> - default=%d\n" -" -loop <num> - default=%d\n" " -repeat <num> - default=%d\n" -" -reverse\n", -DEF_NUM_CONNS, DEF_REQUEST, DEF_RESPONSE, DEF_LOOP, DEF_REPEAT); +" -window <num> - default=%d\n", +DEF_NUM_CONNS, DEF_REQUEST, DEF_RESPONSE, DEF_REPEAT, DEF_WINDOW); #ifdef SUPPORT_UPDATE SYS_fprintf(SYS_stderr, " -update <secs> - default=<none>\n" @@ -67,17 +69,6 @@ "An optional prefix can scale to kilo, mega, or giga bits/bytes.\n", UNITS2STR(DEF_UNITS)); #endif - SYS_fprintf(SYS_stderr, -"Using -loop allows requests/responses to be repeated over the same\n" -"connection, whereas -repeat indicates how many times a connection\n" -"should be reopened. The network server (-accept) must have a loop\n" -"value matching the client, however -repeat is ignored and -num is\n" -"only used as a maximum (it will not accept more than -num connections\n" -"at a time).\n"); - SYS_fprintf(SYS_stderr, -"When using -connect (ie. network client), it is assumed we send the\n" -"the request and then read the response. With -accept, the converse\n" -"is assumed. Specifying -reverse can invert the request/response roles.\n"); } static int util_parsenum(const char *s, unsigned int *num) @@ -114,21 +105,23 @@ /* Fixed context data */ const NAL_ADDRESS *addr; NAL_SELECTOR *sel; - int id, requestor; - unsigned int num_loop, num_repeat, size_request, size_response; + int id; + unsigned int num_repeat, size_request, size_response, window; NET_MODE mode; /* State */ - int step, done; + int done; NAL_CONNECTION *conn; - unsigned int loop, repeat, step_offset; + unsigned int num_sent, num_received; } pongctx; static int pongctx_io(pongctx *ctx); +static int pongctx_postio_client(pongctx *ctx); +static int pongctx_postio_server(pongctx *ctx); static pongctx *pongctx_new(const NAL_ADDRESS *addr, NAL_SELECTOR *sel, int id, - int requestor, unsigned int num_loop, - unsigned int num_repeat, unsigned int size_request, - unsigned int size_response, NET_MODE mode) + unsigned int num_repeat, unsigned int size_request, + unsigned int size_response, unsigned int window, + NET_MODE mode) { pongctx *ret = SYS_malloc(pongctx, 1); if(!ret) goto err; @@ -138,19 +131,18 @@ ret->addr = addr; ret->sel = sel; ret->id = id; - ret->requestor = requestor; - ret->num_loop = num_loop; ret->num_repeat = num_repeat; ret->size_request = size_request; ret->size_response = size_response; + ret->window = window; ret->mode = mode; /* state */ - ret->step = ret->done = 0; - ret->loop = ret->repeat = ret->step_offset = 0; + ret->done = 0; + ret->num_sent = ret->num_received = 0; if((mode == NET_CLIENT) && (!NAL_CONNECTION_create(ret->conn, addr) || !NAL_CONNECTION_add_to_selector(ret->conn, sel))) goto err; - if((mode == NET_CLIENT) && (pongctx_io(ret) < 0)) goto err; + if((mode == NET_CLIENT) && (pongctx_postio_client(ret) < 0)) goto err; return ret; err: if(ret) { @@ -166,104 +158,117 @@ SYS_free(pongctx, ctx); } +static int pongctx_postio_client(pongctx *ctx) +{ + int num, ret = 0; + NAL_BUFFER *b_read = NAL_CONNECTION_get_read(ctx->conn); + NAL_BUFFER *b_send = NAL_CONNECTION_get_send(ctx->conn); + /* Consume responses */ + num = NAL_BUFFER_used(b_read) / ctx->size_response; + if(num > 0) { + unsigned int foo = NAL_BUFFER_read(b_read, NULL, + num * ctx->size_response); + assert(foo == num * ctx->size_response); + ctx->num_received += num; + ret += foo; +#ifdef DEBUG_PONG + SYS_fprintf(SYS_stderr, "consuming %d responses -> %d\n", + num, ctx->num_received); +#endif + } + /* Produce requests */ + num = NAL_BUFFER_unused(b_send) / ctx->size_request; + /* limit by repeat and window */ + if((ctx->num_sent + num) > ctx->num_repeat) + num = ctx->num_repeat - ctx->num_sent; + if((ctx->num_sent + num) > (ctx->num_received + ctx->window)) + num = ctx->num_received + ctx->window - ctx->num_sent; +#ifdef DEBUG_PONG + if(num > 0) + SYS_fprintf(SYS_stderr, "producing %d requests -> %d\n", + num, ctx->num_sent + num); +#endif + while(num-- > 0) { + unsigned int foo = NAL_BUFFER_write(b_send, garbage, + ctx->size_request); + assert(foo == ctx->size_request); + ctx->num_sent++; + ret += ctx->size_request; + } + if((ctx->num_received == ctx->num_repeat) && NAL_BUFFER_empty(b_send)) { +#ifdef DEBUG_PONG + SYS_fprintf(SYS_stderr, "Done\n"); +#endif + NAL_CONNECTION_reset(ctx->conn); + ctx->done = 1; + } + return ret; +} + +static int pongctx_postio_server(pongctx *ctx) +{ + int num, ret = 0; + NAL_BUFFER *b_read = NAL_CONNECTION_get_read(ctx->conn); + NAL_BUFFER *b_send = NAL_CONNECTION_get_send(ctx->conn); + /* Consume requests */ + num = NAL_BUFFER_used(b_read) / ctx->size_request; + if(num > 0) { + unsigned int foo = NAL_BUFFER_read(b_read, NULL, + num * ctx->size_request); + assert(foo == num * ctx->size_request); + ctx->num_received += num; + ret += foo; +#ifdef DEBUG_PONG + SYS_fprintf(SYS_stderr, "consuming %d requests -> %d\n", + num, ctx->num_received); +#endif + } + /* Produce responses */ + num = NAL_BUFFER_unused(b_send) / ctx->size_response; + /* limit by received */ + if((ctx->num_sent + num) > ctx->num_received) + num = ctx->num_received - ctx->num_sent; +#ifdef DEBUG_PONG + if(num > 0) + SYS_fprintf(SYS_stderr, "producing %d responses -> %d\n", + num, ctx->num_sent + num); +#endif + while(num-- > 0) { + unsigned int foo = NAL_BUFFER_write(b_send, garbage, + ctx->size_response); + assert(foo == ctx->size_response); + ctx->num_sent++; + ret += ctx->size_response; + } + return ret; +} + /* returns -1 for error, or the amount of data read+written */ static int pongctx_io(pongctx *ctx) { - int ret = 0; if(ctx->done) { assert(ctx->mode == NET_CLIENT); - return ret; + return 0; } if(!NAL_CONNECTION_io(ctx->conn)) { if(!NAL_CONNECTION_is_established(ctx->conn)) SYS_fprintf(SYS_stderr, "(%d) Connection failed\n", ctx->id); - else + else { SYS_fprintf(SYS_stderr, "(%d) Disconnection\n", ctx->id); + if(ctx->mode == NET_SERVER) { + NAL_CONNECTION_reset(ctx->conn); + ctx->done = 1; + return 0; + } + } return -1; } /* handle non-blocking connects */ - if(!NAL_CONNECTION_is_established(ctx->conn)) return ret; + if(!NAL_CONNECTION_is_established(ctx->conn)) return 0; /* post-processing */ -post_processing: - if(ctx->requestor) { - /* Requestor */ - if(!ctx->step) { - /* Send the request */ - unsigned int num_sent = NAL_BUFFER_write( - NAL_CONNECTION_get_send(ctx->conn), garbage, - ctx->size_request - ctx->step_offset); - ctx->step_offset += num_sent; - ret += num_sent; - if(ctx->step_offset == ctx->size_request) { - ctx->step = 1; - ctx->step_offset = 0; - } else - return ret; - } - if(ctx->step) { - /* Read the response */ - unsigned int num_read = NAL_BUFFER_read( - NAL_CONNECTION_get_read(ctx->conn), NULL, - ctx->size_response - ctx->step_offset); - ctx->step_offset += num_read; - ret += num_read; - if(ctx->step_offset == ctx->size_response) - goto moveon; - return ret; - } - } else { - /* Responder */ - if(!ctx->step) { - /* Read the request */ - unsigned int num_read = NAL_BUFFER_read( - NAL_CONNECTION_get_read(ctx->conn), NULL, - ctx->size_request - ctx->step_offset); - ctx->step_offset += num_read; - ret += num_read; - if(ctx->step_offset == ctx->size_request) { - ctx->step = 1; - ctx->step_offset = 0; - } else - return ret; - } - if(ctx->step == 1) { - /* Write the response */ - unsigned int num_sent = NAL_BUFFER_write( - NAL_CONNECTION_get_send(ctx->conn), garbage, - ctx->size_response - ctx->step_offset); - ctx->step_offset += num_sent; - ret += num_sent; - if(ctx->step_offset == ctx->size_response) - ctx->step = 2; - else - return ret; - } - assert(ctx->step == 2); - /* Wait for the outgoing buffer to empty */ - if(NAL_BUFFER_empty(NAL_CONNECTION_get_send(ctx->conn))) - goto moveon; - return ret; - } -moveon: - ctx->step = 0; - ctx->step_offset = 0; - if(++ctx->loop < ctx->num_loop) - /* A new transaction on the same conn */ - goto post_processing; - /* We close the connection */ - ctx->loop = 0; - NAL_CONNECTION_reset(ctx->conn); - /* For a server, we're "done". For a client, we're done if we've - * finished repeating. */ - if((ctx->mode == NET_SERVER) || (++ctx->repeat == ctx->num_repeat)) { - ctx->done = 1; - return ret; - } - /* Reconnect the client */ - if(!NAL_CONNECTION_create(ctx->conn, ctx->addr) || - !NAL_CONNECTION_add_to_selector(ctx->conn, ctx->sel)) - return -1; - goto post_processing; + if(ctx->mode == NET_CLIENT) + return pongctx_postio_client(ctx); + return pongctx_postio_server(ctx); } #define ARG_INC do {argc--;argv++;} while(0) @@ -277,14 +282,13 @@ int tmp, ret = 1; unsigned int loop, loop_limit; pongctx **ctx; - int requestor, reverse = 0; const char *str_addr = NULL; NET_MODE mode = NET_NULL; unsigned int num_conns = DEF_NUM_CONNS; unsigned int size_request = DEF_REQUEST; unsigned int size_response = DEF_RESPONSE; - unsigned int num_loop = DEF_LOOP; unsigned int num_repeat = DEF_REPEAT; + unsigned int window = DEF_WINDOW; NAL_ADDRESS *addr; NAL_SELECTOR *sel; NAL_LISTENER *listener = NULL; @@ -331,16 +335,14 @@ ARG_CHECK("-response"); if(!util_parsenum(*argv, &size_response)) return 1; - } else if(strcmp(*argv, "-loop") == 0) { - ARG_CHECK("-loop"); - if(!util_parsenum(*argv, &num_loop)) - return 1; } else if(strcmp(*argv, "-repeat") == 0) { ARG_CHECK("-repeat"); if(!util_parsenum(*argv, &num_repeat)) return 1; - } else if(strcmp(*argv, "-reverse") == 0) { - reverse = 1; + } else if(strcmp(*argv, "-window") == 0) { + ARG_CHECK("-window"); + if(!util_parsenum(*argv, &window)) + return 1; #ifdef SUPPORT_UPDATE } else if(strcmp(*argv, "-update") == 0) { ARG_CHECK("-update"); @@ -364,12 +366,12 @@ SYS_fprintf(SYS_stderr, "Error, -request or -response out of range\n"); return 1; } - requestor = ((mode == NET_SERVER) ? 0 : 1); - if(reverse) requestor = !requestor; - loop_limit = (mode == NET_SERVER ? 0 : num_conns); + /* Create garbage data */ srand(time(NULL)); for(loop = 0; loop < MAX_SIZE; loop += sizeof(int)) *((int *)(garbage + loop)) = rand(); + /* Initialise */ + loop_limit = ((mode == NET_SERVER) ? 0 : num_conns); SYS_sigpipe_ignore(); if((ctx = SYS_malloc(pongctx*, num_conns)) == NULL) abort(); addr = NAL_ADDRESS_new(); @@ -383,8 +385,8 @@ abort(); } for(loop = 0; loop < num_conns; loop++) - if((ctx[loop] = pongctx_new(addr, sel, loop, requestor, num_loop, - num_repeat, size_request, size_response, + if((ctx[loop] = pongctx_new(addr, sel, loop, num_repeat, + size_request, size_response, window, mode)) == NULL) abort(); #ifdef SUPPORT_UPDATE @@ -396,10 +398,7 @@ "\n" "Note, '-update' statistics have accurate timing but the traffic measurements\n" "are based on transfers between user-space fifo buffers. As such, they should\n" -"only be considered accurate \"on average\". Also, the traffic measured is\n" -"two-way, identical traffic is passing in both directions so you can consider\n" -"each direction to be half the advertised throughput value. (We measure receive\n" -"data and double it.)\n" +"only be considered accurate \"on average\".\n" "\n"); } #endif @@ -413,15 +412,14 @@ if((mode == NET_SERVER) && (loop_limit < num_conns) && NAL_CONNECTION_accept(ctx[loop_limit]->conn, listener)) { + SYS_fprintf(SYS_stderr, "(%d) Connection\n", + ctx[loop_limit]->id); if(!NAL_CONNECTION_add_to_selector(ctx[loop_limit]->conn, sel)) abort(); - ctx[loop_limit]->step = 0; ctx[loop_limit]->done = 0; - ctx[loop_limit]->loop = 0; - ctx[loop_limit]->repeat = 0; - ctx[loop_limit]->step_offset = 0; - if(pongctx_io(ctx[loop_limit]) < 0) goto err; + ctx[loop_limit]->num_sent = 0; + ctx[loop_limit]->num_received = 0; if(++loop_limit == num_conns) NAL_LISTENER_del_from_selector(listener); } |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-06-11 16:09:39
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10430 Modified Files: echo.c Log Message: The default for the server should be higher so that "cropping" of incoming connects only occurs, by default, if making more than 512 connections at a time. Index: echo.c =================================================================== RCS file: /cvsroot/distcache/distcache/test/echo.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- echo.c 20 May 2004 19:19:41 -0000 1.15 +++ echo.c 11 Jun 2004 16:09:29 -0000 1.16 @@ -40,7 +40,7 @@ #define DEF_SERVER_ADDRESS "UNIX:/tmp/foo" #define BUFFER_SIZE (32*1024) -#define MAX_CONNS 64 +#define MAX_CONNS 512 #define DEF_UNITS UNITS_bits #ifdef SUPPORT_UPDATE |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-06-03 03:18:53
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25111 Modified Files: hose.c Log Message: As if the test/nal_* namespace wasn't already muddled enough, Steve noticed this :-) Index: hose.c =================================================================== RCS file: /cvsroot/distcache/distcache/test/hose.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- hose.c 20 May 2004 18:45:01 -0000 1.2 +++ hose.c 3 Jun 2004 03:18:44 -0000 1.3 @@ -36,7 +36,7 @@ static void usage(void) { SYS_fprintf(SYS_stderr, -"Usage: nal_host [options ...]\n" +"Usage: nal_hose [options ...]\n" "where options include;\n" " -connect <addr> - default='%s'\n" " -num <num> - default=%d\n" |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-06-02 17:46:39
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9731 Modified Files: pong.c Log Message: This code was copied from ping.c, but ping was counting traffic in one direction only then doubling it for the total. pong already counts traffic in both directions (which may be unbalanced), so it shouldn't double. Index: pong.c =================================================================== RCS file: /cvsroot/distcache/distcache/test/pong.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- pong.c 27 May 2004 19:03:02 -0000 1.1 +++ pong.c 2 Jun 2004 17:46:25 -0000 1.2 @@ -461,7 +461,7 @@ /* Convert bytes to the required double */ rate = util_tounits(traffic, units); /* Adjust according to milli-seconds (and duplexity) */ - rate = 2000.0 * rate / (double)msecs; + rate = 1000.0 * rate / (double)msecs; SYS_fprintf(SYS_stdout, "Update: %ld msecs elapsed, %.2f %s/s, " "%.1f%% user, %.1f%% kernel\n", msecs, rate, UNITS2STR(units), (100.0 * muser)/((float)msecs), |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-06-02 17:43:28
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9168 Modified Files: configure.ac Log Message: I hope this might go some way to stopping weird "oh look I have an ancient version of autoconf" bugs when configuring and building on older systems. Index: configure.ac =================================================================== RCS file: /cvsroot/distcache/distcache/configure.ac,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- configure.ac 7 May 2004 18:59:17 -0000 1.51 +++ configure.ac 2 Jun 2004 17:43:18 -0000 1.52 @@ -1,6 +1,9 @@ # Process this file with autoconf to produce a configure script. AC_INIT(distcache, 1.5.1dev, dis...@li...) +WANT_AUTOCONF=2.5 +WANT_AUTOMAKE=1.8 + echo "" echo "---------------------------------------------" echo "Configuring Distcache libraries and utilities" |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-05-27 19:03:13
|
Update of /cvsroot/distcache/distcache/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30710/test Modified Files: .cvsignore Makefile.am Added Files: pong.c Log Message: Yet another libnal testing tool. --- NEW FILE: pong.c --- /* distcache, Distributed Session Caching technology * Copyright (C) 2000-2003 Geoff Thorpe, and Cryptographic Appliances, Inc. * Copyright (C) 2004 The Distcache.org project * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; using version 2.1 of the License. The copyright holders * may elect to allow the application of later versions of the License to this * software, please contact the author (ge...@di...) if you wish us to * review any later version released by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define SYS_GENERATING_EXE #include <libsys/pre.h> #include <libnal/nal.h> #include "timing.h" #include <libsys/post.h> typedef enum { NET_NULL, NET_CLIENT, NET_SERVER } NET_MODE; #define MAX_SIZE (32*1024) #define MIN_REQUEST 1 #define MIN_RESPONSE 1 #define BUFFER_SIZE MAX_SIZE #define DEF_NUM_CONNS 1 #define DEF_REQUEST 10 #define DEF_RESPONSE 1024 #define DEF_LOOP 1 #define DEF_REPEAT 10 #define DEF_UNITS UNITS_bits #ifdef SUPPORT_UPDATE IMPLEMENT_UNITS() #endif static void usage(void) { SYS_fprintf(SYS_stderr, "Usage: nal_ping [options ...] < [ -connect | -accept ] address >\n" "where options include;\n" " -num <num> - default=%d\n" " -request <num> - default=%d\n" " -response <num> - default=%d\n" " -loop <num> - default=%d\n" " -repeat <num> - default=%d\n" " -reverse\n", DEF_NUM_CONNS, DEF_REQUEST, DEF_RESPONSE, DEF_LOOP, DEF_REPEAT); #ifdef SUPPORT_UPDATE SYS_fprintf(SYS_stderr, " -update <secs> - default=<none>\n" " -units [k|m|g]<b|B> - default='%s'\n" "'units' displays traffic rates as bits or bytes per second.\n" "An optional prefix can scale to kilo, mega, or giga bits/bytes.\n", UNITS2STR(DEF_UNITS)); #endif SYS_fprintf(SYS_stderr, "Using -loop allows requests/responses to be repeated over the same\n" "connection, whereas -repeat indicates how many times a connection\n" "should be reopened. The network server (-accept) must have a loop\n" "value matching the client, however -repeat is ignored and -num is\n" "only used as a maximum (it will not accept more than -num connections\n" "at a time).\n"); SYS_fprintf(SYS_stderr, "When using -connect (ie. network client), it is assumed we send the\n" "the request and then read the response. With -accept, the converse\n" "is assumed. Specifying -reverse can invert the request/response roles.\n"); } static int util_parsenum(const char *s, unsigned int *num) { char *endptr; unsigned long int val; val = strtoul(s, &endptr, 10); if((val == ULONG_MAX) || !endptr || (*endptr != '\0')) { SYS_fprintf(SYS_stderr, "Error, bad number '%s'\n", s); return 0; } *num = val; return 1; } static int err_noarg(const char *s) { SYS_fprintf(SYS_stderr, "Error: missing argument for '%s'\n", s); usage(); return 1; } static int err_unknown(const char *s) { SYS_fprintf(SYS_stderr, "Error: unknown switch '%s'\n", s); usage(); return 1; } /* Static data for use in reading/writing (initialised in main()) */ static unsigned char garbage[MAX_SIZE]; typedef struct st_pongctx { /* Fixed context data */ const NAL_ADDRESS *addr; NAL_SELECTOR *sel; int id, requestor; unsigned int num_loop, num_repeat, size_request, size_response; NET_MODE mode; /* State */ int step, done; NAL_CONNECTION *conn; unsigned int loop, repeat, step_offset; } pongctx; static int pongctx_io(pongctx *ctx); static pongctx *pongctx_new(const NAL_ADDRESS *addr, NAL_SELECTOR *sel, int id, int requestor, unsigned int num_loop, unsigned int num_repeat, unsigned int size_request, unsigned int size_response, NET_MODE mode) { pongctx *ret = SYS_malloc(pongctx, 1); if(!ret) goto err; ret->conn = NAL_CONNECTION_new(); if(!ret->conn) goto err; /* Fixed data */ ret->addr = addr; ret->sel = sel; ret->id = id; ret->requestor = requestor; ret->num_loop = num_loop; ret->num_repeat = num_repeat; ret->size_request = size_request; ret->size_response = size_response; ret->mode = mode; /* state */ ret->step = ret->done = 0; ret->loop = ret->repeat = ret->step_offset = 0; if((mode == NET_CLIENT) && (!NAL_CONNECTION_create(ret->conn, addr) || !NAL_CONNECTION_add_to_selector(ret->conn, sel))) goto err; if((mode == NET_CLIENT) && (pongctx_io(ret) < 0)) goto err; return ret; err: if(ret) { if(ret->conn) NAL_CONNECTION_free(ret->conn); SYS_free(pongctx, ret); } return NULL; } static void pongctx_free(pongctx *ctx) { NAL_CONNECTION_free(ctx->conn); SYS_free(pongctx, ctx); } /* returns -1 for error, or the amount of data read+written */ static int pongctx_io(pongctx *ctx) { int ret = 0; if(ctx->done) { assert(ctx->mode == NET_CLIENT); return ret; } if(!NAL_CONNECTION_io(ctx->conn)) { if(!NAL_CONNECTION_is_established(ctx->conn)) SYS_fprintf(SYS_stderr, "(%d) Connection failed\n", ctx->id); else SYS_fprintf(SYS_stderr, "(%d) Disconnection\n", ctx->id); return -1; } /* handle non-blocking connects */ if(!NAL_CONNECTION_is_established(ctx->conn)) return ret; /* post-processing */ post_processing: if(ctx->requestor) { /* Requestor */ if(!ctx->step) { /* Send the request */ unsigned int num_sent = NAL_BUFFER_write( NAL_CONNECTION_get_send(ctx->conn), garbage, ctx->size_request - ctx->step_offset); ctx->step_offset += num_sent; ret += num_sent; if(ctx->step_offset == ctx->size_request) { ctx->step = 1; ctx->step_offset = 0; } else return ret; } if(ctx->step) { /* Read the response */ unsigned int num_read = NAL_BUFFER_read( NAL_CONNECTION_get_read(ctx->conn), NULL, ctx->size_response - ctx->step_offset); ctx->step_offset += num_read; ret += num_read; if(ctx->step_offset == ctx->size_response) goto moveon; return ret; } } else { /* Responder */ if(!ctx->step) { /* Read the request */ unsigned int num_read = NAL_BUFFER_read( NAL_CONNECTION_get_read(ctx->conn), NULL, ctx->size_request - ctx->step_offset); ctx->step_offset += num_read; ret += num_read; if(ctx->step_offset == ctx->size_request) { ctx->step = 1; ctx->step_offset = 0; } else return ret; } if(ctx->step == 1) { /* Write the response */ unsigned int num_sent = NAL_BUFFER_write( NAL_CONNECTION_get_send(ctx->conn), garbage, ctx->size_response - ctx->step_offset); ctx->step_offset += num_sent; ret += num_sent; if(ctx->step_offset == ctx->size_response) ctx->step = 2; else return ret; } assert(ctx->step == 2); /* Wait for the outgoing buffer to empty */ if(NAL_BUFFER_empty(NAL_CONNECTION_get_send(ctx->conn))) goto moveon; return ret; } moveon: ctx->step = 0; ctx->step_offset = 0; if(++ctx->loop < ctx->num_loop) /* A new transaction on the same conn */ goto post_processing; /* We close the connection */ ctx->loop = 0; NAL_CONNECTION_reset(ctx->conn); /* For a server, we're "done". For a client, we're done if we've * finished repeating. */ if((ctx->mode == NET_SERVER) || (++ctx->repeat == ctx->num_repeat)) { ctx->done = 1; return ret; } /* Reconnect the client */ if(!NAL_CONNECTION_create(ctx->conn, ctx->addr) || !NAL_CONNECTION_add_to_selector(ctx->conn, ctx->sel)) return -1; goto post_processing; } #define ARG_INC do {argc--;argv++;} while(0) #define ARG_CHECK(a) \ if(argc < 2) \ return err_noarg(a); \ ARG_INC int main(int argc, char *argv[]) { int tmp, ret = 1; unsigned int loop, loop_limit; pongctx **ctx; int requestor, reverse = 0; const char *str_addr = NULL; NET_MODE mode = NET_NULL; unsigned int num_conns = DEF_NUM_CONNS; unsigned int size_request = DEF_REQUEST; unsigned int size_response = DEF_RESPONSE; unsigned int num_loop = DEF_LOOP; unsigned int num_repeat = DEF_REPEAT; NAL_ADDRESS *addr; NAL_SELECTOR *sel; NAL_LISTENER *listener = NULL; #ifdef SUPPORT_UPDATE unsigned int update = 0; UNITS units = DEF_UNITS; /* Timing variables for '-update' */ /* initialising tt1 because gcc can't see that I don't need to */ time_t tt1 = 0, tt2; struct timeval tv1, tv2; struct rusage ru1, ru2; unsigned int traffic = 0; #endif ARG_INC; while(argc) { if(strcmp(*argv, "-connect") == 0) { ARG_CHECK("-connect"); if(mode != NET_NULL) { SYS_fprintf(SYS_stderr, "Error, -connect or " "-accept must be specified once only\n"); return 1; } mode = NET_CLIENT; str_addr = *argv; } else if(strcmp(*argv, "-accept") == 0) { ARG_CHECK("-accept"); if(mode != NET_NULL) { SYS_fprintf(SYS_stderr, "Error, -connect or " "-accept must be specified once only\n"); return 1; } mode = NET_SERVER; str_addr = *argv; } else if(strcmp(*argv, "-num") == 0) { ARG_CHECK("-num"); if(!util_parsenum(*argv, &num_conns)) return 1; } else if(strcmp(*argv, "-request") == 0) { ARG_CHECK("-request"); if(!util_parsenum(*argv, &size_request)) return 1; } else if(strcmp(*argv, "-response") == 0) { ARG_CHECK("-response"); if(!util_parsenum(*argv, &size_response)) return 1; } else if(strcmp(*argv, "-loop") == 0) { ARG_CHECK("-loop"); if(!util_parsenum(*argv, &num_loop)) return 1; } else if(strcmp(*argv, "-repeat") == 0) { ARG_CHECK("-repeat"); if(!util_parsenum(*argv, &num_repeat)) return 1; } else if(strcmp(*argv, "-reverse") == 0) { reverse = 1; #ifdef SUPPORT_UPDATE } else if(strcmp(*argv, "-update") == 0) { ARG_CHECK("-update"); if(!util_parsenum(*argv, &update)) return 1; } else if(strcmp(*argv, "-units") == 0) { ARG_CHECK("-units"); if(!util_parseunits(*argv, &units)) return 1; #endif } else return err_unknown(*argv); ARG_INC; } if(mode == NET_NULL) { SYS_fprintf(SYS_stderr, "Error, must specify -accept or -connect\n"); return 1; } if((size_request < MIN_REQUEST) || (size_response < MIN_RESPONSE) || (size_request > MAX_SIZE) || (size_response > MAX_SIZE)) { SYS_fprintf(SYS_stderr, "Error, -request or -response out of range\n"); return 1; } requestor = ((mode == NET_SERVER) ? 0 : 1); if(reverse) requestor = !requestor; loop_limit = (mode == NET_SERVER ? 0 : num_conns); srand(time(NULL)); for(loop = 0; loop < MAX_SIZE; loop += sizeof(int)) *((int *)(garbage + loop)) = rand(); SYS_sigpipe_ignore(); if((ctx = SYS_malloc(pongctx*, num_conns)) == NULL) abort(); addr = NAL_ADDRESS_new(); sel = NAL_SELECTOR_new(); if(!addr || !sel) abort(); if(!NAL_ADDRESS_create(addr, str_addr, BUFFER_SIZE)) abort(); if(mode == NET_SERVER) { if((listener = NAL_LISTENER_new()) == NULL) abort(); if(!NAL_LISTENER_create(listener, addr) || !NAL_LISTENER_add_to_selector(listener, sel)) abort(); } for(loop = 0; loop < num_conns; loop++) if((ctx[loop] = pongctx_new(addr, sel, loop, requestor, num_loop, num_repeat, size_request, size_response, mode)) == NULL) abort(); #ifdef SUPPORT_UPDATE if(update) { tt1 = time(NULL); SYS_gettime(&tv1); getrusage(RUSAGE_SELF, &ru1); SYS_fprintf(SYS_stderr, "\n" "Note, '-update' statistics have accurate timing but the traffic measurements\n" "are based on transfers between user-space fifo buffers. As such, they should\n" "only be considered accurate \"on average\". Also, the traffic measured is\n" "two-way, identical traffic is passing in both directions so you can consider\n" "each direction to be half the advertised throughput value. (We measure receive\n" "data and double it.)\n" "\n"); } #endif do { /* Select */ if((tmp = NAL_SELECTOR_select(sel, 0, 0)) <= 0) { SYS_fprintf(SYS_stderr, "Error, NAL_SELECTOR_select() " "returned <= 0\n"); goto err; } if((mode == NET_SERVER) && (loop_limit < num_conns) && NAL_CONNECTION_accept(ctx[loop_limit]->conn, listener)) { if(!NAL_CONNECTION_add_to_selector(ctx[loop_limit]->conn, sel)) abort(); ctx[loop_limit]->step = 0; ctx[loop_limit]->done = 0; ctx[loop_limit]->loop = 0; ctx[loop_limit]->repeat = 0; ctx[loop_limit]->step_offset = 0; if(pongctx_io(ctx[loop_limit]) < 0) goto err; if(++loop_limit == num_conns) NAL_LISTENER_del_from_selector(listener); } /* Post-process */ loop = 0; while(loop < loop_limit) { int res = pongctx_io(ctx[loop]); if(res < 0) goto err; traffic += res; if(ctx[loop]->done) { loop_limit--; /* Add the listener back? */ if((mode == NET_SERVER) && (loop_limit + 1 == num_conns) && !NAL_LISTENER_add_to_selector( listener, sel)) abort(); /* Swap the 'done' entry with the tail */ if(loop < loop_limit) { pongctx *foo = ctx[loop]; ctx[loop] = ctx[loop_limit]; ctx[loop_limit] = foo; } } else loop++; } #ifdef SUPPORT_UPDATE /* Check if an update is required */ if(update && ((tt2 = time(NULL)) >= (time_t)(tt1 + update))) { unsigned long msecs, muser, msys; double rate; SYS_gettime(&tv2); getrusage(RUSAGE_SELF, &ru2); msecs = SYS_msecs_between(&tv1, &tv2); muser = SYS_msecs_between(&ru1.ru_utime, &ru2.ru_utime); msys = SYS_msecs_between(&ru1.ru_stime, &ru2.ru_stime); /* Convert bytes to the required double */ rate = util_tounits(traffic, units); /* Adjust according to milli-seconds (and duplexity) */ rate = 2000.0 * rate / (double)msecs; SYS_fprintf(SYS_stdout, "Update: %ld msecs elapsed, %.2f %s/s, " "%.1f%% user, %.1f%% kernel\n", msecs, rate, UNITS2STR(units), (100.0 * muser)/((float)msecs), (100.0 * msys)/((float)msecs)); tt1 = tt2; SYS_timecpy(&tv1, &tv2); SYS_memcpy(struct rusage, &ru1, &ru2); traffic = 0; } #endif /* keep looping until the connections are done and the selector is * empty. This allows non-blocking closes to complete for libnal * implementations that support it. */ } while((mode == NET_SERVER) || loop_limit || NAL_SELECTOR_num_objects(sel)); /* Done */ ret = 0; err: for(loop = 0; loop < num_conns; loop++) pongctx_free(ctx[loop]); SYS_free(pongctx*, ctx); if(listener) NAL_LISTENER_free(listener); NAL_SELECTOR_free(sel); NAL_ADDRESS_free(addr); return ret; } Index: .cvsignore =================================================================== RCS file: /cvsroot/distcache/distcache/test/.cvsignore,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- .cvsignore 14 May 2004 22:35:11 -0000 1.6 +++ .cvsignore 27 May 2004 19:03:02 -0000 1.7 @@ -9,3 +9,4 @@ nal_echo nal_ping nal_hose +nal_pong Index: Makefile.am =================================================================== RCS file: /cvsroot/distcache/distcache/test/Makefile.am,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Makefile.am 19 May 2004 18:56:32 -0000 1.16 +++ Makefile.am 27 May 2004 19:03:02 -0000 1.17 @@ -1,6 +1,6 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir) -bin_PROGRAMS = nal_echo nal_ping nal_hose dc_test nal_test +bin_PROGRAMS = nal_echo nal_ping nal_hose nal_pong dc_test nal_test dc_test_SOURCES = dc_test.c dc_test_LDADD = $(top_builddir)/libsys/libsys.la \ $(top_builddir)/libdistcache/libdistcache.la \ @@ -17,4 +17,7 @@ nal_hose_SOURCES = hose.c nal_hose_LDADD = $(top_builddir)/libsys/libsys.la \ $(top_builddir)/libnal/libnal.la +nal_pong_SOURCES = pong.c +nal_pong_LDADD = $(top_builddir)/libsys/libsys.la \ + $(top_builddir)/libnal/libnal.la |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-05-27 19:03:13
|
Update of /cvsroot/distcache/distcache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30710 Modified Files: CHANGES Log Message: Yet another libnal testing tool. Index: CHANGES =================================================================== RCS file: /cvsroot/distcache/distcache/CHANGES,v retrieving revision 1.137 retrieving revision 1.138 diff -u -d -r1.137 -r1.138 --- CHANGES 26 May 2004 18:54:58 -0000 1.137 +++ CHANGES 27 May 2004 19:03:02 -0000 1.138 @@ -19,6 +19,12 @@ Changes between 1.5.0 and 1.5.x ------------------------------- + *) Add another libnal test, nal_pong, that plays request/response + transactions with configurable sizes. It doesn't check payloads, and + requires clients and servers to be set up with matching parameters, but + provides a useful way to run asymmetric traffic tests. + [Geoff Thorpe] + *) Turn nagle off (ie. set TCP_NODELAY) by default on sockets. The IO models we use typically results in good defragmentation anyway and nagle adds unnecessary delay. |
From: DistCacheCVS - G. T. <geo...@us...> - 2004-05-27 19:02:05
|
Update of /cvsroot/distcache/distcache/libnal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30133 Modified Files: proto_std.c Log Message: There appears to be a triggerable bug relating to multiple accepts on a listening socket inside a single select/poll loop. Not surprisingly, this logic was always very waxy and didn't look reliable, so I'm simplifying it away. This means listening sockets can only accept one socket at a time (ie. per selector loop), but this makes things more robust. Index: proto_std.c =================================================================== RCS file: /cvsroot/distcache/distcache/libnal/proto_std.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- proto_std.c 26 May 2004 18:54:59 -0000 1.22 +++ proto_std.c 27 May 2004 19:01:47 -0000 1.23 @@ -73,7 +73,7 @@ static int list_set_fs_perms(NAL_LISTENER *l, const char *octal_string); /* This is the type we attach to our listeners */ typedef struct st_list_ctx { - int fd, caught, taken; + int fd, caught; nal_sockaddr_type type; } list_ctx; static const NAL_LISTENER_vtable list_vtable = { @@ -291,8 +291,7 @@ { list_ctx *ctx = nal_listener_get_vtdata(l); if(ctx->caught) { - /* ctx->caught = 0; */ - ctx->taken = 1; + /* ctx->caught = 0; */ /* this is unset in conn::accept */ return &conn_vtable; } return NULL; @@ -327,9 +326,8 @@ NAL_SELECTOR_TOKEN tok) { list_ctx *ctx = nal_listener_get_vtdata(l); - if(!ctx->caught || ctx->taken) + if(!ctx->caught) nal_selector_fd_set(sel, tok, ctx->fd, SELECTOR_FLAG_READ); - ctx->taken = 0; } static void list_post_select(NAL_LISTENER *l, NAL_SELECTOR *sel, @@ -432,7 +430,9 @@ int fd = -1; list_ctx *ctx_list = nal_listener_get_vtdata(l); conn_ctx *ctx_conn = nal_connection_get_vtdata(conn); + assert(ctx_list->caught); if(!nal_sock_accept(ctx_list->fd, &fd)) { +#if 0 /* We only support one accept per readability so this stuff simply shouldn't occur */ switch(errno) { case EAGAIN: #if EAGAIN != EWOULDBLOCK @@ -444,9 +444,10 @@ default: break; } +#endif goto err; } - ctx_list->taken = 1; + ctx_list->caught = 0; if(!nal_fd_make_non_blocking(fd, 1) || !nal_sock_set_nagle(fd, gb_use_nagle, ctx_list->type) || !conn_ctx_setup(ctx_conn, fd, 1, |