commit ca8686240abe2751d0878927ab8053411ee6199f parent 2c121acf91c151c71b3bd27451b12c61bd3ac894 Author: finwo <finwo@pm.me> Date: Sat, 3 Jan 2026 19:33:07 +0100 1.47 Diffstat:
141 files changed, 2051 insertions(+), 1596 deletions(-)
diff --git a/ChangeLog b/ChangeLog @@ -1,6 +1,11 @@ ChangeLog for Crossroads ------------------------------------------------------------------------------ +1.47 [KK 2007-06-27] + - Added "externalhandler" to "revivinginterval" + - Added "checkinterval" + - Last connect time per back end gets stored + 1.46 [KK 2007-06-25] - Flag -X added (for xslt reference embedding) - "crossroads tell {service} {backend} {state}": state can be diff --git a/doc/crossroads.conf.7 b/doc/crossroads.conf.7 @@ -330,7 +330,7 @@ followed by \f(CWover\fP \fInumber\fP, or when the \fImode\fP is .PP \fBrevivinginterval - Back end wakeup calls\fP .IP "Description:" -A reviving interval definition is needed when crossroads +A reviving interval definition is used when Crossroads determines that a back end is temporarily unavailable\&. This will happen when: .IP @@ -340,18 +340,54 @@ fails); .IP o The network connection to the back end suddenly dies\&. .IP +Once a reviving interval is set, Crossroads will periodically +check the unavailable back end(s) to see whether they have woken up\&. +.IP An example of the definition is \f(CWrevivinginterval 10\fP\&. When this reviving interval is given, crossroads will check each 10 seconds -whether unavailable back ends have woken up yet\&. A back end is -considered awake when a network connection to that back end can -succesfully be established\&. +whether unavailable back ends have woken up yet\&. .IP "Syntax:" -\f(CWrevivinginterval\fP \fInumber\fP, where the number is the interval -in seconds\&. +.IP o +\f(CWrevivinginterval\fP \fInumber\fP; +.IP o + \f(CWrevivinginterval\fP \fInumber\fP \f(CWexternalhandler\fP + \fIprogram arguments\fP; + The first form connects to a back end server\&. If the connection + succeeds, then the back end is considered available\&. The second + form activates an external program (see section + ?? for a description)\&. The back end is marked +available if the program\&'s exit status is zero\&. .IP "Default:" 0 (no wakeup calls) .PP +\fBcheckinterval - Periodic back end checks\fP +.IP "Description:" +When a check interval is stated, Crossroads will periodically +probe back ends to determine whether available back ends are +still there, and to see whether unavailable back ends have woken +up yet\&. +.IP +An example is \f(CWcheckinterval 10\fP\&. When this is stated, +Crossroads will probe all back ends each 10 seconds\&. +.IP "Syntax:" +.IP o +\f(CWcheckinterval\fP \fInumber\fP; +.IP o +\f(CWcheckinterval\fP \fInumber\fP \f(CWexternalhandler\fP +\fIprogram arguments\fP; +The first form checks bhy connecting to the back end server\&. +If the connection succeeds, then the back end is considered +available; otherwise the back end is considered unavailable\&. +.IP +The second form activates an external program (see section + ?? for a description)\&. The back end is considered +available if the program\&'s exit status is zero; otherwise it is +considered unavailable\&. +.IP "Default:" +0 (no periodic checks) + +.PP \fBmaxconnections - Limiting concurrent clients at service level\fP .IP "Description:" The maximum number of connections is specified using @@ -675,6 +711,16 @@ second back end, and so on; \f(CW%e\fP is the count of seconds since start of epoch (January 1st 1970 GMT); .IP o +\f(CW%h\fP is the host name of the current back end; +.IP o +\f(CW%1h\fP is the host name of the first back end, \f(CW%2h\fP +of the second back end, and so on; +.IP o +\f(CW%p\fP is the TCP port of the current back end; +.IP o +\f(CW%1p\fP is the TCP port of the first back end, \f(CW%2p\fP of +the second back end, and so on; +.IP o \f(CW%r\fP is the IP address of the client that requests a connection and for whom the external dispatcher should compute a back end; @@ -693,6 +739,8 @@ Any other chararacter following a \f(CW%\fP sign is taken literally; e\&.g\&. \f(CW%z\fP is just a z\&. .IP .IP "Syntax:" +The syntax of the commands is as follows\&. +.IP .IP o \f(CWonstart\fP \fIcommandline\fP .IP o @@ -835,6 +883,16 @@ second back end, and so on; \f(CW%e\fP is the count of seconds since start of epoch (January 1st 1970 GMT); .IP o +\f(CW%h\fP is the host name of the current back end; +.IP o +\f(CW%1h\fP is the host name of the first back end, \f(CW%2h\fP +of the second back end, and so on; +.IP o +\f(CW%p\fP is the TCP port of the current back end; +.IP o +\f(CW%1p\fP is the TCP port of the first back end, \f(CW%2p\fP of +the second back end, and so on; +.IP o \f(CW%r\fP is the IP address of the client that requests a connection and for whom the external dispatcher should compute a back end; diff --git a/doc/crossroads.html b/doc/crossroads.html @@ -1,12 +1,12 @@ <a name="../crossroads-defs"></a><a name="defs"></a><html><head> -<title>Crossroads 1.46</title> +<title>Crossroads 1.47</title> <link rel="stylesheet" type="text/css" href="http://www.e-tunity.com/css/yodl.css"> <link rel="stylesheet" type="text/css" href="http://www.e-tunity.com/css/yodl.css"> <link rev="made" href="mailto:info@e-tunity.com"> </head> <body> <hr> -<h1>Crossroads 1.46</h1> +<h1>Crossroads 1.47</h1> <h2>Karel Kubat <br> Maintained by Karel Kubat (karel@kubat.nl)</h2> @@ -45,121 +45,130 @@ <dt><h3><a href="#l11">2: Installation for the impatient</a></h3></dt> <dt><h3><a href="#l12">3: Using Crossroads</a></h3></dt> <dl> -<dt><a href="#l13">3.1: General Commandline Syntax</a></dt> -<dt><a href="#l14">3.2: Status Reporting</a></dt> -<dt><a href="#l15">3.3: Logging-related options</a></dt> -<dt><a href="#l16">3.4: Reloading Configurations</a></dt> +<dt><a href="#l13">3.1: The Balancer: crossroads</a></dt> +<dl> +<dt><a href="#l14">3.1.1: General Commandline Syntax</a></dt> +<dt><a href="#l15">3.1.2: Status Reporting from the Command Line</a></dt> +<dt><a href="#l16">3.1.3: Logging-related options</a></dt> +<dt><a href="#l17">3.1.4: Reloading Configurations</a></dt> +</dl> +<dt><a href="#l18">3.2: The Web Frontend: crossroads-mgr</a></dt> </dl> -<dt><h3><a href="#l17">4: The configuration</a></h3></dt> +<dt><h3><a href="#l19">4: The configuration</a></h3></dt> <dl> -<dt><a href="#l18">4.1: General language elements</a></dt> +<dt><a href="#l20">4.1: General language elements</a></dt> <dl> -<dt><a href="#l19">4.1.1: Empty lines and comments</a></dt> -<dt><a href="#l20">4.1.2: Preprocessor directives</a></dt> -<dt><a href="#l21">4.1.3: Keywords, numbers, identifiers, generic strings</a></dt> +<dt><a href="#l21">4.1.1: Empty lines and comments</a></dt> +<dt><a href="#l22">4.1.2: Preprocessor directives</a></dt> +<dt><a href="#l23">4.1.3: Keywords, numbers, identifiers, generic strings</a></dt> </dl> -<dt><a href="#l22">4.2: Service definitions</a></dt> +<dt><a href="#l24">4.2: Service definitions</a></dt> <dl> -<dt><a href="#l23">4.2.1: port - Specifying the listen port</a></dt> -<dt><a href="#l24">4.2.2: type - Defining the service type</a></dt> -<dt><a href="#l25">4.2.3: headerinspection - are all HTTP headers inspected</a></dt> -<dt><a href="#l26">4.2.4: bindto - Binding to a specific IP address</a></dt> -<dt><a href="#l27">4.2.5: verbosity - Controlling debug output</a></dt> -<dt><a href="#l28">4.2.6: dispatchmode - How are back ends selected</a></dt> -<dt><a href="#l29">4.2.7: revivinginterval - Back end wakeup calls</a></dt> -<dt><a href="#l30">4.2.8: maxconnections - Limiting concurrent clients at service level</a></dt> -<dt><a href="#l31">4.2.9: backlog - The TCP Back Log size</a></dt> -<dt><a href="#l32">4.2.10: shmkey - Shared Memory Access</a></dt> -<dt><a href="#l33">4.2.11: allow* and deny* - Allowing or denying connections</a></dt> -<dt><a href="#l34">4.2.12: useraccount - Limiting the effective ID of external processes</a></dt> +<dt><a href="#l25">4.2.1: port - Specifying the listen port</a></dt> +<dt><a href="#l26">4.2.2: type - Defining the service type</a></dt> +<dt><a href="#l27">4.2.3: headerinspection - are all HTTP headers inspected</a></dt> +<dt><a href="#l28">4.2.4: bindto - Binding to a specific IP address</a></dt> +<dt><a href="#l29">4.2.5: verbosity - Controlling debug output</a></dt> +<dt><a href="#l30">4.2.6: dispatchmode - How are back ends selected</a></dt> +<dt><a href="#l31">4.2.7: revivinginterval - Back end wakeup calls</a></dt> +<dt><a href="#l32">4.2.8: checkinterval - Periodic back end checks</a></dt> +<dt><a href="#l33">4.2.9: maxconnections - Limiting concurrent clients at service level</a></dt> +<dt><a href="#l34">4.2.10: backlog - The TCP Back Log size</a></dt> +<dt><a href="#l35">4.2.11: shmkey - Shared Memory Access</a></dt> +<dt><a href="#l36">4.2.12: allow* and deny* - Allowing or denying connections</a></dt> +<dt><a href="#l37">4.2.13: useraccount - Limiting the effective ID of external processes</a></dt> </dl> -<dt><a href="#l35">4.3: Backend definitions</a></dt> +<dt><a href="#l38">4.3: Backend definitions</a></dt> <dl> -<dt><a href="#l36">4.3.1: server - Specifying the back end address</a></dt> -<dt><a href="#l37">4.3.2: verbosity - Controlling verbosity at the back end level</a></dt> -<dt><a href="#l38">4.3.3: retries - Specifying allowed failures</a></dt> -<dt><a href="#l39">4.3.4: weight - When a back end is more equal than others</a></dt> -<dt><a href="#l40">4.3.5: decay - Levelling out activity of a back end</a></dt> -<dt><a href="#l41">4.3.6: onstart, onend, onfail - Action Hooks</a></dt> -<dt><a href="#l42">4.3.7: trafficlog and throughputlog - Debugging and Performance Aids</a></dt> -<dt><a href="#l43">4.3.8: stickycookie - Back end selection with an HTTP cookie</a></dt> -<dt><a href="#l44">4.3.9: HTTP Header Modification Directives</a></dt> +<dt><a href="#l39">4.3.1: server - Specifying the back end address</a></dt> +<dt><a href="#l40">4.3.2: verbosity - Controlling verbosity at the back end level</a></dt> +<dt><a href="#l41">4.3.3: retries - Specifying allowed failures</a></dt> +<dt><a href="#l42">4.3.4: weight - When a back end is more equal than others</a></dt> +<dt><a href="#l43">4.3.5: decay - Levelling out activity of a back end</a></dt> +<dt><a href="#l44">4.3.6: onstart, onend, onfail - Action Hooks</a></dt> +<dt><a href="#l45">4.3.7: trafficlog and throughputlog - Debugging and Performance Aids</a></dt> +<dt><a href="#l46">4.3.8: stickycookie - Back end selection with an HTTP cookie</a></dt> +<dt><a href="#l47">4.3.9: HTTP Header Modification Directives</a></dt> </dl> </dl> -<dt><h3><a href="#l45">5: Tips, Tricks and Random Remarks</a></h3></dt> +<dt><h3><a href="#l48">5: Tips, Tricks and Random Remarks</a></h3></dt> <dl> -<dt><a href="#l46">5.1: Configuration examples</a></dt> +<dt><a href="#l49">5.1: Configuration examples</a></dt> +<dl> +<dt><a href="#l50">5.1.1: A load balancer for three webserver back ends</a></dt> +<dt><a href="#l51">5.1.2: An HTTP forwarder when travelling</a></dt> +<dt><a href="#l52">5.1.3: SSH login with enforced idle logout</a></dt> +</dl> +<dt><a href="#l53">5.2: How back ends are selected in load balancing</a></dt> <dl> -<dt><a href="#l47">5.1.1: A load balancer for three webserver back ends</a></dt> -<dt><a href="#l48">5.1.2: An HTTP forwarder when travelling</a></dt> -<dt><a href="#l49">5.1.3: SSH login with enforced idle logout</a></dt> +<dt><a href="#l54">5.2.1: Bysize, byduration or byconnections?</a></dt> +<dt><a href="#l55">5.2.2: Averaging size and duration</a></dt> +<dt><a href="#l56">5.2.3: Specifying decays</a></dt> +<dt><a href="#l57">5.2.4: Adjusting the weights</a></dt> </dl> -<dt><a href="#l50">5.2: How back ends are selected in load balancing</a></dt> +<dt><a href="#l58">5.3: Periodic probes and wake up calls</a></dt> <dl> -<dt><a href="#l51">5.2.1: Bysize, byduration or byconnections?</a></dt> -<dt><a href="#l52">5.2.2: Averaging size and duration</a></dt> -<dt><a href="#l53">5.2.3: Specifying decays</a></dt> -<dt><a href="#l54">5.2.4: Adjusting the weights</a></dt> +<dt><a href="#l59">5.3.1: Syntax</a></dt> +<dt><a href="#l60">5.3.2: Security Considerations</a></dt> +<dt><a href="#l61">5.3.3: An example</a></dt> </dl> -<dt><a href="#l55">5.3: Throttling the number of concurrent connections</a></dt> -<dt><a href="#l56">5.4: TCP Session Stickiness</a></dt> -<dt><a href="#l57">5.5: HTTP Session Stickiness</a></dt> +<dt><a href="#l62">5.4: Throttling the number of concurrent connections</a></dt> +<dt><a href="#l63">5.5: TCP Session Stickiness</a></dt> +<dt><a href="#l64">5.6: HTTP Session Stickiness</a></dt> <dl> -<dt><a href="#l58">5.5.1: Don't use stickiness!</a></dt> -<dt><a href="#l59">5.5.2: But if you must..</a></dt> +<dt><a href="#l65">5.6.1: Don't use stickiness!</a></dt> +<dt><a href="#l66">5.6.2: But if you must..</a></dt> </dl> -<dt><a href="#l60">5.6: Passing the client's IP address</a></dt> +<dt><a href="#l67">5.7: Passing the client's IP address</a></dt> <dl> -<dt><a href="#l61">5.6.1: Sample Crossroads configuration</a></dt> -<dt><a href="#l62">5.6.2: Sample Apache configuration</a></dt> +<dt><a href="#l68">5.7.1: Sample Crossroads configuration</a></dt> +<dt><a href="#l69">5.7.2: Sample Apache configuration</a></dt> </dl> -<dt><a href="#l63">5.7: Deep or shallow HTTP header inspection</a></dt> -<dt><a href="#l64">5.8: Debugging network traffic</a></dt> -<dt><a href="#l65">5.9: IP filtering: Limiting Access by Client IP Address</a></dt> +<dt><a href="#l70">5.8: Deep or shallow HTTP header inspection</a></dt> +<dt><a href="#l71">5.9: Debugging network traffic</a></dt> +<dt><a href="#l72">5.10: IP filtering: Limiting Access by Client IP Address</a></dt> <dl> -<dt><a href="#l66">5.9.1: General Examples</a></dt> -<dt><a href="#l67">5.9.2: Using External Files</a></dt> -<dt><a href="#l68">5.9.3: Mixing Directives</a></dt> +<dt><a href="#l73">5.10.1: General Examples</a></dt> +<dt><a href="#l74">5.10.2: Using External Files</a></dt> +<dt><a href="#l75">5.10.3: Mixing Directives</a></dt> </dl> -<dt><a href="#l69">5.10: Using an external program to dispatch</a></dt> +<dt><a href="#l76">5.11: Using an external program to dispatch</a></dt> <dl> -<dt><a href="#l70">5.10.1: Configuring the external handler</a></dt> -<dt><a href="#l71">5.10.2: Writing the external handler</a></dt> -<dt><a href="#l72">5.10.3: Examples of external handlers</a></dt> +<dt><a href="#l77">5.11.1: Configuring the external handler</a></dt> +<dt><a href="#l78">5.11.2: Writing the external handler</a></dt> +<dt><a href="#l79">5.11.3: Examples of external handlers</a></dt> </dl> -<dt><a href="#l73">5.11: Linux and ip_conntrack_max</a></dt> -<dt><a href="#l74">5.12: Marking back ends as bad after more than one try</a></dt> -<dt><a href="#l75">5.13: Scripting Crossroads' back end availability</a></dt> -<dt><a href="#l76">5.14: Using the Web Interface crossroads-mgr</a></dt> +<dt><a href="#l80">5.12: Linux and ip_conntrack_max</a></dt> +<dt><a href="#l81">5.13: Marking back ends as bad after more than one try</a></dt> +<dt><a href="#l82">5.14: Using the Web Interface crossroads-mgr</a></dt> <dl> -<dt><a href="#l77">5.14.1: Starting crossroads-mgr</a></dt> +<dt><a href="#l83">5.14.1: Starting crossroads-mgr</a></dt> </dl> -<dt><a href="#l78">5.15: Rendering Crossroads' status in a web page</a></dt> -<dt><a href="#l79">5.16: Crossroads and DNS caching</a></dt> +<dt><a href="#l84">5.15: Rendering Crossroads' status in a web page</a></dt> +<dt><a href="#l85">5.16: Crossroads and DNS caching</a></dt> </dl> -<dt><h3><a href="#l80">6: Benchmarking</a></h3></dt> +<dt><h3><a href="#l86">6: Benchmarking</a></h3></dt> <dl> -<dt><a href="#l81">6.1: Benchmark 1: Accessing a proxy via crossroads or directly</a></dt> +<dt><a href="#l87">6.1: Benchmark 1: Accessing a proxy via crossroads or directly</a></dt> <dl> -<dt><a href="#l82">6.1.1: Results</a></dt> -<dt><a href="#l83">6.1.2: Discussion</a></dt> +<dt><a href="#l88">6.1.1: Results</a></dt> +<dt><a href="#l89">6.1.2: Discussion</a></dt> </dl> -<dt><a href="#l84">6.2: Benchmark 2: Crossroads versus Linux Virtual Server (LVS)</a></dt> +<dt><a href="#l90">6.2: Benchmark 2: Crossroads versus Linux Virtual Server (LVS)</a></dt> <dl> -<dt><a href="#l85">6.2.1: Environment</a></dt> -<dt><a href="#l86">6.2.2: Tests and results</a></dt> +<dt><a href="#l91">6.2.1: Environment</a></dt> +<dt><a href="#l92">6.2.2: Tests and results</a></dt> </dl> </dl> -<dt><h3><a href="#l87">7: The Web Interface</a></h3></dt> -<dt><h3><a href="#l88">8: Compiling and Installing</a></h3></dt> +<dt><h3><a href="#l93">7: Compiling and Installing</a></h3></dt> <dl> -<dt><a href="#l89">8.1: Prerequisites</a></dt> -<dt><a href="#l90">8.2: Compiling and installing</a></dt> -<dt><a href="#l91">8.3: Configuring crossroads</a></dt> -<dt><a href="#l92">8.4: A boot script</a></dt> +<dt><a href="#l94">7.1: Prerequisites</a></dt> +<dt><a href="#l95">7.2: Compiling and installing</a></dt> +<dt><a href="#l96">7.3: Configuring crossroads</a></dt> +<dt><a href="#l97">7.4: A boot script</a></dt> <dl> -<dt><a href="#l93">8.4.1: SysV Style Startup</a></dt> -<dt><a href="#l94">8.4.2: BSD Style Startup</a></dt> +<dt><a href="#l98">7.4.1: SysV Style Startup</a></dt> +<dt><a href="#l99">7.4.2: BSD Style Startup</a></dt> </dl> <p><hr><p> @@ -432,14 +441,14 @@ As of version 1.08, the following directives no longer are <h2>2: Installation for the impatient</h2> <a name="impatient"></a> For the impatient, here's the very-quick-but-very-superficial recipy -for getting crossroads up and running: +for getting Crossroads up and running: <p> <ul> <p> <li> If you don't have SVN or don't want to use it: <p> <ul> - <li> Obtain the crossroads source archive at + <li> Obtain the Crossroads source archive at <a href="http://crossroads.e-tunity.com">http://crossroads.e-tunity.com</a>. <p> <li> Change-dir to a 'sources' directory on your system and @@ -450,7 +459,8 @@ for getting crossroads up and running: <li> If you have SVN and want to go for the newest snapshot: <p> <ul> - <li> Get the latest sources and snapshots using SVN from <br> +<p> +<li> Get the latest sources and snapshots using SVN from <br> <code>svn://svn.e-tunity.com/crossroads</code>. <p> <li> You'll find the newest alpha version under @@ -464,7 +474,7 @@ for getting crossroads up and running: <em>X.YY</em> is a release ID. In the latter case, change-dir to <code>crossroads/trunk</code>.</ul> <p> -<li> Type <code>make install</code>. This installs the crossroads +<li> Type <code>make install</code>. This installs the Crossroads binary into <code>/usr/local/bin/</code>. If the compilation doesn't work on your system, check <code>etc/Makefile.def</code> for hints. <p> @@ -490,30 +500,38 @@ That's off course assuming that you want to balance HTTP on <p> <li> Type <code>crossroads start</code>. <p> -<li> Surf to the machine where crossroads is running. You will +<li> Surf to the machine where Crossroads is running. You will see the pages served by the back ends 10.1.1.100 or 10.1.1.101. <p> -<li> To monitor the status of crossroads, type <code>crossroads - status</code>. +<li> To monitor the status of Crossroads from the command + line, type <code>crossroads status</code>. +<p> +<li> If you want to monitor Crossroads via a web front end, + start the manager: type <code>crossroads-mgr start 1000</code>. Next + point your browser to the machine where Crossroads is + running, port 1000. </ul> <p> <a name="l12"></a> <h2>3: Using Crossroads</h2> -<a name="using"></a>Crossroads is started from the commandline, and highly depends on +<a name="using"></a><a name="l13"></a> +<h3>3.1: The Balancer: crossroads</h3> +<p> +The Crossroads balancer is started from the commandline, and highly depends on /etc/crossroads.conf (the default configuration file). It supports a number of flags (e.g., to overrule the location of the configuration file). The actual usage information is always obtained by typing <code>crossroads</code> without any arguments. Crossroads then displays the allowed arguments. <p> -The installation (see section <a href="crossroads.html#installation">8</a>) installs also a +The installation (see section <a href="crossroads.html#installation">7</a>) installs also a second program called <code>crossroads-daemon</code>. This program is not meant to be started from the command line; it is administered through the front end <code>crossroads</code>. <p> -<a name="l13"></a> -<h3>3.1: General Commandline Syntax</h3> +<a name="l14"></a> +<strong>3.1.1: General Commandline Syntax</strong> <p> This section shows the most basic usage. As said above, start <code>crossroads</code> without arguments to view the full listing of options. @@ -548,8 +566,8 @@ This section shows the most basic usage. As said above, start configuration /etc/crossroads.conf. </ul> <p> -<a name="l14"></a> -<h3>3.2: Status Reporting</h3> +<a name="l15"></a> +<strong>3.1.2: Status Reporting from the Command Line</strong> <p> The command <code>crossroads status</code> shows a verbose human-readable report of how Crossroads is doing. When many services are configured, @@ -583,8 +601,8 @@ document. This can be handy if you want to further automate the control over Crossroads, or if you want to show the status via the web. (See section <a href="crossroads.html#xmlstatus">5.15</a> for more information.) <p> -<a name="l15"></a> -<h3>3.3: Logging-related options</h3> +<a name="l16"></a> +<strong>3.1.3: Logging-related options</strong> <p> Two 'flags' of Crossroads are specifically logging-related. This section elaborates on these flags. @@ -626,8 +644,8 @@ That instructs <code>syslogd</code> to send <code>LOG_LOCAL7</code> requests to <li> Finally, monitor <code>/var/log/crossroads.log</code> for Crossroads' messages.</ul> <p> -<a name="l16"></a> -<h3>3.4: Reloading Configurations</h3> +<a name="l17"></a> +<strong>3.1.4: Reloading Configurations</strong> <p> Crossroads doesn't support the reloading of a configuration while running (such as other programs, e.g. Apache do). There are various @@ -637,9 +655,26 @@ However, external lists of allowed or denied IP addresses can be reloaded by sending a signal -1 (<code>SIGHUP</code>) to Crossroads. See section <a href="crossroads.html#servicedef">4.2</a> for the details. <p> +<a name="l18"></a> +<h3>3.2: The Web Frontend: crossroads-mgr</h3> +<p> +A web front end for Crossroads is <code>crossroads-mgr</code>. Type +<code>crossroads-mgr</code> without arguments to see the usage. +<p> +Normally the web interface is started like: +<p> +<center><code>crossroads-mgr start 1000</code></center> +<p> +where 1000 is a free TCP port. Note that <code>crossroads-mgr</code> must be +started on the system where the balancer <code>crossroads</code> itself is +running. +<p> +There are lots of other options that can be used with +<code>crossroads-mgr</code>, see section <a href="crossroads.html#tips/webinterface">5.14</a>. +<p> -<a name="l17"></a> +<a name="l19"></a> <h2>4: The configuration</h2> <a name="config"></a>The configuration that crossroads uses is normally stored in the file /etc/crossroads.conf. This location can be overruled using the @@ -648,13 +683,13 @@ command line flag <code>-c</code>. This section explains the syntax of the configuration file, and what all settings do. <p> -<a name="l18"></a> +<a name="l20"></a> <h3>4.1: General language elements</h3> <p> This section describes the general elements of the crossroads configuration language. <p> -<a name="l19"></a> +<a name="l21"></a> <strong>4.1.1: Empty lines and comments</strong> <p> Empty lines are of course allowed in the @@ -670,7 +705,7 @@ best'. (I favor C or C++ comment. My favorite editor <em>emacs</em> can be put in <code>cmode</code> and nicely highlight what's comment and what's not. And as a bonus it will auto-indent the configuration!) <p> -<a name="l20"></a> +<a name="l22"></a> <strong>4.1.2: Preprocessor directives</strong> <p> Similar to <strong>C</strong> or <strong>C++</strong>, the Crossroads grammar knows <code>#include</code> @@ -721,7 +756,7 @@ service web { </pre> <p> -<a name="l21"></a> +<a name="l23"></a> <strong>4.1.3: Keywords, numbers, identifiers, generic strings</strong> <p> In a configuration file, statements are identified by <em>keywords</em>, @@ -756,7 +791,7 @@ Finally, an argument can be a 'boolean' value. Crossroads knows <code>true</code>, <code>yes</code> and <code>on</code> all mean the same and can be used interchangeably; as can the keywords <code>false</code>, <code>no</code> and <code>off</code>. <p> -<a name="l22"></a> +<a name="l24"></a> <h3>4.2: Service definitions</h3> <a name="servicedef"></a> <p> Service definitions are blocks in the configuration file that @@ -780,7 +815,7 @@ identifying names differ. The following list shows possible statements. Each statement must end with a semicolon, except for the <code>backend</code> statement, which has is own block (more on this later). <p> -<a name="conf/port"></a><a name="l23"></a> +<a name="conf/port"></a><a name="l25"></a> <strong>4.2.1: port - Specifying the listen port</strong> <a name="confport - Specifying the listen port"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>port</code> statement defines to which TCP port a service @@ -790,7 +825,7 @@ statements. Each statement must end with a semicolon, except for the <p><dt><strong>Default:</strong><dd> There is no default. This is a required setting. </dl> <p> -<a name="conf/type"></a><a name="l24"></a> +<a name="conf/type"></a><a name="l26"></a> <strong>4.2.2: type - Defining the service type</strong> <a name="conftype - Defining the service type"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>type</code> statement defines how crossroads handles the stated @@ -810,7 +845,7 @@ Unless you really need such special features, use the type <code>any</code> (the <p><dt><strong>Default:</strong><dd> <code>any</code> </dl> <p> -<a name="conf/headerinspection"></a><a name="l25"></a> +<a name="conf/headerinspection"></a><a name="l27"></a> <strong>4.2.3: headerinspection - are all HTTP headers inspected</strong> <a name="confheaderinspection - are all HTTP headers inspected"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>headerinspection</code> directive defines whether Crossroads @@ -827,7 +862,7 @@ that forms the server's answer, are analyzed. <p><dt><strong>Default:</strong><dd> <code>deep</code> </dl> <p> -<a name="conf/bindto"></a><a name="l26"></a> +<a name="conf/bindto"></a><a name="l28"></a> <strong>4.2.4: bindto - Binding to a specific IP address</strong> <a name="confbindto - Binding to a specific IP address"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>bindto</code> statement is used in situations where crossroads @@ -841,7 +876,7 @@ that forms the server's answer, are analyzed. <p><dt><strong>Default:</strong><dd> <code>any</code> </dl> <p> -<a name="conf/verbose"></a><a name="l27"></a> +<a name="conf/verbose"></a><a name="l29"></a> <strong>4.2.5: verbosity - Controlling debug output</strong> <a name="confverbosity - Controlling debug output"></a> <dl> <p><dt><strong>Description:</strong><dd> Verbosity statements come in two forms: <code>verbosity on</code> or @@ -858,7 +893,7 @@ that forms the server's answer, are analyzed. <p><dt><strong>Default:</strong><dd> <code>off</code> </dl> <p> -<a name="conf/dispatchmode"></a><a name="l28"></a> +<a name="conf/dispatchmode"></a><a name="l30"></a> <strong>4.2.6: dispatchmode - How are back ends selected</strong> <a name="confdispatchmode - How are back ends selected"></a> <dl> <p><dt><strong>Description:</strong><dd> The dispatch mode controls how crossroads selects a back end from @@ -921,7 +956,7 @@ The modifier <code>over</code> <em>connections</em> is optional. (The square custom-made dispatch modes are needed. <p> The dispatch mode that uses an <code>externalhandler</code> is - discussed separately in section <a href="crossroads.html#externalhandler">5.10</a>.</ul> + discussed separately in section <a href="crossroads.html#externalhandler">5.11</a>.</ul> <p> The selection algorithm is only used when clients are serviced that aren't part of a sticky HTTP session. This is the case during: @@ -945,10 +980,10 @@ Your 'right' dispatch mode will depend on the type of service. Given <p><dt><strong>Default:</strong><dd> <code>roundrobin</code> </dl> <p> -<a name="conf/revivinginterval"></a><a name="l29"></a> +<a name="conf/revivinginterval"></a><a name="l31"></a> <strong>4.2.7: revivinginterval - Back end wakeup calls</strong> <a name="confrevivinginterval - Back end wakeup calls"></a> <dl> - <p><dt><strong>Description:</strong><dd> A reviving interval definition is needed when crossroads + <p><dt><strong>Description:</strong><dd> A reviving interval definition is used when Crossroads determines that a back end is temporarily unavailable. This will happen when: <p> @@ -957,18 +992,51 @@ Your 'right' dispatch mode will depend on the type of service. Given fails); <li> The network connection to the back end suddenly dies.</ul> <p> +Once a reviving interval is set, Crossroads will periodically + check the unavailable back end(s) to see whether they have woken up. +<p> An example of the definition is <code>revivinginterval 10</code>. When this reviving interval is given, crossroads will check each 10 seconds - whether unavailable back ends have woken up yet. A back end is - considered awake when a network connection to that back end can - succesfully be established. - <p><dt><strong>Syntax:</strong><dd> <code>revivinginterval</code> <em>number</em>, where the number is the interval - in seconds. + whether unavailable back ends have woken up yet. + <p><dt><strong>Syntax:</strong><dd> <ul> + <li> <code>revivinginterval</code> <em>number</em>; + <li> <code>revivinginterval</code> <em>number</em> <code>externalhandler</code> + <em>program arguments</em>;</ul> + The first form connects to a back end server. If the connection + succeeds, then the back end is considered available. The second + form activates an external program (see section + <a href="crossroads.html#tips/periodic">5.3</a> for a description). The back end is marked + available if the program's exit status is zero. <p><dt><strong>Default:</strong><dd> 0 (no wakeup calls) </dl> <p> -<a name="conf/maxconnections"></a><a name="l30"></a> -<strong>4.2.8: maxconnections - Limiting concurrent clients at service level</strong> <a name="confmaxconnections - Limiting concurrent clients at service level"></a> +<a name="conf/checkinterval"></a><a name="l32"></a> +<strong>4.2.8: checkinterval - Periodic back end checks</strong> <a name="confcheckinterval - Periodic back end checks"></a> + <dl> + <p><dt><strong>Description:</strong><dd> When a check interval is stated, Crossroads will periodically + probe back ends to determine whether available back ends are + still there, and to see whether unavailable back ends have woken + up yet. +<p> +An example is <code>checkinterval 10</code>. When this is stated, + Crossroads will probe all back ends each 10 seconds. + <p><dt><strong>Syntax:</strong><dd> <ul> + <li> <code>checkinterval</code> <em>number</em>; + <li> <code>checkinterval</code> <em>number</em> <code>externalhandler</code> + <em>program arguments</em>;</ul> + The first form checks bhy connecting to the back end server. + If the connection succeeds, then the back end is considered + available; otherwise the back end is considered unavailable. +<p> +The second form activates an external program (see section + <a href="crossroads.html#tips/periodic">5.3</a> for a description). The back end is considered + available if the program's exit status is zero; otherwise it is + considered unavailable. + <p><dt><strong>Default:</strong><dd> 0 (no periodic checks) + </dl> +<p> +<a name="conf/maxconnections"></a><a name="l33"></a> +<strong>4.2.9: maxconnections - Limiting concurrent clients at service level</strong> <a name="confmaxconnections - Limiting concurrent clients at service level"></a> <dl> <p><dt><strong>Description:</strong><dd> The maximum number of connections is specified using <code>maxconnections</code>. There is one argument; the number of concurrent @@ -983,8 +1051,8 @@ An example of the definition is <code>revivinginterval 10</code>. When this <p><dt><strong>Default:</strong><dd> 0, meaning that all connections will be accepted. </dl> <p> -<a name="conf/backlog"></a><a name="l31"></a> -<strong>4.2.9: backlog - The TCP Back Log size</strong> <a name="confbacklog - The TCP Back Log size"></a> +<a name="conf/backlog"></a><a name="l34"></a> +<strong>4.2.10: backlog - The TCP Back Log size</strong> <a name="confbacklog - The TCP Back Log size"></a> <dl> <p><dt><strong>Description:</strong><dd> The TCP back log size is a number that controls how many 'waiting' network connections may be queued, before a client simply @@ -999,8 +1067,8 @@ An example of the definition is <code>revivinginterval 10</code>. When this value for socket back log size. </dl> <p> -<a name="conf/shmkey"></a><a name="l32"></a> -<strong>4.2.10: shmkey - Shared Memory Access</strong> <a name="confshmkey - Shared Memory Access"></a> +<a name="conf/shmkey"></a><a name="l35"></a> +<strong>4.2.11: shmkey - Shared Memory Access</strong> <a name="confshmkey - Shared Memory Access"></a> <dl> <p><dt><strong>Description:</strong><dd> Different Crossroads invocations must 'know' of each others activity. E.g, <code>crossroad @@ -1020,8 +1088,8 @@ The actual key value doesn't matter much, as long as it's unique own key, based on the service name. </dl> <p> -<a name="conf/allow"></a><a name="l33"></a> -<strong>4.2.11: allow* and deny* - Allowing or denying connections</strong> <a name="confallow* and deny* - Allowing or denying connections"></a> +<a name="conf/allow"></a><a name="l36"></a> +<strong>4.2.12: allow* and deny* - Allowing or denying connections</strong> <a name="confallow* and deny* - Allowing or denying connections"></a> <dl> <p><dt><strong>Description:</strong><dd> Crossroads can allow or deny connections based on the IP address of a client. There are four @@ -1089,8 +1157,8 @@ This is probably best explained by a few examples: <p><dt><strong>Default:</strong><dd> In absence of these statements, all client IP's are accepted. </dl> <p> -<a name="conf/useraccount"></a><a name="l34"></a> -<strong>4.2.12: useraccount - Limiting the effective ID of external processes</strong> <a name="confuseraccount - Limiting the effective ID of external processes"></a> +<a name="conf/useraccount"></a><a name="l37"></a> +<strong>4.2.13: useraccount - Limiting the effective ID of external processes</strong> <a name="confuseraccount - Limiting the effective ID of external processes"></a> <dl> <p><dt><strong>Description:</strong><dd> Using the directive <code>useraccount</code>, the effective user and group ID can be restricted. This comes into effect when Crossroads runs @@ -1107,7 +1175,7 @@ This is probably best explained by a few examples: ID that was in effect when Crossroads was started. </dl> <p> -<a name="l35"></a> +<a name="l38"></a> <h3>4.3: Backend definitions</h3> <p> Inside the service definitions as are described in the previous @@ -1143,7 +1211,7 @@ Crossroads treats the network traffic as a stream of HTTP messages; i.e., when the service is declared with <code>type http</code>. Incase of <code>type any</code>, the HTTP-specific directives have no effect. <p> -<a name="conf/server.yo"></a><a name="l36"></a> +<a name="conf/server.yo"></a><a name="l39"></a> <strong>4.3.1: server - Specifying the back end address</strong> <a name="confserver - Specifying the back end address"></a> <dl> <p><dt><strong>Description:</strong><dd> Each back end must be identified by the network name @@ -1162,7 +1230,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of <p><dt><strong>Default:</strong><dd> There is no default. This is a required setting. </dl> <p> -<a name="conf/verbose-backend.yo"></a><a name="l37"></a> +<a name="conf/verbose-backend.yo"></a><a name="l40"></a> <strong>4.3.2: verbosity - Controlling verbosity at the back end level</strong> <a name="confverbosity - Controlling verbosity at the back end level"></a> <dl> <p><dt><strong>Description:</strong><dd> Similar to <code>service</code> specifications, a @@ -1176,7 +1244,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of <p><dt><strong>Default:</strong><dd> <code>off</code> </dl> <p> -<a name="conf/retries.yo"></a><a name="l38"></a> +<a name="conf/retries.yo"></a><a name="l41"></a> <strong>4.3.3: retries - Specifying allowed failures</strong> <a name="confretries - Specifying allowed failures"></a> <dl> <p><dt><strong>Description:</strong><dd> Back ends that are 'flaky' or on a less reliable network can be @@ -1191,7 +1259,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of connection. </dl> <p> -<a name="conf/weight"></a><a name="l39"></a> +<a name="conf/weight"></a><a name="l42"></a> <strong>4.3.4: weight - When a back end is more equal than others</strong> <a name="confweight - When a back end is more equal than others"></a> <dl> <p><dt><strong>Description:</strong><dd> To influence how backends are selected, a backend can specify its @@ -1210,7 +1278,7 @@ The weighing mechanism only applies to the dispatch modes <p><dt><strong>Default:</strong><dd> 1; all back ends have equal weight. </dl> <p> -<a name="conf/decay"></a><a name="l40"></a> +<a name="conf/decay"></a><a name="l43"></a> <strong>4.3.5: decay - Levelling out activity of a back end</strong> <a name="confdecay - Levelling out activity of a back end"></a> <dl> <p><dt><strong>Description:</strong><dd> To make sure that a 'spike' of activity doesn't @@ -1232,7 +1300,7 @@ This means that when a given back end is hit, then its usage data <p><dt><strong>Default:</strong><dd> 0, meaning that no decay is applied to usage statistics. </dl> <p> -<a name="conf/onhooks"></a><a name="l41"></a> +<a name="conf/onhooks"></a><a name="l44"></a> <strong>4.3.6: onstart, onend, onfail - Action Hooks</strong> <a name="confonstart, onend, onfail - Action Hooks"></a> <dl> <p><dt><strong>Description:</strong><dd> The three directives <code>onstart</code>, <code>onend</code> and <code>onfail</code> can be @@ -1263,6 +1331,12 @@ The format is always <code>on</code><em>type</em> <em>command</em>. The <em>comm second back end, and so on; <li> <code>%e</code> is the count of seconds since start of epoch (January 1st 1970 GMT); + <li> <code>%h</code> is the host name of the current back end; + <li> <code>%1h</code> is the host name of the first back end, <code>%2h</code> + of the second back end, and so on; + <li> <code>%p</code> is the TCP port of the current back end; + <li> <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of + the second back end, and so on; <li> <code>%r</code> is the IP address of the client that requests a connection and for whom the external dispatcher should compute a back end; @@ -1275,7 +1349,9 @@ The format is always <code>on</code><em>type</em> <em>command</em>. The <em>comm <li> Any other chararacter following a <code>%</code> sign is taken literally; e.g. <code>%z</code> is just a z.</ul> <p> -<p><dt><strong>Syntax:</strong><dd> <ul> +<p><dt><strong>Syntax:</strong><dd> The syntax of the commands is as follows. +<p> +<ul> <li> <code>onstart</code> <em>commandline</em> <li> <code>onend</code> <em>commandline</em> <li> <code>onfail</code> <em>commandline</em> @@ -1284,7 +1360,7 @@ The format is always <code>on</code><em>type</em> <em>command</em>. The <em>comm connection, success or failure of a back end. </dl> <p> -<a name="conf/trafficlog"></a><a name="l42"></a> +<a name="conf/trafficlog"></a><a name="l45"></a> <strong>4.3.7: trafficlog and throughputlog - Debugging and Performance Aids</strong> <a name="conftrafficlog and throughputlog - Debugging and Performance Aids"></a> <dl> <p><dt><strong>Description:</strong><dd> Two directives are available @@ -1304,7 +1380,7 @@ The <code>throughputlog</code> statement writes shorthand transmissions to <p><dt><strong>Default:</strong><dd> none </dl> <p> -<a name="conf/stickycookie"></a><a name="l43"></a> +<a name="conf/stickycookie"></a><a name="l46"></a> <strong>4.3.8: stickycookie - Back end selection with an HTTP cookie</strong> <a name="confstickycookie - Back end selection with an HTTP cookie"></a> <dl> <p><dt><strong>Description:</strong><dd> The directive <code>stickycookie</code> <em>value</em> @@ -1344,7 +1420,7 @@ There are basically to provide such cookies to a browser. First, a <p><dt><strong>Default:</strong><dd> There is no default. </dl> <p> -<a name="conf/addclientheader"></a><a name="l44"></a> +<a name="conf/addclientheader"></a><a name="l47"></a> <strong>4.3.9: HTTP Header Modification Directives</strong> <a name="confHTTP Header Modification Directives"></a> <dl> <p><dt><strong>Description:</strong><dd> Crossroads understands the following @@ -1403,6 +1479,12 @@ The header value may contain one of the following formatting second back end, and so on; <li> <code>%e</code> is the count of seconds since start of epoch (January 1st 1970 GMT); + <li> <code>%h</code> is the host name of the current back end; + <li> <code>%1h</code> is the host name of the first back end, <code>%2h</code> + of the second back end, and so on; + <li> <code>%p</code> is the TCP port of the current back end; + <li> <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of + the second back end, and so on; <li> <code>%r</code> is the IP address of the client that requests a connection and for whom the external dispatcher should compute a back end; @@ -1520,16 +1602,16 @@ service ... { <p><dt><strong>Default:</strong><dd> There is no default. </dl> <p> -<a name="l45"></a> +<a name="l48"></a> <h2>5: Tips, Tricks and Random Remarks</h2> <a name="tips"></a>The following sections elaborate on the directives as described in section <a href="crossroads.html#config">4</a> to illustrate how crossroads works and to help you achieve the "optimal" balancing configuration. <p> -<a name="l46"></a> +<a name="l49"></a> <h3>5.1: Configuration examples</h3> <a name="tips/examples"></a> -<a name="l47"></a> +<a name="l50"></a> <strong>5.1.1: A load balancer for three webserver back ends</strong> <p> The following configuration example binds crossroads to port 80 of the @@ -1658,7 +1740,7 @@ service www { </pre> <p> -<a name="l48"></a> +<a name="l51"></a> <strong>5.1.2: An HTTP forwarder when travelling</strong> <p> As another example, here's my /etc/crossroads.conf that I use on my @@ -1747,7 +1829,7 @@ and <code>LocalSquid</code> are both active, then <code>crossroads tell httpprox sshtunnel down</code> will 'take down' the back end <code>SshTunnel</code> -- and will automatically cause crossroads to switch to <code>LocalSquid</code>. <p> -<a name="l49"></a> +<a name="l52"></a> <strong>5.1.3: SSH login with enforced idle logout</strong> <p> The following example shows how crossroads 'throttles' SSH @@ -1773,7 +1855,7 @@ service Ssh { </pre> <p> -<a name="l50"></a> +<a name="l53"></a> <h3>5.2: How back ends are selected in load balancing</h3> <a name="howselected"></a> <a name="tips/howselected"></a>In order to tune your load balancing, you'll need to understand how crossroads computes usage, how weighing works, and so on. In this @@ -1781,7 +1863,7 @@ section we'll focus on the dispatching modes <code>bysize</code>, <code>bydurati and <code>byconnections</code> only. The other dispatching types are self-explanatory. <p> -<a name="l51"></a> +<a name="l54"></a> <strong>5.2.1: Bysize, byduration or byconnections?</strong> <p> As stated before, crossroads doesn't know 'what a service does' and @@ -1831,7 +1913,7 @@ E.g., consider a database connection. What's <p> </ul> <p> -<a name="l52"></a> +<a name="l55"></a> <strong>5.2.2: Averaging size and duration</strong> <p> The configuration statement <code>dispatchmode bysize</code> or <code>byduration</code> @@ -1852,7 +1934,7 @@ In contrast, when e.g. <code>over 3</code> is in effect, then a sudden load does show up -- because it highly contributes to the average of three connections. <p> -<a name="l53"></a> +<a name="l56"></a> <strong>5.2.3: Specifying decays</strong> <p> Decays are also only relevant when crossroads computes the 'next best @@ -1906,7 +1988,7 @@ service soap { </pre> <p> -<a name="l54"></a> +<a name="l57"></a> <strong>5.2.4: Adjusting the weights</strong> <p> The back end modifier <code>weight</code> is useful in situations where your @@ -1960,8 +2042,130 @@ both A and B crash). Note also that A's usage data decay much faster than B's and C's: we're assuming that this big server recovers quicker than its smaller siblings. <p> -<a name="l55"></a> -<h3>5.3: Throttling the number of concurrent connections</h3> +<a name="l58"></a> +<h3>5.3: Periodic probes and wake up calls</h3> +<a name="tips/periodic"></a>Crossroads has two methods of periodic back end verifications: +<p> +<ul> +<p> +<li> The first method only checks unavailable back ends. It is + configured using the directive <code>revivinginterval</code>. + The way <code>revivinginterval</code> works is as follows: +<p> +<ol> + <li> Crossroads determines that a back end is + unavailable. This happens when a new network connection to + the back end fails, or when an existing connection + suddenly dies. +<p> +<li> The back end is the periodically checked to see + if it has woken up yet.</ol> +<p> +<li> The second method periodically checks all back ends, + available ones and unavailable ones. This is configured using + <code>checkinterval</code>. During each check, back ends can be marked + as available or as unavailable.</ul> +<p> +<a name="l59"></a> +<strong>5.3.1: Syntax</strong> +<p> +The syntax of both verifications is: +<p> +<center><em>method</em><code>interval</code> <em>seconds</em> <code>[</code> <code>externalhandler</code> +<em>program</em> <em>arguments</em> <code>]</code></center> +<p> +In this syntax, the method is <code>reviving</code> or <code>check</code>. The seconds +specifier defines the delay between consecutive checks. +<p> +When no specification <code>externalhandler</code> <em>program</em> <em>arguments</em> is +given, then Crossroads runs the verification by trying to connect to +the back end. A simple successful connection suffices to cause +Crossroads to consider the back end available. However, when the +<code>externalhandler</code> specifier is given, then Crossroads runs the +specified external program. This program must exit with status 0 to +inform Crossroads that the back end is available. All other exit +statuses will mark the back end as unavailable. +<p> +The <em>arguments</em> are expanded according to the following table: +<p> +<ul> + <li> <code>%a</code> is the availability of the current back end, when + a current back end is established; + <li> <code>%1a</code> is the availability of the first back end (0 when + unavailable, 1 if available); <code>%2a</code> is the availability of + the second back end, and so on; + <li> <code>%b</code> is the name of the current back end, when one is + established; + <li> <code>%1b</code> is the name of the first back end, <code>%2b</code> of the + second back end, and so on; + <li> <code>%e</code> is the count of seconds since start of epoch + (January 1st 1970 GMT); + <li> <code>%h</code> is the host name of the current back end; + <li> <code>%1h</code> is the host name of the first back end, <code>%2h</code> + of the second back end, and so on; + <li> <code>%p</code> is the TCP port of the current back end; + <li> <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of + the second back end, and so on; + <li> <code>%r</code> is the IP address of the client that requests a + connection and for whom the external dispatcher should compute + a back end; + <li> <code>%s</code> is the name of the current service that the client + connected to; + <li> <code>%t</code> is the current local time in ASCII format, in + <em>YYYY-MM-DD/hhh:mm:ss</em>; + <li> <code>%T</code> is the current GMT time in ASCIII format; + <li> <code>%v</code> is the Crossroads version; + <li> Any other chararacter following a <code>%</code> sign is taken + literally; e.g. <code>%z</code> is just a z.</ul> +<p> +<a name="l60"></a> +<strong>5.3.2: Security Considerations</strong> +<p> +When <code>externalhandler</code> is in effect, Crossroads spawns an external +process. For security reasons, you may want to run this process under +a restricted user account. +<p> +The directive <code>useraccount</code> can be used to accomplish this. +<p> +<a name="l61"></a> +<strong>5.3.3: An example</strong> +<p> +The following configuration balances SMTP requests to two back +ends. The connectivity is checked by retrieving output from each back +end. The back end is available when the standard greeting of a mail +server is seen; this greeting must contain the word SMTP. During each +check the probe is terminated by sending <code>quit</code>. +<p> +<pre> +/* Use either DEBUG on or off */ +#define DEBUG off + +/* SMTP balancer */ +service smtp { + /* Standard stuff */ + port 25; + verbosity DEBUG; + /* Check back ends every 30 seconds. User 'nobody' + * will run the external handler. */ + useraccount nobody; + checkinterval 30 + externalhandler "echo quit | netcat -w1 %h %p | grep SMTP"; + + /* Two back ends to handle mail traffic. */ + backend mailone { + server smtp1.local.network:25; + verbosity DEBUG; + } + backend second { + server smtp2.local.network:25; + verbosity DEBUG; + } +} +</pre> + +<p> +<a name="l62"></a> +<h3>5.4: Throttling the number of concurrent connections</h3> <a name="tips/throttling"></a>If you suspect that your service may occasionally receive 'spikes' of activity (which you should always assume), then it might be a good idea to protect your service by specifying a maximum number of @@ -1989,8 +2193,8 @@ too much, a situation may occur where that back end is about to be hit. A <code>maxconnections</code> statement on the level of that back may then protect it. <p> -<a name="l56"></a> -<h3>5.4: TCP Session Stickiness</h3> +<a name="l63"></a> +<h3>5.5: TCP Session Stickiness</h3> <a name="tips/tcpstickiness"></a>If you need to make sure that a client that once gets dispatched to a given back end keeps re-visiting the back end, then Crossroads offers the dispatch mode <code>byclientip</code>. This mode will only work when each @@ -2014,16 +2218,16 @@ If the preferred back end is unavailable, then the action that Crossroads takes is to dispatch as if <code>byconnections</code>: of the available back ends, the one with the least connections is taken. <p> -<a name="l57"></a> -<h3>5.5: HTTP Session Stickiness</h3> +<a name="l64"></a> +<h3>5.6: HTTP Session Stickiness</h3> <a name="tips/httpstickiness"></a>This section focuses on HTTP session stickiness. This term refers to the ability of a balancer to route a conversation between browser and a backend farm with webservers always to the same back end. In other words: once a back end is selected by the balancer, it will remain the back end of choice, even for subsequent connections. <p> -<a name="l58"></a> -<strong>5.5.1: Don't use stickiness!</strong> +<a name="l65"></a> +<strong>5.6.1: Don't use stickiness!</strong> <p> The rule of thumb as far as the balancer is concerned, is: <strong>Do not use HTTP session stickiness unless you really have to.</strong> Enabling @@ -2054,8 +2258,8 @@ that all PHP applications have access to these data. Application servers such as Websphere can be configured to replicate session data between nodes. <p> -<a name="l59"></a> -<strong>5.5.2: But if you must..</strong> +<a name="l66"></a> +<strong>5.6.2: But if you must..</strong> <p> If you really need stickiness, think first whether you might use TCP stickiness (using the client's IP address to dispatch). If you can, @@ -2088,7 +2292,7 @@ proceed as follows: <code>http</code>. <li> Furthermore, set the <code>headerinspection</code> to <code>shallow</code> (unless of course you also want to modify other HTTP headers, - see section <a href="crossroads.html#tips/deeporshallow">5.7</a>). + see section <a href="crossroads.html#tips/deeporshallow">5.8</a>). <li> At the level of each back end description, configure the <code>stickycookie</code> and a <code>addclientheader</code> directives.</ul> <p> @@ -2136,8 +2340,8 @@ Note how the cookie names and values in the directives <code>stickycookie</code> and <code>addclientheader</code> match. That is obviously a prerequisite for stickiness. <p> -<a name="l60"></a> -<h3>5.6: Passing the client's IP address</h3> +<a name="l67"></a> +<h3>5.7: Passing the client's IP address</h3> <a name="tips/clientip"></a>Since Crossroads just shuttles bytes to and fro, meta-information of network connections is lost. As far as the back ends are concerned, their connections originate at the Crossroads junction. @@ -2153,7 +2357,7 @@ configuration must state the following: <li> The service type must be <code>http</code>, and not <code>any</code>; <li> Make sure that the <code>headerinspection</code> is <code>deep</code> (or that there is no <code>headerinspection</code> statement, since <code>deep</code> is - the default, see section <a href="crossroads.html#tips/deeporshallow">5.7</a>); + the default, see section <a href="crossroads.html#tips/deeporshallow">5.8</a>); <li> In the back end definition, the following statement must occur: <br> <code>addserverheader "X-Real-IP: %r";</code> <br> @@ -2166,8 +2370,8 @@ header: <code>X-Real-IP</code>, holding the client's IP address. performance will be hampered -- all passing messages will have to be unpacked and analyzed. <p> -<a name="l61"></a> -<strong>5.6.1: Sample Crossroads configuration</strong> +<a name="l68"></a> +<strong>5.7.1: Sample Crossroads configuration</strong> <p> The below sample configuration shows two HTTP back ends that receive the client's IP address: @@ -2193,8 +2397,8 @@ service www { </pre> <p> -<a name="l62"></a> -<strong>5.6.2: Sample Apache configuration</strong> +<a name="l69"></a> +<strong>5.7.2: Sample Apache configuration</strong> <p> The method by which each back end analyzes the header <code>X-Real-IP</code> will obviously be different per server implementations. However, a @@ -2225,8 +2429,8 @@ LogFormat "%{X-Real-IP}i %l %u %t %D \"%r\" %>s %b" common </pre> <p> -<a name="l63"></a> -<h3>5.7: Deep or shallow HTTP header inspection</h3> +<a name="l70"></a> +<h3>5.8: Deep or shallow HTTP header inspection</h3> <a name="tips/deeporshallow"></a>The service-level directive <code>headerinspection</code> defines which HTTP headers Crossroads will analyze. Often, several HTTP requests and responses will be served over one network @@ -2337,8 +2541,8 @@ In these examples, <code>shallow</code> mode is not usable, because the HTTP server signature. All subsequent transactions would still show the HTTP server signature to the world.</ul> <p> -<a name="l64"></a> -<h3>5.8: Debugging network traffic</h3> +<a name="l71"></a> +<h3>5.9: Debugging network traffic</h3> <a name="tips/debugging"></a> Incase the traffic between client and backend must be debugged, the statement <code>trafficlog</code> <em>filename</em> can @@ -2460,10 +2664,10 @@ Summarizing, the throughput times of a client-back end connection analyze the output and to compute round trip times. Such scripts are not (yet) included in Crossroads. <p> -<a name="l65"></a> -<h3>5.9: IP filtering: Limiting Access by Client IP Address</h3> -<a name="tips/ipfiltering"></a><a name="l66"></a> -<strong>5.9.1: General Examples</strong> +<a name="l72"></a> +<h3>5.10: IP filtering: Limiting Access by Client IP Address</h3> +<a name="tips/ipfiltering"></a><a name="l73"></a> +<strong>5.10.1: General Examples</strong> <p> The directives <code>allowfrom</code>, <code>denyfrom</code>, <code>allowfile</code> and <code>denyfile</code> can be used to instruct Crossroads to specifically allow @@ -2499,8 +2703,8 @@ with 192.168.1. The specifier <code>192.168.1/24</code> states that there are three network bytes (192, 168 and 1), and 24 bits (or 3 bytes) are relevant; so that the fourth network byte doesn't matter. <p> -<a name="l67"></a> -<strong>5.9.2: Using External Files</strong> +<a name="l74"></a> +<strong>5.10.2: Using External Files</strong> <p> The directives <code>allowfile</code> and <code>denyfile</code> allow you to specify IP addresses in external files. The Crossroads configuration states @@ -2531,8 +2735,8 @@ is running, you may edit <code>/tmp/allow.txt</code>, and then issue <code>killa -1 crossroads</code>. The new contents of <code>/tmp/allow.txt</code> will be reloaded. <p> -<a name="l68"></a> -<strong>5.9.3: Mixing Directives</strong> +<a name="l75"></a> +<strong>5.10.3: Mixing Directives</strong> <p> Crossroads allows to mix all directives in one service description. However, some mixes are less meaningful than others. It's @@ -2598,15 +2802,15 @@ Crossroads only performs syntactic checking of the configuration. Some of the above samples are syntactically correct, but make no semantic sense: Crossroads doesn't warn for such situations. <p> -<a name="l69"></a> -<h3>5.10: Using an external program to dispatch</h3> <a name="externalhandler"></a> +<a name="l76"></a> +<h3>5.11: Using an external program to dispatch</h3> <a name="externalhandler"></a> <a name="tips/externalhandler"></a>As mentioned before, Crossroads supports several built-in dispatch modes. However, you are always free to hook-in your own dispatch mode that determines the next back end using your own specific algorithm. This section explains how to do it. <p> -<a name="l70"></a> -<strong>5.10.1: Configuring the external handler</strong> +<a name="l77"></a> +<strong>5.11.1: Configuring the external handler</strong> <p> First, the <code>dispatchmode</code> statement needs to inform Crossroads that an external program will do the job. The syntax is: <code>dispatchmode @@ -2628,6 +2832,12 @@ format specifiers in the argument list: second back end, and so on; <li> <code>%e</code> is the count of seconds since start of epoch (January 1st 1970 GMT); + <li> <code>%h</code> is the host name of the current back end; + <li> <code>%1h</code> is the host name of the first back end, <code>%2h</code> + of the second back end, and so on; + <li> <code>%p</code> is the TCP port of the current back end; + <li> <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of + the second back end, and so on; <li> <code>%r</code> is the IP address of the client that requests a connection and for whom the external dispatcher should compute a back end; @@ -2645,8 +2855,8 @@ phase in which an external handler is called, since there is no current back end yet (the job of the handler is to supply one, so at the time of calling, <code>%b</code> is undefined). <p> -<a name="l71"></a> -<strong>5.10.2: Writing the external handler</strong> +<a name="l78"></a> +<strong>5.11.2: Writing the external handler</strong> <p> The external handler is activated using the arguments that are specified in /etc/crossroads.conf. The external handler can do @@ -2654,8 +2864,8 @@ whatever it wants, but ultimately, it must write a back end name on its <em>stdout</em>. Crossroads reads this, and if the back end is available, uses that back end for the connection. <p> -<a name="l72"></a> -<strong>5.10.3: Examples of external handlers</strong> +<a name="l79"></a> +<strong>5.11.3: Examples of external handlers</strong> <p> This section shows some examples of Crossroads configurations vs. external handlers. The sample handlers that are shown here, are @@ -3081,8 +3291,8 @@ if ($action eq 'dispatch') { </pre> <p> -<a name="l73"></a> -<h3>5.11: Linux and ip_conntrack_max</h3> +<a name="l80"></a> +<h3>5.12: Linux and ip_conntrack_max</h3> <a name="tips/ipconntrackmax"></a>The kernel value of <code>ip_conntrack_max</code> is important for routers and balancers under Linux. Basically it's the maximum number of tracked connections. Felix A.W.O. describes the following situation: @@ -3118,8 +3328,8 @@ out yourself. Note however that each count will cause the kernel to reserve 350 bytes. So if you set <code>ip_conntrack_max</code> to 100.000, then you're already taking 33.3Mb off the total available memory. <p> -<a name="l74"></a> -<h3>5.12: Marking back ends as bad after more than one try</h3> +<a name="l81"></a> +<h3>5.13: Marking back ends as bad after more than one try</h3> <a name="tips/retries"></a>Crossroads allows you to specify on a per-back end basis how many retries are needed before a back end is considered unavailable. The default is just one, meaning that after one failed connection, @@ -3163,170 +3373,7 @@ retry connecting with a small one-second delay in between. A high <code>retries</code> number means also lots of one-second delays, in which time a client is kept waiting. <p> -<a name="l75"></a> -<h3>5.13: Scripting Crossroads' back end availability</h3> -<a name="tips/scripting"></a>The internal reviving model of Crossroads can periodically check -whether back ends that are unavailable have woken up yet. The checker -is triggered by a <code>revivinginterval</code> statement of a service -description, as in: -<p> -<pre> -service web { - port 80; - revivinginterval 5; - - backend one { - server 10.1.1.1:80; - } - - backend two { - server 10.1.1.2:80; - } -} -</pre> - -<p> -This instructs Crossroads to check back ends <code>one</code> or <code>two</code> each 5 -seconds. A back end is considered available when it accepts TCP -connections on the given IP address and port. -<p> -This approach may not be sufficient in all situations. E.g., a web -server may 'hang': it might accept a connection, but never serve -it. Or, an application server may serve simple connections, but if its -database is offline, it will generate internal server errors on pages -that try to access data. -<p> -In such situations you may want to replace the internal wakeup service -with your own scripted 'health check'. Here's how: -<p> -<ul> - <li> First of all, you take out the <code>revivinginterval</code> - statement of /etc/crossroads.conf, so that Crossroads' - internal check which only verifies TCP connectivity is - disabled. -<p> -<li> You determine a suitable URL in the applications that can - be queried for the health. In our example this will be - <code>/areyouthere.jsp</code>, a hypothetical page that does some - database access. It doesn't even need to return output; just - succeed, or fail. -<p> -<li> You devise a small script that asks Crossroads the status - of back ends of a given service (in our example, service - <code>web</code>). -<p> -<li> The health check script starts by querying Crossroads to - determine whether a given back end is available or not. This - can be done via <code>crossroads -t status</code>; the flag <code>-t</code> - causes Crossroads to emit easily parsable output. -<p> -<li> When the service is available, the health check script - hits a given URL and expects an answer <code>HTTP/1.x 200 - OK</code>. When this answer is not present, the back end is marked - unavailable. (The reason for e.g. <code>HTTP/1.x 500</code> might be a - database failure, as described above.) Marking a back end as - unavailable can be done via <code>crossroads tell</code> <em>service</em> - <em>backend</em> <code>unavailable</code>. -<p> -<li> When the service is unavailable, then the health check - script hits the same given URL. When a <code>HTTP/1.x 200 OK</code> - answer is returned, then the back end has 'woken up' and can - be marked available (using <code>crossroads tell</code>).</ul> -<p> -A sample health check script that does this, is shown below. It is -also in the Crossroads distribution as <code>etc/healthcheck</code>. It expects -three arguments: a testing URL, a service name, and a back end name. -<p> -<pre> -#!/usr/bin/perl - -use strict; -use LWP::UserAgent; - -# Show usage and stop -sub usage () { - die <<"ENDUSAGE"; - -Usage: healthcheck URL SERVICE BACKEND - -Performs a health check of the stated url and if necessary flips the -state of the stated back end between 'available' and 'unavailable'. -Back ends that are 'down' are not affected. - -ENDUSAGE -} - -# Test an URL. Return whether it's a success. -sub testurl() { - my $ua = LWP::UserAgent->new(); - my $req = HTTP::Request->new(GET => $ARGV[0]); - my $res = $ua->request($req); - - if ($res->is_success()) { - print ("URL $ARGV[0] indicates success\n"); - return (1); - } else { - print ("URL $ARGV[0] indicates failure\n"); - return (0); - } -} - -# Main starts here -usage() unless ($#ARGV == 2); - -# Get the current state of the back end -open (my $if, "crossroads -t status '$ARGV[1]' '$ARGV[2]' |") - or die ("Cannot run 'crossroads status'\n"); -my $status = <$if>; -close ($if) or die ("'crossroads status' terminated with error\n"); -chomp ($status); -$status =~ s{.*=}{}; -$status =~ s{\s+}{}; - -print ("Back end $ARGV[2] has status $status\n"); -if ($status eq 'UNAVAILABLE') { - if (testurl()) { - print ("Back end $ARGV[2] is now available\n"); - system ("crossroads tell $ARGV[1] $ARGV[2] available") - and die ("'crossroads tell' terminated with error\n"); - } -} elsif ($status eq 'available') { - if (!testurl()) { - print ("Back end $ARGV[2] is is now UNAVAILABLE\n"); - system ("crossroads tell $ARGV[1] $ARGV[2] UNAVAILABLE") - and die ("'crossroads tell' terminated with error\n"); - } -} else { - print ("No action given status '$status'\n"); -} -</pre> - -<p> -Once you have the health checker in place, it can be run e.g. each 10 -seconds in a mini-daemon for back end <code>one</code>: -<p> -<pre> -while [ 1 ] ; do - healthcheck http://10.1.1.1/areyouthere.jsp web one - sleep 10 -done -</pre> - -<p> -The same is run for back end <code>two</code>: -<p> -<pre> -while [ 1 ] ; do - healthcheck http://10.1.1.2/areyouthere.jsp web two - sleep 10 -done -</pre> - -<p> -The further implementation of such a mini-daemon that fires up -<code>healthcheck</code> is left to the reader. -<p> -<a name="l76"></a> +<a name="l82"></a> <h3>5.14: Using the Web Interface crossroads-mgr</h3> <a name="tips/webinterface"></a>The mini-webserver <code>crossroads-mgr</code> provides an intuitive web interface to the state of Crossroads. Once started, an administrator @@ -3377,7 +3424,7 @@ The web interface doesn't offer extra functionality over the command line tools; but all information is available at one glance, and accessible without a shell access to the balancer. <p> -<a name="l77"></a> +<a name="l83"></a> <strong>5.14.1: Starting crossroads-mgr</strong> <p> The basic command to start <code>crossroads-mgr</code> is @@ -3440,7 +3487,7 @@ echo -e 'viewer:showme\nmodifier:changeit' | </pre> <p> -<a name="l78"></a> +<a name="l84"></a> <h3>5.15: Rendering Crossroads' status in a web page</h3> <a name="xmlstatus"></a> <a name="tips/rendering"></a>The Crossroads flag <code>-x</code> causes the status output to be generated as an XML document. This format can be nicely used to render the output @@ -3510,7 +3557,7 @@ somewhat more liberal. There are basically two options: users belonging to the same group as the Crossroads starter can run <code>crossroads status</code>.</ul> <p> -<a name="l79"></a> +<a name="l85"></a> <h3>5.16: Crossroads and DNS caching</h3> <a name="tips/dnscaching"></a> The option <code>-d</code> allows you to control Crossroads' built in DNS @@ -3534,13 +3581,13 @@ Crossroads to use its DNS cache to store results. Each result is stored for up to <em>nsec</em> seconds - after that, a new request for the back end will lead to a new DNS lookup. <p> -<a name="l80"></a> +<a name="l86"></a> <h2>6: Benchmarking</h2> <a name="benchmarking"></a>This section shows how crossroads affects the transmitting of HTML data when used as an intermediate 'station' through which all data travels. <p> -<a name="l81"></a> +<a name="l87"></a> <h3>6.1: Benchmark 1: Accessing a proxy via crossroads or directly</h3> <p> The benchmark was run on a system where the following was varied: @@ -3568,7 +3615,7 @@ service HttpProxy { </pre> <p> -<a name="l82"></a> +<a name="l88"></a> <strong>6.1.1: Results</strong> <p> The results of this test are that crossroads causes a negligible @@ -3591,7 +3638,7 @@ sys 0m0.230s </pre> <p> -<a name="l83"></a> +<a name="l89"></a> <strong>6.1.2: Discussion</strong> <p> The above shown results are quite favorable to crossroads. However, @@ -3623,7 +3670,7 @@ seldom in the real world: back end). Again, this processing time will weigh much heavier than the multiple read/writes.</ul> <p> -<a name="l84"></a> +<a name="l90"></a> <h3>6.2: Benchmark 2: Crossroads versus Linux Virtual Server (LVS)</h3> <p> LVS is a kernel-based balancer that acts like a masquerading @@ -3637,7 +3684,7 @@ LVS isn't aware of downtime of back ends (unless one implements an external heartbeat). Also, crossroads offers more complex balancing than LVS. <p> -<a name="l85"></a> +<a name="l91"></a> <strong>6.2.1: Environment</strong> <p> On the balancer, LVS was run on port 80, its forwarding set up for two @@ -3668,7 +3715,7 @@ service http { </pre> <p> -<a name="l86"></a> +<a name="l92"></a> <strong>6.2.2: Tests and results</strong> <p> In the first test, ports 80 and 81 on the balancer were 'bombed' with @@ -3747,36 +3794,10 @@ are shown in the below table: Again, the results show that crossroads performs just as effectively as LVS, even with large data chunks! <p> -<a name="l87"></a> -<h2>7: The Web Interface</h2> -<a name="webinterface"></a>An auxiliary program is distributed with Crossroads, named -<code>crossroads-mgr</code>, providing a web interface to the balancer. With -<code>crossroads-mgr</code>, it is possible to: -<p> -<ul> - <li> View the status of the balancer (availablility of back ends, - their connections, and usage in bytes and seconds); -<p> -<li> Change the availability of back ends (available, unavailable, - down).</ul> -<p> -The program <code>crossroads-mgr</code> is in fact a Perl script, providing a -self-contained web server. It is started as follows: -<p> -<center><code>crossroads-mgr start</code> <em>portnumber</em></center> -<p> -where <em>portnumber</em> is the TCP port. The web interface can then be -accessed using the URL <code>http://</code><em>hostname</em><code>:</code><em>portnumber</em>; -where <em>hostname</em> is the host where the balancer and the web -interface run. -<p> -More information is available via the manual page (see <code>man</code> -<code>crossroads-mgr</code>). -<p> -<a name="l88"></a> -<h2>8: Compiling and Installing</h2> <a name="installation"></a> -<a name="compiling"></a><a name="l89"></a> -<h3>8.1: Prerequisites</h3> +<a name="l93"></a> +<h2>7: Compiling and Installing</h2> <a name="installation"></a> +<a name="compiling"></a><a name="l94"></a> +<h3>7.1: Prerequisites</h3> <p> The creation of crossroads requires: <p> @@ -3794,8 +3815,8 @@ The creation of crossroads requires: Basically a Linux or Apple MacOSX box will do nicely. To compile and install crossroads, follow these steps. <p> -<a name="l90"></a> -<h3>8.2: Compiling and installing</h3> +<a name="l95"></a> +<h3>7.2: Compiling and installing</h3> <p> <ul> <li> Obtain the source distribution. It can be found on @@ -3858,8 +3879,8 @@ crossroads, follow these steps. <p> </ul> <p> -<a name="l91"></a> -<h3>8.3: Configuring crossroads</h3> +<a name="l96"></a> +<h3>7.3: Configuring crossroads</h3> <p> Now that the binary is available on your system, you need to create a suitable /etc/crossroads.conf. Use this manual to get started. @@ -3906,14 +3927,14 @@ which crossroads daemons are running. Finally, the tailing of <code>/var/log/messages</code> shows what's going on -- especially if you have <code>verbosity true</code> statements in the configuration. <p> -<a name="l92"></a> -<h3>8.4: A boot script</h3> +<a name="l97"></a> +<h3>7.4: A boot script</h3> <p> Finally, you may want to create a boot-time startup script. The exact procedure depends on the used Unix flavor. <p> -<a name="l93"></a> -<strong>8.4.1: SysV Style Startup</strong> +<a name="l98"></a> +<strong>7.4.1: SysV Style Startup</strong> <p> On SysV style systems, there's a startup script directory <code>/etc/init.d</code> where bootscripts for all utilities are located. @@ -3927,12 +3948,14 @@ otherwise the steps will resemble the following. <p> <pre> #!/bin/sh -/usr/local/bin/crossroads -v $@ -/usr/local/bin/crossroads-mgr start 1000 +/usr/local/bin/crossroads -v $1 +/usr/local/bin/crossroads-mgr $1 1000 </pre> <p> -The stated directory <code>/usr/local/bin</code> must correspond with +<code>init</code> will supply the right value for <code>$1</code>: "start" + during startup, and "stop" during shutdown. Note that + the stated directory <code>/usr/local/bin</code> must correspond with the installation path. <p> In the first line, The flag <code>-v</code> causes the startup to be @@ -3964,8 +3987,8 @@ If your runlevel is 5, then the right <code>cd</code> command is to <code>/etc/rc.d/rc5.d</code>. Alternatively, you can create the symlinks in both runlevel directories.</ul> <p> -<a name="l94"></a> -<strong>8.4.2: BSD Style Startup</strong> +<a name="l99"></a> +<strong>7.4.2: BSD Style Startup</strong> <p> On BSD style systems, daemons are booted directly from <code>/etc/rc</code> and related scripts. Incase you have a file <code>/etc/rc.local</code>, edit it, diff --git a/doc/crossroads.pdf b/doc/crossroads.pdf Binary files differ. diff --git a/doc/main/compiling.yo b/doc/main/compiling.yo @@ -144,10 +144,12 @@ itemization( verb(\ #!/bin/sh -/usr/local/bin/crossroads -v $@ -/usr/local/bin/crossroads-mgr start 1000) +/usr/local/bin/crossroads -v $1 +/usr/local/bin/crossroads-mgr $1 1000) - The stated directory tt(/usr/local/bin) must correspond with + tt(init) will supply the right value for tt($1): "start" + during startup, and "stop" during shutdown. Note that + the stated directory tt(/usr/local/bin) must correspond with the installation path. In the first line, The flag tt(-v) causes the startup to be diff --git a/doc/main/conf/checkinterval.yo b/doc/main/conf/checkinterval.yo @@ -0,0 +1,22 @@ +conf(checkinterval - Periodic back end checks) + (When a check interval is stated, Crossroads will periodically + probe back ends to determine whether available back ends are + still there, and to see whether unavailable back ends have woken + up yet. + + An example is tt(checkinterval 10). When this is stated, + Crossroads will probe all back ends each 10 seconds.) + (itemization( + it() tt(checkinterval) em(number); + it() tt(checkinterval) em(number) tt(externalhandler) + em(program arguments);) + The first form checks bhy connecting to the back end server. + If the connection succeeds, then the back end is considered + available; otherwise the back end is considered unavailable. + + The second form activates an external program (see section + ref(tips/periodic) for a description). The back end is considered + available if the program's exit status is zero; otherwise it is + considered unavailable.) + (0 (no periodic checks)) + diff --git a/doc/main/conf/onhooks.yo b/doc/main/conf/onhooks.yo @@ -16,7 +16,9 @@ conf(onstart, onend, onfail - Action Hooks) command is expanded according to the following table: INCLUDEFILE(formattable)) - (itemization( + (The syntax of the commands is as follows. + + itemization( it() tt(onstart) em(commandline) it() tt(onend) em(commandline) it() tt(onfail) em(commandline) diff --git a/doc/main/conf/revivinginterval.yo b/doc/main/conf/revivinginterval.yo @@ -1,5 +1,5 @@ conf(revivinginterval - Back end wakeup calls) - (A reviving interval definition is needed when crossroads + (A reviving interval definition is used when Crossroads determines that a back end is temporarily unavailable. This will happen when: @@ -8,11 +8,19 @@ conf(revivinginterval - Back end wakeup calls) fails); it() The network connection to the back end suddenly dies.) + Once a reviving interval is set, Crossroads will periodically + check the unavailable back end(s) to see whether they have woken up. + An example of the definition is tt(revivinginterval 10). When this reviving interval is given, crossroads will check each 10 seconds - whether unavailable back ends have woken up yet. A back end is - considered awake when a network connection to that back end can - succesfully be established.) - (tt(revivinginterval) em(number), where the number is the interval - in seconds.) + whether unavailable back ends have woken up yet.) + (itemization( + it() tt(revivinginterval) em(number); + it() tt(revivinginterval) em(number) tt(externalhandler) + em(program arguments);) + The first form connects to a back end server. If the connection + succeeds, then the back end is considered available. The second + form activates an external program (see section + ref(tips/periodic) for a description). The back end is marked + available if the program's exit status is zero.) (0 (no wakeup calls)) diff --git a/doc/main/config.yo b/doc/main/config.yo @@ -145,6 +145,7 @@ includefile(conf/bindto) includefile(conf/verbose) includefile(conf/dispatchmode) includefile(conf/revivinginterval) +includefile(conf/checkinterval) includefile(conf/maxconnections) includefile(conf/backlog) includefile(conf/shmkey) diff --git a/doc/main/crossroads.yo b/doc/main/crossroads.yo @@ -39,9 +39,6 @@ includefile(tips) sect(Benchmarking) includefile(benchmarking) -sect(The Web Interface) -includefile(webinterface) - sect(Compiling and Installing) label(installation) includefile(compiling) diff --git a/doc/main/formattable.yo b/doc/main/formattable.yo @@ -10,6 +10,12 @@ itemization( second back end, and so on; it() tt(%e) is the count of seconds since start of epoch (January 1st 1970 GMT); + it() tt(%h) is the host name of the current back end; + it() tt(%1h) is the host name of the first back end, tt(%2h) + of the second back end, and so on; + it() tt(%p) is the TCP port of the current back end; + it() tt(%1p) is the TCP port of the first back end, tt(%2p) of + the second back end, and so on; it() tt(%r) is the IP address of the client that requests a connection and for whom the external dispatcher should compute a back end; diff --git a/doc/main/impatient.yo b/doc/main/impatient.yo @@ -1,13 +1,13 @@ For the impatient, here's the very-quick-but-very-superficial recipy -for getting crossroads up and running: +for getting Crossroads up and running: itemization( it() If you don't have SVN or don't want to use it: itemization( - it() Obtain the crossroads source archive at + it() Obtain the Crossroads source archive at lurl(http://crossroads.e-tunity.com). it() Change-dir to a 'sources' directory on your system and @@ -18,6 +18,7 @@ itemization( it() If you have SVN and want to go for the newest snapshot: itemization( + it() Get the latest sources and snapshots using SVN from nl() tt(svn://svn.e-tunity.com/crossroads). @@ -32,7 +33,7 @@ itemization( em(X.YY) is a release ID. In the latter case, change-dir to tt(crossroads/trunk).) - it() Type tt(make install). This installs the crossroads + it() Type tt(make install). This installs the Crossroads binary into tt(/usr/local/bin/). If the compilation doesn't work on your system, check tt(etc/Makefile.def) for hints. @@ -56,10 +57,15 @@ service www { it() Type tt(crossroads start). - it() Surf to the machine where crossroads is running. You will + it() Surf to the machine where Crossroads is running. You will see the pages served by the back ends 10.1.1.100 or 10.1.1.101. - it() To monitor the status of crossroads, type tt(crossroads - status). + it() To monitor the status of Crossroads from the command + line, type tt(crossroads status). + + it() If you want to monitor Crossroads via a web front end, + start the manager: type tt(crossroads-mgr start 1000). Next + point your browser to the machine where Crossroads is + running, port 1000. ) diff --git a/doc/main/tips.yo b/doc/main/tips.yo @@ -8,6 +8,9 @@ includefile(tips/examples) subsect(How back ends are selected in load balancing) label(howselected) includefile(tips/howselected) +subsect(Periodic probes and wake up calls) +includefile(tips/periodic) + subsect(Throttling the number of concurrent connections) includefile(tips/throttling) @@ -38,9 +41,6 @@ includefile(tips/ipconntrackmax) subsect(Marking back ends as bad after more than one try) includefile(tips/retries) -subsect(Scripting Crossroads' back end availability) -includefile(tips/scripting) - subsect(Using the Web Interface crossroads-mgr) includefile(tips/webinterface) diff --git a/doc/main/tips/periodic.yo b/doc/main/tips/periodic.yo @@ -0,0 +1,89 @@ +Crossroads has two methods of periodic back end verifications: + +itemization( + + it() The first method only checks unavailable back ends. It is + configured using the directive tt(revivinginterval). + The way tt(revivinginterval) works is as follows: + + enumeration( + eit() Crossroads determines that a back end is + unavailable. This happens when a new network connection to + the back end fails, or when an existing connection + suddenly dies. + + eit() The back end is the periodically checked to see + if it has woken up yet.) + + it() The second method periodically checks all back ends, + available ones and unavailable ones. This is configured using + tt(checkinterval). During each check, back ends can be marked + as available or as unavailable.) + + +subsubsect(Syntax) + +The syntax of both verifications is: + +center(em(method)tt(interval) em(seconds) tt([) tt(externalhandler) +em(program) em(arguments) tt(])) + +In this syntax, the method is tt(reviving) or tt(check). The seconds +specifier defines the delay between consecutive checks. + +When no specification tt(externalhandler) em(program) em(arguments) is +given, then Crossroads runs the verification by trying to connect to +the back end. A simple successful connection suffices to cause +Crossroads to consider the back end available. However, when the +tt(externalhandler) specifier is given, then Crossroads runs the +specified external program. This program must exit with status 0 to +inform Crossroads that the back end is available. All other exit +statuses will mark the back end as unavailable. + +The em(arguments) are expanded according to the following table: + +INCLUDEFILE(formattable) + + +subsubsect(Security Considerations) + +When tt(externalhandler) is in effect, Crossroads spawns an external +process. For security reasons, you may want to run this process under +a restricted user account. + +The directive tt(useraccount) can be used to accomplish this. + + +subsubsect(An example) + +The following configuration balances SMTP requests to two back +ends. The connectivity is checked by retrieving output from each back +end. The back end is available when the standard greeting of a mail +server is seen; this greeting must contain the word SMTP. During each +check the probe is terminated by sending tt(quit). + +verb(\ +/* Use either DEBUG on or off */ +#define DEBUG off + +/* SMTP balancer */ +service smtp { + /* Standard stuff */ + port 25; + verbosity DEBUG; + /* Check back ends every 30 seconds. User 'nobody' + * will run the external handler. */ + useraccount nobody; + checkinterval 30 + externalhandler "echo quit | netcat -w1 %h %p | grep SMTP"; + + /* Two back ends to handle mail traffic. */ + backend mailone { + server smtp1.local.network:25; + verbosity DEBUG; + } + backend second { + server smtp2.local.network:25; + verbosity DEBUG; + } +}) diff --git a/doc/main/tips/scripting.yo b/doc/main/tips/scripting.yo @@ -1,152 +0,0 @@ -The internal reviving model of Crossroads can periodically check -whether back ends that are unavailable have woken up yet. The checker -is triggered by a tt(revivinginterval) statement of a service -description, as in: - -verb(\ -service web { - port 80; - revivinginterval 5; - - backend one { - server 10.1.1.1:80; - } - - backend two { - server 10.1.1.2:80; - } -}) - -This instructs Crossroads to check back ends tt(one) or tt(two) each 5 -seconds. A back end is considered available when it accepts TCP -connections on the given IP address and port. - -This approach may not be sufficient in all situations. E.g., a web -server may 'hang': it might accept a connection, but never serve -it. Or, an application server may serve simple connections, but if its -database is offline, it will generate internal server errors on pages -that try to access data. - -In such situations you may want to replace the internal wakeup service -with your own scripted 'health check'. Here's how: - -itemization( - it() First of all, you take out the tt(revivinginterval) - statement of DEFAULTCONF(), so that Crossroads' - internal check which only verifies TCP connectivity is - disabled. - - it() You determine a suitable URL in the applications that can - be queried for the health. In our example this will be - tt(/areyouthere.jsp), a hypothetical page that does some - database access. It doesn't even need to return output; just - succeed, or fail. - - it() You devise a small script that asks Crossroads the status - of back ends of a given service (in our example, service - tt(web)). - - it() The health check script starts by querying Crossroads to - determine whether a given back end is available or not. This - can be done via tt(crossroads -t status); the flag tt(-t) - causes Crossroads to emit easily parsable output. - - it() When the service is available, the health check script - hits a given URL and expects an answer tt(HTTP/1.x 200 - OK). When this answer is not present, the back end is marked - unavailable. (The reason for e.g. tt(HTTP/1.x 500) might be a - database failure, as described above.) Marking a back end as - unavailable can be done via tt(crossroads tell) em(service) - em(backend) tt(unavailable). - - it() When the service is unavailable, then the health check - script hits the same given URL. When a tt(HTTP/1.x 200 OK) - answer is returned, then the back end has 'woken up' and can - be marked available (using tt(crossroads tell)).) - -A sample health check script that does this, is shown below. It is -also in the Crossroads distribution as tt(etc/healthcheck). It expects -three arguments: a testing URL, a service name, and a back end name. - -verb(\ -#!/usr/bin/perl - -use strict; -use LWP::UserAgent; - -# Show usage and stop -sub usage () { - die <<"ENDUSAGE"; - -Usage: healthcheck URL SERVICE BACKEND - -Performs a health check of the stated url and if necessary flips the -state of the stated back end between 'available' and 'unavailable'. -Back ends that are 'down' are not affected. - -ENDUSAGE -} - -# Test an URL. Return whether it's a success. -sub testurl() { - my $ua = LWP::UserAgent->new(); - my $req = HTTP::Request->new(GET => $ARGV[0]); - my $res = $ua->request($req); - - if ($res->is_success()) { - print ("URL $ARGV[0] indicates success\n"); - return (1); - } else { - print ("URL $ARGV[0] indicates failure\n"); - return (0); - } -} - -# Main starts here -usage() unless ($#ARGV == 2); - -# Get the current state of the back end -open (my $if, "crossroads -t status '$ARGV[1]' '$ARGV[2]' |") - or die ("Cannot run 'crossroads status'\n"); -my $status = <$if>; -close ($if) or die ("'crossroads status' terminated with error\n"); -chomp ($status); -$status =~ s{.*=}{}; -$status =~ s{\s+}{}; - -print ("Back end $ARGV[2] has status $status\n"); -if ($status eq 'UNAVAILABLE') { - if (testurl()) { - print ("Back end $ARGV[2] is now available\n"); - system ("crossroads tell $ARGV[1] $ARGV[2] available") - and die ("'crossroads tell' terminated with error\n"); - } -} elsif ($status eq 'available') { - if (!testurl()) { - print ("Back end $ARGV[2] is is now UNAVAILABLE\n"); - system ("crossroads tell $ARGV[1] $ARGV[2] UNAVAILABLE") - and die ("'crossroads tell' terminated with error\n"); - } -} else { - print ("No action given status '$status'\n"); -}) - -Once you have the health checker in place, it can be run e.g. each 10 -seconds in a mini-daemon for back end tt(one): - -verb(\ -while [ 1 ] ; do - healthcheck http://10.1.1.1/areyouthere.jsp web one - sleep 10 -done) - -The same is run for back end tt(two): - -verb(\ -while [ 1 ] ; do - healthcheck http://10.1.1.2/areyouthere.jsp web two - sleep 10 -done) - -The further implementation of such a mini-daemon that fires up -tt(healthcheck) is left to the reader. diff --git a/doc/main/using.yo b/doc/main/using.yo @@ -1,4 +1,6 @@ -Crossroads is started from the commandline, and highly depends on +subsect(The Balancer: crossroads) + +The Crossroads balancer is started from the commandline, and highly depends on DEFAULTCONF() (the default configuration file). It supports a number of flags (e.g., to overrule the location of the configuration file). The actual usage information is always obtained @@ -10,7 +12,7 @@ second program called tt(crossroads-daemon). This program is not meant to be started from the command line; it is administered through the front end tt(crossroads). -subsect(General Commandline Syntax) +subsubsect(General Commandline Syntax) This section shows the most basic usage. As said above, start tt(crossroads) without arguments to view the full listing of options. @@ -45,7 +47,7 @@ itemization( configuration DEFAULTCONF(). ) -subsect(Status Reporting) +subsubsect(Status Reporting from the Command Line) The command tt(crossroads status) shows a verbose human-readable report of how Crossroads is doing. When many services are configured, @@ -80,7 +82,7 @@ control over Crossroads, or if you want to show the status via the web. (See section ref(xmlstatus) for more information.) -subsect(Logging-related options) +subsubsect(Logging-related options) Two 'flags' of Crossroads are specifically logging-related. This section elaborates on these flags. @@ -120,7 +122,7 @@ itemization( messages.) -subsect(Reloading Configurations) +subsubsect(Reloading Configurations) Crossroads doesn't support the reloading of a configuration while running (such as other programs, e.g. Apache do). There are various @@ -129,3 +131,21 @@ technical reasons for this. However, external lists of allowed or denied IP addresses can be reloaded by sending a signal -1 (tt(SIGHUP)) to Crossroads. See section ref(servicedef) for the details. + + +subsect(The Web Frontend: crossroads-mgr) + +A web front end for Crossroads is tt(crossroads-mgr). Type +tt(crossroads-mgr) without arguments to see the usage. + +Normally the web interface is started like: + +center(tt(crossroads-mgr start 1000)) + +where 1000 is a free TCP port. Note that tt(crossroads-mgr) must be +started on the system where the balancer tt(crossroads) itself is +running. + +There are lots of other options that can be used with +tt(crossroads-mgr), see section ref(tips/webinterface). + diff --git a/doc/main/webinterface.yo b/doc/main/webinterface.yo @@ -1,24 +0,0 @@ -An auxiliary program is distributed with Crossroads, named -tt(crossroads-mgr), providing a web interface to the balancer. With -tt(crossroads-mgr), it is possible to: - -itemization( - it() View the status of the balancer (availablility of back ends, - their connections, and usage in bytes and seconds); - - it() Change the availability of back ends (available, unavailable, - down).) - -The program tt(crossroads-mgr) is in fact a Perl script, providing a -self-contained web server. It is started as follows: - -center(tt(crossroads-mgr start) em(portnumber)) - -where em(portnumber) is the TCP port. The web interface can then be -accessed using the URL tt(http://)em(hostname)tt(:)em(portnumber); -where em(hostname) is the host where the balancer and the web -interface run. - -More information is available via the manual page (see tt(man) -tt(crossroads-mgr)). - diff --git a/etc/Makefile.def b/etc/Makefile.def @@ -6,7 +6,7 @@ # Versioning. This defines the overall version ID and must match the topmost # entry in the ChangeLog. -VER = 1.46 +VER = 1.47 # Years that Crossroads has been 'round. YEARS = 2005-2007 diff --git a/etc/svnrev.txt b/etc/svnrev.txt @@ -1 +1 @@ -177 +178 diff --git a/src/crossroads-daemon/main.c b/src/crossroads-daemon/main.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/crossroads-mgr/crossroads-mgr.in b/src/crossroads-mgr/crossroads-mgr.in @@ -268,19 +268,29 @@ ENDUSAGE ReuseAddr => 1) or $prog->error ("Failed to start HTTP daemon. ", "Maybe the address is in use?"); + $SIG{CHLD} = \&reaper; $prog->daemonize(); $prog->msg ("Open for business"); while (1) { my ($conn, $peer) = $daemon->accept() or next; $prog->msg ("Accepted new connection, spawning handler"); next if (my $pid = fork()); - $SIG{2} = 'IGNORE'; + $prog->msg ("Handler spawned as pid $$"); my $req = Request->new(); eval { $req->serve ($conn); }; $conn->send_error (500, $@) if ($@); exit (0); } - } + } + + # Reaper of stopped child processes. NOTE: Class-less! + sub reaper { + my $child; + while (($child = waitpid (-1, 'WNOHANG')) > 0){ + $prog->msg ("Child process $child stopped with status $?"); + } + $SIG{CHLD} = \&reaper; + } } # Request related stuff diff --git a/src/crossroads-mgr/crossroads-mgr.xslt b/src/crossroads-mgr/crossroads-mgr.xslt @@ -143,8 +143,10 @@ <td class="info"/> <td class="info"> Usage: </td> <td class="info"> - Throughput <xsl:value-of select="throughput"/> in - <xsl:value-of select="duration"/> + Throughput + <b><xsl:value-of select="throughput"/></b> in + <b><xsl:value-of select="duration"/></b>, + <b><xsl:value-of select="lastaccess"/></b> ago </td> </tr> <xsl:apply-templates/> diff --git a/src/crossroads.h b/src/crossroads.h @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -78,11 +78,13 @@ typedef struct { /* Bison/Flex state given files */ typedef enum { /* Config parsing related */ cf_portspec, + cf_backlogspec, cf_verbosityspec, cf_backendspec, cf_serverspec, cf_dispatchspec, cf_revivespec, + cf_checkspec, cf_shmkeyspec, cf_weightspec, cf_decayspec, @@ -193,6 +195,8 @@ typedef struct { /* Service description */ unsigned dispatchover; /* .. selection over # connections */ char *dispatchext; /* .. external handler */ unsigned rev_interval; /* .. dead backend revival interval */ + unsigned check_interval; /* .. backend recheck interval */ + char *check_cmd; /* .. rechecking command */ unsigned backlog; /* .. # pending TCP connections */ unsigned shmkey; /* .. key for SysV IPC */ unsigned connectiontimeout; /* .. # secs for timeout handling */ @@ -234,6 +238,7 @@ typedef struct { /* Backend state */ double avg_nsec; /* .. averaged over # connections */ unsigned nclients; /* .. active clients */ unsigned fail; /* .. failures so far */ + unsigned laststamp; /* .. last usage */ } Backendstate; typedef struct { /* Service reporting (shmem) */ @@ -437,7 +442,7 @@ extern void symtab_end (void); extern char const *symtab_lookup (char const *txt); extern void symtab_set (char const *symbol); extern void symtab_start (char const *symbol); -extern void sysrun (char const *cmd); +extern int sysrun (char const *cmd); extern void tcpserve (int sock); extern int tell_service (int ac, char **av); extern void thruputlog (unsigned char const *buf, int len, CopyDirection dir); diff --git a/src/crossroads/main.c b/src/crossroads/main.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -40,6 +40,10 @@ int main (int argc, char **argv) { if (optind >= argc) usage(); + /* More sanity checks */ + if (xml_status && tabular_status) + error ("Flags -t and -x are mutually exclusive"); + /* Act on the argument. */ for (i = 0; i < sizeof(handler) / sizeof(Handler); i++) { /* Match the handler action string with argv, and match the diff --git a/src/lib/allocreporter.c b/src/lib/allocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ansistamp.c b/src/lib/ansistamp.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/backendavailable.c b/src/lib/backendavailable.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/backendconnect.c b/src/lib/backendconnect.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -60,8 +60,9 @@ int backend_connect () { activeservice->backend[current_backend].server, activeservice->backend[current_backend].port); - /* If retrying, delay a bit */ - if (servicereport->backendstate[current_backend].fail > 0) { + /* If retrying, delay a bit, unless we're in the wakeup handler. */ + if (program_stage != stage_retrying && + servicereport->backendstate[current_backend].fail > 0) { msg ("Service %s: Seen %d retries, waiting a bit", activeservice->name, servicereport->backendstate[current_backend].fail); @@ -103,6 +104,10 @@ int backend_connect () { } alarm(0); signal (SIGALRM, SIG_DFL); + + /* Log the last connect time. */ + servicereport->backendstate[current_backend].laststamp = time(0); + return (sock); } diff --git a/src/lib/backendcount.c b/src/lib/backendcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/choosebackend.c b/src/lib/choosebackend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/configread.c b/src/lib/configread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -62,6 +62,8 @@ void config_read (int fd) { service[i].dispatchover = rd_uns (fd); service[i].dispatchext = rd_str (fd); service[i].rev_interval = rd_uns (fd); + service[i].check_interval = rd_uns (fd); + service[i].check_cmd = rd_str (fd); service[i].backlog = rd_uns (fd); service[i].shmkey = rd_uns (fd); service[i].connectiontimeout = rd_uns (fd); @@ -71,6 +73,7 @@ void config_read (int fd) { service[i].denyfile = rd_str (fd); service[i].uid = rd_int (fd); service[i].gid = rd_int (fd); + service[i].inspection = rd_int (fd); /* Deny chain */ service[i].ndenychain = rd_int (fd); diff --git a/src/lib/configtest.c b/src/lib/configtest.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/configwrite.c b/src/lib/configwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -46,6 +46,8 @@ void config_write (int fd) { wr_uns (fd, service[i].dispatchover); wr_str (fd, service[i].dispatchext); wr_uns (fd, service[i].rev_interval); + wr_uns (fd, service[i].check_interval); + wr_str (fd, service[i].check_cmd); wr_uns (fd, service[i].backlog); wr_uns (fd, service[i].shmkey); wr_uns (fd, service[i].connectiontimeout); @@ -55,6 +57,7 @@ void config_write (int fd) { wr_str (fd, service[i].denyfile); wr_int (fd, service[i].uid); wr_int (fd, service[i].gid); + wr_int (fd, service[i].inspection); /* Deny chain */ wr_int (fd, service[i].ndenychain); diff --git a/src/lib/copysockets.c b/src/lib/copysockets.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/createcommandlinespace.c b/src/lib/createcommandlinespace.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/data.c b/src/lib/data.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/deallocreporter.c b/src/lib/deallocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/decrclientcount.c b/src/lib/decrclientcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/dns.c b/src/lib/dns.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/error.c b/src/lib/error.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/forktcpservicer.c b/src/lib/forktcpservicer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/hashpjw.c b/src/lib/hashpjw.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpcopy.c b/src/lib/httpcopy.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httperror.c b/src/lib/httperror.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderaddheader.c b/src/lib/httpheaderaddheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderappendheader.c b/src/lib/httpheaderappendheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderconnectiontype.c b/src/lib/httpheaderconnectiontype.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderfree.c b/src/lib/httpheaderfree.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderhascookie.c b/src/lib/httpheaderhascookie.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderhttpver.c b/src/lib/httpheaderhttpver.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheadernew.c b/src/lib/httpheadernew.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderread.c b/src/lib/httpheaderread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderremoveheader.c b/src/lib/httpheaderremoveheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheadersetheader.c b/src/lib/httpheadersetheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderval.c b/src/lib/httpheaderval.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderwrite.c b/src/lib/httpheaderwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpinsertheader.c b/src/lib/httpinsertheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpserve.c b/src/lib/httpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpserversocket.c b/src/lib/httpserversocket.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpwrite.c b/src/lib/httpwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/incrclientcount.c b/src/lib/incrclientcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/initsockaddr.c b/src/lib/initsockaddr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/interrupt.c b/src/lib/interrupt.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfaddallow.c b/src/lib/ipfaddallow.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfadddeny.c b/src/lib/ipfadddeny.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfallowed.c b/src/lib/ipfallowed.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfdenied.c b/src/lib/ipfdenied.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfloadfile.c b/src/lib/ipfloadfile.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfmatch.c b/src/lib/ipfmatch.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfparse.c b/src/lib/ipfparse.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ishexdigit.c b/src/lib/ishexdigit.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/isspace.c b/src/lib/isspace.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/lexer.c b/src/lib/lexer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -288,62 +288,63 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 81 -#define YY_END_OF_BUFFER 82 -static yyconst short int yy_accept[477] = +#define YY_NUM_RULES 82 +#define YY_END_OF_BUFFER 83 +static yyconst short int yy_accept[489] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 78, 78, 79, 79, 82, 59, 57, 58, 59, 56, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 59, - 68, 69, 67, 68, 68, 66, 63, 62, 63, 73, - 71, 71, 70, 77, 76, 74, 75, 74, 81, 78, - 79, 80, 57, 60, 0, 56, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 54, 55, 53, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - - 55, 0, 0, 0, 0, 64, 0, 65, 61, 70, - 74, 75, 74, 78, 79, 0, 3, 55, 55, 33, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 53, - 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 31, 55, 55, 55, 55, - 55, 55, 35, 55, 55, 55, 55, 7, 6, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - - 55, 29, 55, 55, 55, 0, 0, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 16, 55, 55, 55, 55, 55, 55, 41, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, - 55, 55, 55, 55, 5, 55, 55, 55, 55, 22, - 55, 55, 55, 55, 55, 55, 55, 55, 40, 55, - 20, 55, 55, 55, 17, 55, 55, 55, 55, 8, - 55, 55, 55, 55, 55, 15, 0, 0, 55, 55, - 55, 55, 55, 55, 9, 10, 55, 55, 55, 23, - - 55, 55, 55, 55, 55, 55, 55, 55, 39, 11, - 55, 55, 4, 55, 55, 32, 55, 55, 55, 55, - 55, 12, 55, 2, 0, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 52, 50, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 1, 55, 55, 51, 49, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 26, 55, 21, 55, 55, 55, 55, 55, 55, - 55, 19, 55, 55, 55, 34, 55, 37, 55, 55, - - 55, 55, 55, 55, 55, 55, 38, 55, 55, 55, - 55, 55, 55, 55, 55, 27, 55, 55, 55, 55, - 55, 55, 18, 55, 55, 55, 55, 55, 55, 42, - 55, 55, 55, 55, 55, 24, 55, 55, 55, 55, - 55, 55, 55, 36, 55, 55, 55, 55, 55, 55, - 55, 14, 55, 55, 55, 43, 46, 55, 55, 55, - 25, 55, 55, 44, 47, 55, 55, 55, 30, 28, - 55, 55, 13, 45, 48, 0 + 79, 79, 80, 80, 83, 60, 58, 59, 60, 57, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 60, + 69, 70, 68, 69, 69, 67, 64, 63, 64, 74, + 72, 73, 71, 78, 77, 75, 76, 75, 82, 79, + 80, 81, 58, 61, 0, 57, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 55, 56, 54, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + + 56, 56, 0, 0, 0, 0, 65, 0, 66, 62, + 71, 75, 76, 75, 79, 80, 0, 3, 56, 56, + 34, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 54, 0, 0, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 32, 56, + 56, 56, 56, 56, 56, 36, 56, 56, 56, 56, + 7, 6, 56, 56, 56, 56, 56, 56, 56, 56, + + 56, 56, 56, 56, 30, 56, 56, 56, 0, 0, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 16, 56, 56, 56, 56, 56, + 56, 42, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 0, 0, 56, 56, 56, 56, 56, 56, 5, 56, + 56, 56, 56, 22, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 41, 56, 20, 56, 56, 56, 17, + 56, 56, 56, 56, 8, 56, 56, 56, 56, 56, + 15, 0, 0, 56, 56, 56, 56, 56, 56, 9, + + 10, 56, 56, 56, 23, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 40, 11, 56, 56, 4, 56, + 56, 33, 56, 56, 56, 56, 56, 12, 56, 2, + 0, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 53, 51, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 1, + 56, 56, 52, 50, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 26, + 56, 21, 56, 56, 56, 56, 56, 56, 56, 56, + + 19, 56, 56, 56, 35, 56, 38, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 39, 56, 56, 56, + 56, 56, 56, 56, 56, 27, 56, 56, 56, 56, + 56, 56, 56, 18, 56, 56, 56, 56, 56, 56, + 43, 56, 56, 56, 56, 56, 24, 29, 56, 56, + 56, 56, 56, 56, 56, 37, 56, 56, 56, 56, + 56, 56, 56, 14, 56, 56, 56, 44, 47, 56, + 56, 56, 25, 56, 56, 45, 48, 56, 56, 56, + 31, 28, 56, 56, 13, 46, 49, 0 } ; static yyconst int yy_ec[256] = @@ -386,262 +387,270 @@ static yyconst int yy_meta[38] = 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst short int yy_base[490] = +static yyconst short int yy_base[502] = { 0, - 0, 571, 35, 41, 46, 47, 55, 67, 79, 109, - 62, 74, 573, 572, 574, 578, 39, 578, 84, 562, - 0, 76, 108, 545, 105, 536, 556, 77, 555, 541, - 105, 540, 114, 115, 113, 536, 547, 546, 545, 141, - 578, 578, 578, 557, 554, 578, 578, 578, 550, 578, - 578, 578, 0, 578, 578, 68, 0, 95, 578, 99, - 0, 578, 103, 578, 556, 547, 0, 540, 532, 519, - 526, 537, 526, 134, 525, 136, 520, 524, 517, 523, - 532, 514, 509, 0, 524, 129, 524, 512, 514, 122, - 507, 136, 115, 516, 508, 142, 508, 517, 505, 511, - - 502, 164, 513, 504, 524, 578, 521, 578, 578, 0, - 153, 0, 165, 168, 0, 524, 578, 155, 499, 0, - 507, 501, 506, 149, 490, 492, 498, 493, 504, 489, - 480, 487, 486, 495, 482, 494, 482, 493, 482, 493, - 475, 476, 473, 486, 473, 479, 474, 466, 159, 474, - 474, 480, 468, 475, 475, 474, 462, 475, 469, 0, - 469, 471, 462, 467, 450, 457, 160, 451, 459, 454, - 450, 461, 440, 458, 439, 0, 455, 459, 441, 442, - 452, 451, 0, 441, 450, 444, 451, 0, 0, 437, - 441, 429, 444, 169, 436, 441, 434, 439, 433, 423, - - 435, 0, 439, 425, 430, 428, 425, 426, 418, 427, - 428, 418, 416, 415, 423, 414, 425, 420, 419, 420, - 0, 168, 404, 405, 407, 403, 405, 0, 406, 400, - 403, 409, 404, 396, 395, 407, 400, 392, 393, 383, - 382, 397, 394, 399, 384, 382, 386, 379, 392, 376, - 170, 163, 391, 387, 0, 380, 387, 373, 374, 0, - 371, 377, 373, 383, 384, 383, 374, 369, 0, 363, - 0, 363, 366, 364, 0, 372, 371, 355, 353, 0, - 161, 365, 369, 368, 176, 0, 365, 365, 355, 362, - 355, 351, 353, 358, 0, 0, 344, 358, 351, 0, - - 350, 353, 345, 348, 349, 343, 340, 347, 0, 0, - 344, 348, 0, 336, 343, 0, 333, 328, 330, 333, - 329, 0, 324, 578, 336, 322, 323, 333, 325, 327, - 319, 325, 315, 318, 317, 0, 0, 318, 323, 320, - 310, 323, 316, 315, 305, 306, 307, 302, 300, 304, - 298, 293, 578, 307, 306, 0, 0, 308, 292, 296, - 301, 296, 295, 293, 297, 304, 289, 285, 289, 288, - 292, 291, 288, 282, 278, 288, 281, 288, 287, 278, - 285, 0, 275, 0, 270, 283, 283, 272, 279, 274, - 264, 0, 276, 275, 270, 0, 267, 0, 259, 275, - - 274, 256, 257, 259, 262, 265, 0, 265, 265, 253, - 261, 264, 263, 258, 248, 0, 257, 256, 251, 250, - 240, 244, 0, 244, 236, 240, 236, 247, 246, 0, - 242, 243, 242, 241, 240, 0, 239, 238, 233, 224, - 220, 234, 233, 0, 221, 220, 234, 233, 219, 216, - 217, 0, 229, 213, 206, 0, 0, 179, 171, 148, - 0, 134, 111, 0, 0, 108, 88, 66, 0, 0, - 67, 31, 0, 0, 0, 578, 199, 203, 207, 211, - 215, 219, 48, 223, 227, 229, 47, 233, 237 + 0, 583, 35, 41, 46, 47, 55, 67, 79, 109, + 62, 74, 585, 584, 586, 590, 39, 590, 84, 574, + 0, 76, 108, 74, 105, 549, 569, 107, 568, 554, + 107, 553, 114, 124, 114, 549, 560, 559, 558, 132, + 590, 590, 590, 570, 567, 590, 590, 590, 563, 590, + 590, 590, 0, 590, 590, 68, 0, 99, 590, 95, + 0, 590, 103, 590, 569, 560, 0, 553, 545, 532, + 539, 550, 539, 130, 546, 537, 135, 532, 536, 529, + 535, 544, 526, 521, 0, 536, 140, 536, 524, 526, + 75, 519, 133, 138, 528, 520, 134, 520, 529, 517, + + 523, 514, 163, 525, 516, 536, 590, 533, 590, 590, + 0, 152, 0, 164, 167, 0, 536, 590, 156, 511, + 0, 519, 513, 518, 149, 502, 504, 510, 515, 504, + 515, 500, 491, 498, 497, 506, 493, 505, 493, 504, + 493, 504, 486, 487, 484, 497, 484, 490, 485, 477, + 158, 485, 485, 491, 479, 486, 486, 485, 473, 486, + 480, 0, 480, 482, 473, 478, 461, 468, 157, 462, + 470, 465, 461, 472, 451, 464, 468, 449, 0, 465, + 469, 451, 452, 462, 461, 0, 451, 460, 454, 461, + 0, 0, 447, 451, 439, 454, 161, 446, 451, 444, + + 449, 443, 433, 445, 0, 449, 435, 440, 438, 435, + 436, 428, 437, 438, 428, 426, 425, 433, 424, 435, + 430, 429, 424, 429, 0, 102, 413, 414, 416, 412, + 414, 0, 415, 409, 412, 418, 413, 405, 404, 416, + 409, 401, 402, 392, 391, 406, 403, 408, 393, 391, + 395, 388, 401, 385, 155, 162, 400, 396, 0, 389, + 396, 382, 383, 0, 385, 379, 385, 381, 391, 392, + 391, 382, 377, 0, 371, 0, 371, 374, 372, 0, + 380, 379, 363, 361, 0, 174, 373, 377, 376, 169, + 0, 373, 373, 363, 370, 363, 359, 361, 366, 0, + + 0, 352, 366, 359, 0, 349, 357, 360, 352, 355, + 356, 350, 347, 354, 0, 0, 351, 355, 0, 343, + 350, 0, 340, 335, 337, 340, 336, 0, 331, 590, + 343, 329, 330, 340, 332, 334, 326, 332, 322, 325, + 333, 323, 0, 0, 324, 329, 326, 316, 329, 322, + 321, 311, 312, 313, 308, 306, 310, 304, 299, 590, + 313, 312, 0, 0, 314, 298, 302, 307, 302, 298, + 300, 298, 302, 309, 294, 290, 294, 293, 297, 296, + 293, 287, 283, 293, 286, 293, 292, 283, 290, 0, + 280, 0, 273, 274, 287, 287, 276, 283, 278, 268, + + 0, 280, 279, 274, 0, 271, 0, 263, 279, 278, + 260, 261, 263, 274, 265, 268, 0, 268, 268, 256, + 264, 267, 266, 261, 251, 0, 260, 259, 254, 253, + 243, 248, 246, 0, 246, 238, 242, 238, 249, 248, + 0, 244, 245, 244, 243, 242, 0, 0, 241, 240, + 235, 226, 222, 236, 235, 0, 223, 222, 236, 235, + 221, 218, 219, 0, 231, 215, 214, 0, 0, 225, + 224, 208, 0, 213, 214, 0, 0, 213, 175, 158, + 0, 0, 67, 31, 0, 0, 0, 590, 195, 199, + 203, 207, 211, 215, 48, 219, 223, 225, 47, 229, + + 233 } ; -static yyconst short int yy_def[490] = +static yyconst short int yy_def[502] = { 0, - 476, 1, 477, 477, 478, 478, 479, 479, 480, 480, - 481, 481, 482, 482, 476, 476, 476, 476, 476, 476, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 476, - 476, 476, 476, 484, 485, 476, 476, 476, 476, 476, - 476, 476, 486, 476, 476, 476, 487, 487, 476, 476, - 488, 476, 476, 476, 489, 476, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - - 483, 476, 476, 476, 484, 476, 485, 476, 476, 486, - 476, 487, 487, 476, 488, 489, 476, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 476, 476, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - - 483, 483, 483, 483, 483, 476, 476, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 476, 476, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 476, 476, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 476, 476, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 476, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, - 483, 483, 483, 483, 483, 0, 476, 476, 476, 476, - 476, 476, 476, 476, 476, 476, 476, 476, 476 + 488, 1, 489, 489, 490, 490, 491, 491, 492, 492, + 493, 493, 494, 494, 488, 488, 488, 488, 488, 488, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 488, + 488, 488, 488, 496, 497, 488, 488, 488, 488, 488, + 488, 488, 498, 488, 488, 488, 499, 499, 488, 488, + 500, 488, 488, 488, 501, 488, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + + 495, 495, 488, 488, 488, 496, 488, 497, 488, 488, + 498, 488, 499, 499, 488, 500, 501, 488, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 488, 488, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + + 495, 495, 495, 495, 495, 495, 495, 495, 488, 488, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 488, 488, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 488, 488, 495, 495, 495, 495, 495, 495, 495, + + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 488, + 488, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 488, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 495, 495, 495, 495, 495, 495, 495, 0, 488, 488, + 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, + + 488 } ; -static yyconst short int yy_nxt[616] = +static yyconst short int yy_nxt[628] = { 0, 16, 17, 18, 17, 16, 16, 16, 16, 16, 19, 20, 16, 21, 22, 23, 24, 25, 26, 27, 21, 28, 21, 21, 21, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 21, 39, 21, 42, 43, 44, 63, 45, 63, 42, 43, 44, 46, 45, 48, 48, - 112, 67, 46, 49, 49, 50, 51, 52, 51, 475, + 113, 67, 46, 49, 49, 50, 51, 52, 51, 487, 50, 50, 50, 60, 55, 60, 50, 50, 51, 52, - 51, 111, 50, 50, 50, 60, 55, 60, 50, 54, + 51, 112, 50, 50, 50, 60, 55, 60, 50, 54, 54, 55, 56, 54, 54, 54, 54, 54, 54, 54, - 54, 64, 68, 65, 81, 474, 473, 111, 111, 69, + 54, 64, 68, 65, 75, 486, 115, 112, 115, 69, - 114, 70, 114, 71, 63, 472, 63, 82, 58, 54, + 76, 70, 112, 71, 63, 147, 63, 148, 58, 54, 54, 55, 56, 54, 54, 54, 54, 54, 54, 54, - 54, 72, 76, 85, 113, 471, 77, 89, 150, 73, - 86, 90, 92, 95, 470, 93, 78, 87, 58, 151, - 91, 96, 102, 74, 102, 94, 139, 140, 97, 124, - 125, 129, 145, 130, 146, 154, 111, 103, 141, 469, - 126, 131, 104, 127, 148, 102, 149, 102, 111, 114, - 163, 114, 169, 155, 195, 170, 317, 212, 293, 468, - 103, 318, 111, 213, 164, 104, 235, 467, 196, 262, - 236, 291, 294, 322, 113, 466, 263, 323, 292, 41, - - 41, 41, 41, 47, 47, 47, 47, 53, 53, 53, - 53, 57, 57, 57, 57, 59, 59, 59, 59, 61, - 61, 61, 61, 105, 105, 105, 105, 107, 107, 107, - 107, 110, 110, 115, 465, 115, 115, 116, 116, 116, - 116, 464, 463, 462, 461, 460, 459, 458, 457, 456, - 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, - 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, - 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, - 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, - 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, - - 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, - 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, - 385, 384, 383, 382, 381, 380, 379, 378, 322, 377, - 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, - 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, - 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, - 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, - 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, - 326, 325, 324, 321, 320, 319, 316, 315, 314, 313, - 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, - - 302, 301, 300, 299, 298, 297, 296, 295, 290, 289, - 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, - 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, - 268, 267, 266, 265, 264, 261, 260, 259, 258, 257, - 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, - 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, - 234, 233, 232, 231, 230, 229, 228, 227, 226, 84, - 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, - 215, 214, 211, 210, 209, 208, 207, 206, 205, 204, - 203, 202, 160, 201, 200, 199, 198, 197, 194, 193, - - 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, - 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, - 172, 171, 168, 167, 166, 165, 117, 108, 106, 162, - 161, 160, 159, 158, 157, 156, 153, 152, 147, 144, - 143, 142, 84, 138, 137, 136, 135, 134, 133, 132, - 128, 123, 122, 121, 120, 119, 118, 66, 117, 109, - 108, 106, 101, 100, 99, 98, 88, 84, 83, 80, - 79, 75, 66, 476, 62, 62, 40, 15, 476, 476, - 476, 476, 476, 476, 476, 476, 476, 476, 476, 476, - 476, 476, 476, 476, 476, 476, 476, 476, 476, 476, - - 476, 476, 476, 476, 476, 476, 476, 476, 476, 476, - 476, 476, 476, 476, 476 + 54, 72, 77, 267, 82, 86, 78, 90, 114, 73, + 268, 91, 87, 103, 96, 103, 79, 83, 58, 88, + 92, 93, 97, 74, 94, 125, 126, 156, 104, 98, + 131, 152, 132, 105, 95, 112, 127, 141, 142, 128, + 133, 150, 153, 151, 103, 157, 103, 112, 115, 143, + 115, 165, 171, 198, 215, 172, 296, 298, 239, 104, + 216, 112, 240, 297, 105, 166, 328, 199, 485, 323, + 329, 299, 484, 114, 324, 41, 41, 41, 41, 47, + + 47, 47, 47, 53, 53, 53, 53, 57, 57, 57, + 57, 59, 59, 59, 59, 61, 61, 61, 61, 106, + 106, 106, 106, 108, 108, 108, 108, 111, 111, 116, + 483, 116, 116, 117, 117, 117, 117, 482, 481, 480, + 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, + 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, + 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, + 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, + 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, + 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, + + 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, + 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, + 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, + 389, 388, 387, 386, 328, 385, 384, 383, 382, 381, + 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, + 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, + 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, + 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, + 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, + 330, 327, 326, 325, 322, 321, 320, 319, 318, 317, + + 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, + 306, 305, 304, 303, 302, 301, 300, 295, 294, 293, + 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, + 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, + 272, 271, 270, 269, 266, 265, 264, 263, 262, 261, + 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, + 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, + 238, 237, 236, 235, 234, 233, 232, 231, 230, 85, + 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, + 219, 218, 217, 214, 213, 212, 211, 210, 209, 208, + + 207, 206, 205, 162, 204, 203, 202, 201, 200, 197, + 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, + 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, + 176, 175, 174, 173, 170, 169, 168, 167, 118, 109, + 107, 164, 163, 162, 161, 160, 159, 158, 155, 154, + 149, 146, 145, 144, 85, 140, 139, 138, 137, 136, + 135, 134, 130, 129, 124, 123, 122, 121, 120, 119, + 66, 118, 110, 109, 107, 102, 101, 100, 99, 89, + 85, 84, 81, 80, 66, 488, 62, 62, 40, 15, + 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, + + 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, + 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, + 488, 488, 488, 488, 488, 488, 488 } ; -static yyconst short int yy_chk[616] = +static yyconst short int yy_chk[628] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 17, 3, 17, 4, 4, 4, 3, 4, 5, 6, - 487, 483, 4, 5, 6, 7, 7, 7, 7, 472, + 499, 495, 4, 5, 6, 7, 7, 7, 7, 484, 7, 7, 7, 11, 11, 11, 7, 8, 8, 8, 8, 56, 8, 8, 8, 12, 12, 12, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 19, 22, 19, 28, 471, 468, 56, 58, 22, + 9, 19, 22, 19, 24, 483, 60, 56, 60, 22, - 60, 22, 60, 22, 63, 467, 63, 28, 9, 10, + 24, 22, 58, 22, 63, 91, 63, 91, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 23, 25, 31, 58, 466, 25, 33, 93, 23, - 31, 33, 34, 35, 463, 34, 25, 31, 10, 93, - 33, 35, 40, 23, 40, 34, 86, 86, 35, 74, - 74, 76, 90, 76, 90, 96, 111, 40, 86, 462, - 74, 76, 40, 74, 92, 102, 92, 102, 113, 114, - 118, 114, 124, 96, 149, 124, 281, 167, 252, 460, - 102, 281, 111, 167, 118, 102, 194, 459, 149, 222, - 194, 251, 252, 285, 113, 458, 222, 285, 251, 477, - - 477, 477, 477, 478, 478, 478, 478, 479, 479, 479, - 479, 480, 480, 480, 480, 481, 481, 481, 481, 482, - 482, 482, 482, 484, 484, 484, 484, 485, 485, 485, - 485, 486, 486, 488, 455, 488, 488, 489, 489, 489, - 489, 454, 453, 451, 450, 449, 448, 447, 446, 445, - 443, 442, 441, 440, 439, 438, 437, 435, 434, 433, - 432, 431, 429, 428, 427, 426, 425, 424, 422, 421, - 420, 419, 418, 417, 415, 414, 413, 412, 411, 410, - 409, 408, 406, 405, 404, 403, 402, 401, 400, 399, - 397, 395, 394, 393, 391, 390, 389, 388, 387, 386, - - 385, 383, 381, 380, 379, 378, 377, 376, 375, 374, - 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, - 363, 362, 361, 360, 359, 358, 355, 354, 352, 351, - 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, - 340, 339, 338, 335, 334, 333, 332, 331, 330, 329, - 328, 327, 326, 325, 323, 321, 320, 319, 318, 317, - 315, 314, 312, 311, 308, 307, 306, 305, 304, 303, - 302, 301, 299, 298, 297, 294, 293, 292, 291, 290, - 289, 288, 287, 284, 283, 282, 279, 278, 277, 276, - 274, 273, 272, 270, 268, 267, 266, 265, 264, 263, - - 262, 261, 259, 258, 257, 256, 254, 253, 250, 249, - 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, - 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, - 227, 226, 225, 224, 223, 220, 219, 218, 217, 216, - 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, - 205, 204, 203, 201, 200, 199, 198, 197, 196, 195, - 193, 192, 191, 190, 187, 186, 185, 184, 182, 181, - 180, 179, 178, 177, 175, 174, 173, 172, 171, 170, - 169, 168, 166, 165, 164, 163, 162, 161, 159, 158, - 157, 156, 155, 154, 153, 152, 151, 150, 148, 147, - - 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, - 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, - 126, 125, 123, 122, 121, 119, 116, 107, 105, 104, - 103, 101, 100, 99, 98, 97, 95, 94, 91, 89, - 88, 87, 85, 83, 82, 81, 80, 79, 78, 77, - 75, 73, 72, 71, 70, 69, 68, 66, 65, 49, - 45, 44, 39, 38, 37, 36, 32, 30, 29, 27, - 26, 24, 20, 15, 14, 13, 2, 476, 476, 476, - 476, 476, 476, 476, 476, 476, 476, 476, 476, 476, - 476, 476, 476, 476, 476, 476, 476, 476, 476, 476, - - 476, 476, 476, 476, 476, 476, 476, 476, 476, 476, - 476, 476, 476, 476, 476 + 10, 23, 25, 226, 28, 31, 25, 33, 58, 23, + 226, 33, 31, 40, 35, 40, 25, 28, 10, 31, + 33, 34, 35, 23, 34, 74, 74, 97, 40, 35, + 77, 94, 77, 40, 34, 112, 74, 87, 87, 74, + 77, 93, 94, 93, 103, 97, 103, 114, 115, 87, + 115, 119, 125, 151, 169, 125, 255, 256, 197, 103, + 169, 112, 197, 255, 103, 119, 290, 151, 480, 286, + 290, 256, 479, 114, 286, 489, 489, 489, 489, 490, + + 490, 490, 490, 491, 491, 491, 491, 492, 492, 492, + 492, 493, 493, 493, 493, 494, 494, 494, 494, 496, + 496, 496, 496, 497, 497, 497, 497, 498, 498, 500, + 478, 500, 500, 501, 501, 501, 501, 475, 474, 472, + 471, 470, 467, 466, 465, 463, 462, 461, 460, 459, + 458, 457, 455, 454, 453, 452, 451, 450, 449, 446, + 445, 444, 443, 442, 440, 439, 438, 437, 436, 435, + 433, 432, 431, 430, 429, 428, 427, 425, 424, 423, + 422, 421, 420, 419, 418, 416, 415, 414, 413, 412, + 411, 410, 409, 408, 406, 404, 403, 402, 400, 399, + + 398, 397, 396, 395, 394, 393, 391, 389, 388, 387, + 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, + 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, + 366, 365, 362, 361, 359, 358, 357, 356, 355, 354, + 353, 352, 351, 350, 349, 348, 347, 346, 345, 342, + 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, + 331, 329, 327, 326, 325, 324, 323, 321, 320, 318, + 317, 314, 313, 312, 311, 310, 309, 308, 307, 306, + 304, 303, 302, 299, 298, 297, 296, 295, 294, 293, + 292, 289, 288, 287, 284, 283, 282, 281, 279, 278, + + 277, 275, 273, 272, 271, 270, 269, 268, 267, 266, + 265, 263, 262, 261, 260, 258, 257, 254, 253, 252, + 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, + 241, 240, 239, 238, 237, 236, 235, 234, 233, 231, + 230, 229, 228, 227, 224, 223, 222, 221, 220, 219, + 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, + 208, 207, 206, 204, 203, 202, 201, 200, 199, 198, + 196, 195, 194, 193, 190, 189, 188, 187, 185, 184, + 183, 182, 181, 180, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 168, 167, 166, 165, 164, 163, 161, + + 160, 159, 158, 157, 156, 155, 154, 153, 152, 150, + 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, + 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, + 129, 128, 127, 126, 124, 123, 122, 120, 117, 108, + 106, 105, 104, 102, 101, 100, 99, 98, 96, 95, + 92, 90, 89, 88, 86, 84, 83, 82, 81, 80, + 79, 78, 76, 75, 73, 72, 71, 70, 69, 68, + 66, 65, 49, 45, 44, 39, 38, 37, 36, 32, + 30, 29, 27, 26, 20, 15, 14, 13, 2, 488, + 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, + + 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, + 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, + 488, 488, 488, 488, 488, 488, 488 } ; static yy_state_type yy_last_accepting_state; @@ -666,7 +675,7 @@ char *yytext; #define yywrap parser_close /* Lexer debugging related */ -// #define LEXER_DEBUG +/* #define LEXER_DEBUG */ #ifdef LEXER_DEBUG static void lmsg (char const *x) { printf ("L: %s\n", x); @@ -685,7 +694,7 @@ char *yytext; #define defineredef 5 #define definesym 6 -#line 684 "lexer.c" +#line 693 "lexer.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -842,7 +851,7 @@ YY_DECL #line 27 "lexer.l" -#line 841 "lexer.c" +#line 850 "lexer.c" if ( yy_init ) { @@ -894,13 +903,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 477 ) + if ( yy_current_state >= 489 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 578 ); + while ( yy_base[yy_current_state] != 590 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1166,63 +1175,71 @@ case 29: YY_RULE_SETUP #line 182 "lexer.l" { - lmsg ("type"); - return (TYPE); + lmsg ("checkinterval"); + return (CHECKINTERVAL); } YY_BREAK case 30: YY_RULE_SETUP #line 187 "lexer.l" { - lmsg ("headerinspection"); - return (HEADERINSPECTION); + lmsg ("type"); + return (TYPE); } YY_BREAK case 31: YY_RULE_SETUP #line 192 "lexer.l" { - lmsg ("deep"); - return (DEEP); + lmsg ("headerinspection"); + return (HEADERINSPECTION); } YY_BREAK case 32: YY_RULE_SETUP #line 197 "lexer.l" { - lmsg ("shallow"); - return (SHALLOW); + lmsg ("deep"); + return (DEEP); } YY_BREAK case 33: YY_RULE_SETUP #line 202 "lexer.l" { - lmsg ("any"); - return (ANY); + lmsg ("shallow"); + return (SHALLOW); } YY_BREAK case 34: YY_RULE_SETUP #line 207 "lexer.l" { + lmsg ("any"); + return (ANY); +} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 212 "lexer.l" +{ lmsg ("stickyhttp"); warning ("The 'stickyhttp protocol is obsolte.\n" "You should change to 'http'."); return (HTTP); } YY_BREAK -case 35: +case 36: YY_RULE_SETUP -#line 214 "lexer.l" +#line 219 "lexer.l" { lmsg ("http"); return (HTTP); } YY_BREAK -case 36: +case 37: YY_RULE_SETUP -#line 219 "lexer.l" +#line 224 "lexer.l" { lmsg ("throughputlog"); BEGIN (stringstate); @@ -1231,9 +1248,9 @@ YY_RULE_SETUP return (THROUGHPUTLOG); } YY_BREAK -case 37: +case 38: YY_RULE_SETUP -#line 227 "lexer.l" +#line 232 "lexer.l" { lmsg ("trafficlog"); BEGIN (stringstate); @@ -1242,9 +1259,9 @@ YY_RULE_SETUP return (TRAFFICLOG); } YY_BREAK -case 38: +case 39: YY_RULE_SETUP -#line 235 "lexer.l" +#line 240 "lexer.l" { lmsg ("dumptraffic"); warning ("The 'dumptraffic' statement is obsolete.\n" @@ -1255,9 +1272,9 @@ YY_RULE_SETUP return (TRAFFICLOG); } YY_BREAK -case 39: +case 40: YY_RULE_SETUP -#line 245 "lexer.l" +#line 250 "lexer.l" { lmsg ("onstart"); BEGIN (stringstate); @@ -1266,9 +1283,9 @@ YY_RULE_SETUP return (ONSTART); } YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 253 "lexer.l" +#line 258 "lexer.l" { lmsg ("onfail"); BEGIN (stringstate); @@ -1277,9 +1294,9 @@ YY_RULE_SETUP return (ONFAIL); } YY_BREAK -case 41: +case 42: YY_RULE_SETUP -#line 261 "lexer.l" +#line 266 "lexer.l" { lmsg ("onend"); BEGIN (stringstate); @@ -1288,9 +1305,9 @@ YY_RULE_SETUP return (ONEND); } YY_BREAK -case 42: +case 43: YY_RULE_SETUP -#line 269 "lexer.l" +#line 274 "lexer.l" { lmsg ("stickycookie"); BEGIN (stringstate); @@ -1299,9 +1316,9 @@ YY_RULE_SETUP return (STICKYCOOKIE); } YY_BREAK -case 43: +case 44: YY_RULE_SETUP -#line 277 "lexer.l" +#line 282 "lexer.l" { lmsg ("addclientheader"); BEGIN (stringstate); @@ -1310,9 +1327,9 @@ YY_RULE_SETUP return (ADDCLIENTHEADER); } YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 285 "lexer.l" +#line 290 "lexer.l" { lmsg ("setclientheader"); BEGIN (stringstate); @@ -1321,9 +1338,9 @@ YY_RULE_SETUP return (SETCLIENTHEADER); } YY_BREAK -case 45: +case 46: YY_RULE_SETUP -#line 293 "lexer.l" +#line 298 "lexer.l" { lmsg ("appendclientheader"); BEGIN (stringstate); @@ -1332,9 +1349,9 @@ YY_RULE_SETUP return (APPENDCLIENTHEADER); } YY_BREAK -case 46: +case 47: YY_RULE_SETUP -#line 301 "lexer.l" +#line 306 "lexer.l" { lmsg ("addserverheader"); BEGIN (stringstate); @@ -1343,9 +1360,9 @@ YY_RULE_SETUP return (ADDSERVERHEADER); } YY_BREAK -case 47: +case 48: YY_RULE_SETUP -#line 309 "lexer.l" +#line 314 "lexer.l" { lmsg ("setserverheader"); BEGIN (stringstate); @@ -1354,9 +1371,9 @@ YY_RULE_SETUP return (SETSERVERHEADER); } YY_BREAK -case 48: +case 49: YY_RULE_SETUP -#line 317 "lexer.l" +#line 322 "lexer.l" { lmsg ("appendserverheader"); BEGIN (stringstate); @@ -1365,9 +1382,9 @@ YY_RULE_SETUP return (APPENDSERVERHEADER); } YY_BREAK -case 49: +case 50: YY_RULE_SETUP -#line 325 "lexer.l" +#line 330 "lexer.l" { lmsg ("allowfrom"); BEGIN (stringstate); @@ -1376,9 +1393,9 @@ YY_RULE_SETUP return (ALLOWFROM); } YY_BREAK -case 50: +case 51: YY_RULE_SETUP -#line 333 "lexer.l" +#line 338 "lexer.l" { lmsg ("denyfrom"); BEGIN (stringstate); @@ -1387,9 +1404,9 @@ YY_RULE_SETUP return (DENYFROM); } YY_BREAK -case 51: +case 52: YY_RULE_SETUP -#line 341 "lexer.l" +#line 346 "lexer.l" { lmsg ("allowfile"); BEGIN (stringstate); @@ -1398,9 +1415,9 @@ YY_RULE_SETUP return (ALLOWFILE); } YY_BREAK -case 52: +case 53: YY_RULE_SETUP -#line 349 "lexer.l" +#line 354 "lexer.l" { lmsg ("denyfile"); BEGIN (stringstate); @@ -1409,110 +1426,110 @@ YY_RULE_SETUP return (DENYFILE); } YY_BREAK -case 53: +case 54: YY_RULE_SETUP -#line 357 "lexer.l" +#line 362 "lexer.l" { lmsg ("on"); return (ON); } YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 362 "lexer.l" +#line 367 "lexer.l" { lmsg ("off"); return (OFF); } YY_BREAK -case 55: +case 56: YY_RULE_SETUP -#line 367 "lexer.l" +#line 372 "lexer.l" { llmsg ("identifier", yytext); return (IDENTIFIER); } YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 372 "lexer.l" +#line 377 "lexer.l" { llmsg ("number", yytext); return (NUMBER); } YY_BREAK -case 57: +case 58: YY_RULE_SETUP -#line 377 "lexer.l" +#line 382 "lexer.l" { lmsg ("space(s)"); } YY_BREAK -case 58: +case 59: YY_RULE_SETUP -#line 381 "lexer.l" +#line 386 "lexer.l" { lmsg ("newline"); yylineno++; } YY_BREAK -case 59: +case 60: YY_RULE_SETUP -#line 386 "lexer.l" +#line 391 "lexer.l" { llmsg ("lone char", yytext); return (*yytext); } YY_BREAK -case 60: +case 61: YY_RULE_SETUP -#line 391 "lexer.l" +#line 396 "lexer.l" { lmsg ("C-comment starts"); BEGIN(commentstate); } YY_BREAK -case 61: +case 62: YY_RULE_SETUP -#line 395 "lexer.l" +#line 400 "lexer.l" { lmsg ("C-comment ends"); BEGIN(0); } YY_BREAK -case 62: +case 63: YY_RULE_SETUP -#line 399 "lexer.l" +#line 404 "lexer.l" { yylineno++; } YY_BREAK -case 63: +case 64: YY_RULE_SETUP -#line 402 "lexer.l" +#line 407 "lexer.l" ; YY_BREAK -case 64: +case 65: YY_RULE_SETUP -#line 404 "lexer.l" +#line 409 "lexer.l" { llmsg ("string part", yytext); laststring = xstrcat (laststring, yytext + 1); laststring[strlen(laststring) - 1] = 0; } YY_BREAK -case 65: +case 66: YY_RULE_SETUP -#line 409 "lexer.l" +#line 414 "lexer.l" { llmsg ("string part", yytext); laststring = xstrcat (laststring, yytext + 1); laststring[strlen(laststring) - 1] = 0; } YY_BREAK -case 66: +case 67: YY_RULE_SETUP -#line 414 "lexer.l" +#line 419 "lexer.l" { BEGIN (0); unput (';'); @@ -1520,9 +1537,9 @@ YY_RULE_SETUP return (STRING); } YY_BREAK -case 67: +case 68: YY_RULE_SETUP -#line 420 "lexer.l" +#line 425 "lexer.l" { if (laststring) { laststring = xstrcat (laststring, yytext); @@ -1530,17 +1547,17 @@ YY_RULE_SETUP } } YY_BREAK -case 68: +case 69: YY_RULE_SETUP -#line 426 "lexer.l" +#line 431 "lexer.l" { llmsg ("string part", yytext); laststring = xstrcat (laststring, yytext); } YY_BREAK -case 69: +case 70: YY_RULE_SETUP -#line 430 "lexer.l" +#line 435 "lexer.l" { if (laststring) { laststring = xstrcat (laststring, " "); @@ -1549,9 +1566,9 @@ YY_RULE_SETUP yylineno++; } YY_BREAK -case 70: +case 71: YY_RULE_SETUP -#line 438 "lexer.l" +#line 443 "lexer.l" { lmsg ("includefile"); /* parser_skipline(); */ @@ -1560,38 +1577,38 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(includestate): -#line 444 "lexer.l" +#line 449 "lexer.l" { error ("Unterminated #include"); } YY_BREAK -case 71: +case 72: YY_RULE_SETUP -#line 447 "lexer.l" +#line 452 "lexer.l" ; YY_BREAK -case 72: +case 73: YY_RULE_SETUP -#line 448 "lexer.l" +#line 453 "lexer.l" { yylineno++; } YY_BREAK -case 73: +case 74: YY_RULE_SETUP -#line 451 "lexer.l" +#line 456 "lexer.l" { error ("Illegal character 0x%2.2x in #include line", *yytext); } YY_BREAK -case 74: +case 75: YY_RULE_SETUP -#line 455 "lexer.l" +#line 460 "lexer.l" ; YY_BREAK -case 75: +case 76: YY_RULE_SETUP -#line 456 "lexer.l" +#line 461 "lexer.l" { symtab_start (yytext); BEGIN (defineredef); @@ -1600,54 +1617,54 @@ YY_RULE_SETUP case YY_STATE_EOF(definestate): case YY_STATE_EOF(defineredef): case YY_STATE_EOF(definesym): -#line 460 "lexer.l" +#line 465 "lexer.l" { error ("Unterminated #define"); } YY_BREAK -case 76: +case 77: YY_RULE_SETUP -#line 463 "lexer.l" +#line 468 "lexer.l" { error ("Unterminated #define"); } YY_BREAK -case 77: +case 78: YY_RULE_SETUP -#line 466 "lexer.l" +#line 471 "lexer.l" { error ("Unrecognized character '%c' in #define", *yytext); } YY_BREAK -case 78: +case 79: YY_RULE_SETUP -#line 470 "lexer.l" +#line 475 "lexer.l" { BEGIN (definesym); } YY_BREAK -case 79: +case 80: YY_RULE_SETUP -#line 473 "lexer.l" +#line 478 "lexer.l" { symtab_set (yytext); } YY_BREAK -case 80: +case 81: YY_RULE_SETUP -#line 476 "lexer.l" +#line 481 "lexer.l" { yylineno++; symtab_end(); BEGIN (0); } YY_BREAK -case 81: +case 82: YY_RULE_SETUP -#line 481 "lexer.l" +#line 486 "lexer.l" ECHO; YY_BREAK -#line 1646 "lexer.c" +#line 1663 "lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(stringstate): case YY_STATE_EOF(commentstate): @@ -1942,7 +1959,7 @@ static yy_state_type yy_get_previous_state() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 477 ) + if ( yy_current_state >= 489 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1977,11 +1994,11 @@ yy_state_type yy_current_state; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 477 ) + if ( yy_current_state >= 489 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 476); + yy_is_jam = (yy_current_state == 488); return yy_is_jam ? 0 : yy_current_state; } @@ -2537,4 +2554,4 @@ int main() return 0; } #endif -#line 481 "lexer.l" +#line 486 "lexer.l" diff --git a/src/lib/lexer.l b/src/lib/lexer.l @@ -7,7 +7,7 @@ #define yywrap parser_close /* Lexer debugging related */ -// #define LEXER_DEBUG +/* #define LEXER_DEBUG */ #ifdef LEXER_DEBUG static void lmsg (char const *x) { printf ("L: %s\n", x); @@ -179,6 +179,11 @@ revivinginterval { return (REVIVINGINTERVAL); } +checkinterval { + lmsg ("checkinterval"); + return (CHECKINTERVAL); +} + type { lmsg ("type"); return (TYPE); @@ -444,7 +449,7 @@ off|false|no { <includestate><<EOF>> { error ("Unterminated #include"); } -<includestate>[ \t\n] ; +<includestate>[ \t] ; <includestate>\n { yylineno++; } diff --git a/src/lib/lockreporter.c b/src/lib/lockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivityany.c b/src/lib/logactivityany.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivitycontinuation.c b/src/lib/logactivitycontinuation.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivityend.c b/src/lib/logactivityend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivitystart.c b/src/lib/logactivitystart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/makesocket.c b/src/lib/makesocket.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/markactivity.c b/src/lib/markactivity.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/msg.c b/src/lib/msg.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/msgdumpbuf.c b/src/lib/msgdumpbuf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netbuffer.c b/src/lib/netbuffer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netbufread.c b/src/lib/netbufread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netcopy.c b/src/lib/netcopy.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netread.c b/src/lib/netread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netwrite.c b/src/lib/netwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parser.c b/src/lib/parser.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -60,6 +60,7 @@ # define HEADERINSPECTION 306 # define DEEP 307 # define SHALLOW 308 +# define CHECKINTERVAL 309 #line 3 "parser.y" @@ -74,7 +75,7 @@ static Backend cur_backend; /* Storage for a handled backend */ static Service cur_service; /* Storage for a handled service */ /* Parser debugging related */ -// #define PARSER_DEBUG +/* #define PARSER_DEBUG */ #ifdef PARSER_DEBUG static void pmsg (char const *x) { printf ("P: %s\n", x); @@ -198,12 +199,12 @@ static void setuseraccount (char *username) { -#define YYFINAL 210 +#define YYFINAL 219 #define YYFLAG -32768 -#define YYNTBASE 58 +#define YYNTBASE 59 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 308 ? yytranslate[x] : 142) +#define YYTRANSLATE(x) ((unsigned)(x) <= 309 ? yytranslate[x] : 146) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -213,14 +214,14 @@ static const char yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 57, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 58, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 55, 2, 56, 2, 2, 2, 2, + 2, 2, 2, 56, 2, 57, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -238,7 +239,7 @@ static const char yytranslate[] = 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55 }; #if YYDEBUG @@ -246,56 +247,57 @@ static const short yyprhs[] = { 0, 0, 3, 5, 11, 14, 17, 20, 22, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, - 47, 49, 51, 53, 55, 57, 59, 63, 67, 70, - 73, 76, 81, 83, 85, 90, 92, 94, 95, 98, - 101, 103, 106, 108, 110, 112, 114, 116, 118, 120, - 122, 126, 129, 133, 137, 141, 145, 149, 153, 156, - 158, 160, 164, 167, 169, 171, 175, 179, 183, 187, - 190, 196, 199, 202, 204, 207, 209, 211, 213, 215, - 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, - 237, 239, 241, 243, 245, 250, 254, 258, 260, 264, - 268, 272, 276, 280, 284, 287, 290, 294, 297, 301, - 305, 309, 313, 317, 321, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342 + 47, 49, 51, 53, 55, 57, 59, 61, 65, 69, + 72, 75, 78, 83, 85, 87, 92, 94, 96, 97, + 100, 103, 105, 108, 110, 112, 114, 116, 118, 120, + 122, 124, 128, 131, 136, 141, 143, 144, 147, 151, + 155, 159, 163, 167, 170, 172, 174, 178, 181, 183, + 185, 189, 193, 197, 201, 204, 210, 213, 216, 218, + 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, + 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, + 264, 268, 272, 274, 278, 282, 286, 290, 294, 298, + 301, 304, 308, 311, 315, 319, 323, 327, 331, 335, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + 348, 349, 350, 351, 352, 353, 354, 355, 356 }; static const short yyrhs[] = { - 58, 59, 0, 59, 0, 60, 61, 55, 62, 56, - 0, 127, 3, 0, 135, 4, 0, 62, 63, 0, - 63, 0, 129, 64, 0, 65, 0, 66, 0, 70, - 0, 72, 0, 81, 0, 82, 0, 83, 0, 84, - 0, 85, 0, 86, 0, 89, 0, 92, 0, 94, - 0, 93, 0, 95, 0, 79, 0, 97, 0, 5, - 68, 69, 0, 31, 67, 69, 0, 137, 19, 0, - 125, 6, 0, 130, 57, 0, 8, 131, 71, 69, - 0, 10, 0, 11, 0, 12, 77, 73, 69, 0, - 74, 0, 76, 0, 0, 29, 75, 0, 125, 6, - 0, 112, 0, 132, 78, 0, 13, 0, 21, 0, - 22, 0, 23, 0, 27, 0, 24, 0, 47, 0, - 50, 0, 49, 80, 69, 0, 141, 19, 0, 14, - 68, 69, 0, 20, 68, 69, 0, 15, 68, 69, - 0, 25, 68, 69, 0, 26, 68, 69, 0, 33, - 87, 69, 0, 138, 88, 0, 34, 0, 35, 0, - 52, 90, 69, 0, 139, 91, 0, 53, 0, 54, - 0, 43, 96, 69, 0, 44, 96, 69, 0, 45, - 113, 69, 0, 46, 113, 69, 0, 140, 19, 0, - 7, 98, 55, 99, 56, 0, 136, 4, 0, 99, - 100, 0, 100, 0, 128, 101, 0, 102, 0, 65, - 0, 70, 0, 107, 0, 109, 0, 108, 0, 110, - 0, 111, 0, 103, 0, 104, 0, 85, 0, 114, - 0, 116, 0, 117, 0, 118, 0, 119, 0, 120, - 0, 121, 0, 106, 0, 9, 126, 105, 69, 0, - 16, 68, 69, 0, 30, 68, 69, 0, 19, 0, - 51, 68, 69, 0, 17, 112, 69, 0, 18, 112, - 69, 0, 48, 112, 69, 0, 28, 113, 69, 0, - 32, 113, 69, 0, 133, 19, 0, 134, 19, 0, - 36, 115, 69, 0, 124, 19, 0, 37, 122, 69, - 0, 38, 122, 69, 0, 39, 122, 69, 0, 40, - 122, 69, 0, 41, 122, 69, 0, 42, 122, 69, - 0, 123, 19, 0, 0, 0, 0, 0, 0, 0, + 59, 60, 0, 60, 0, 61, 62, 56, 63, 57, + 0, 131, 3, 0, 139, 4, 0, 63, 64, 0, + 64, 0, 133, 65, 0, 66, 0, 67, 0, 71, + 0, 73, 0, 82, 0, 83, 0, 86, 0, 87, + 0, 88, 0, 89, 0, 90, 0, 93, 0, 96, + 0, 98, 0, 97, 0, 99, 0, 80, 0, 101, + 0, 5, 69, 70, 0, 31, 68, 70, 0, 141, + 19, 0, 129, 6, 0, 134, 58, 0, 8, 135, + 72, 70, 0, 10, 0, 11, 0, 12, 78, 74, + 70, 0, 75, 0, 77, 0, 0, 29, 76, 0, + 129, 6, 0, 116, 0, 136, 79, 0, 13, 0, + 21, 0, 22, 0, 23, 0, 27, 0, 24, 0, + 47, 0, 50, 0, 49, 81, 70, 0, 145, 19, + 0, 14, 69, 84, 70, 0, 55, 69, 84, 70, + 0, 85, 0, 0, 47, 116, 0, 20, 69, 70, + 0, 15, 69, 70, 0, 25, 69, 70, 0, 26, + 69, 70, 0, 33, 91, 70, 0, 142, 92, 0, + 34, 0, 35, 0, 52, 94, 70, 0, 143, 95, + 0, 53, 0, 54, 0, 43, 100, 70, 0, 44, + 100, 70, 0, 45, 117, 70, 0, 46, 117, 70, + 0, 144, 19, 0, 7, 102, 56, 103, 57, 0, + 140, 4, 0, 103, 104, 0, 104, 0, 132, 105, + 0, 106, 0, 66, 0, 71, 0, 111, 0, 113, + 0, 112, 0, 114, 0, 115, 0, 107, 0, 108, + 0, 89, 0, 118, 0, 120, 0, 121, 0, 122, + 0, 123, 0, 124, 0, 125, 0, 110, 0, 9, + 130, 109, 70, 0, 16, 69, 70, 0, 30, 69, + 70, 0, 19, 0, 51, 69, 70, 0, 17, 116, + 70, 0, 18, 116, 70, 0, 48, 116, 70, 0, + 28, 117, 70, 0, 32, 117, 70, 0, 137, 19, + 0, 138, 19, 0, 36, 119, 70, 0, 128, 19, + 0, 37, 126, 70, 0, 38, 126, 70, 0, 39, + 126, 70, 0, 40, 126, 70, 0, 41, 126, 70, + 0, 42, 126, 70, 0, 127, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0 }; #endif @@ -304,20 +306,20 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 145, 148, 152, 183, 188, 199, 202, 206, 211, - 220, 226, 232, 242, 248, 254, 260, 266, 272, 278, - 284, 290, 296, 302, 308, 315, 486, 498, 510, 519, - 526, 531, 544, 548, 554, 563, 565, 567, 571, 588, - 595, 605, 614, 618, 622, 626, 630, 634, 638, 642, - 648, 660, 669, 681, 693, 705, 717, 729, 741, 746, - 750, 756, 768, 773, 777, 783, 795, 807, 819, 831, - 840, 850, 862, 870, 876, 883, 888, 893, 898, 903, - 908, 913, 918, 923, 928, 933, 938, 943, 948, 953, - 958, 963, 968, 973, 980, 993, 1005, 1017, 1023, 1035, - 1047, 1059, 1071, 1083, 1095, 1104, 1113, 1125, 1134, 1146, - 1158, 1170, 1182, 1194, 1206, 1215, 1220, 1225, 1230, 1235, - 1240, 1245, 1250, 1255, 1260, 1265, 1270, 1275, 1280, 1285, - 1290, 1295, 1300, 1305 + 0, 146, 149, 153, 190, 195, 206, 209, 213, 218, + 227, 233, 239, 249, 257, 264, 270, 276, 282, 288, + 294, 300, 306, 312, 318, 324, 331, 502, 514, 526, + 535, 542, 547, 560, 564, 570, 579, 581, 583, 587, + 604, 611, 621, 630, 634, 638, 642, 646, 650, 654, + 658, 664, 676, 685, 703, 721, 723, 727, 736, 748, + 760, 772, 784, 796, 801, 805, 811, 823, 828, 832, + 838, 850, 862, 874, 886, 895, 905, 917, 925, 931, + 938, 943, 948, 953, 958, 963, 968, 973, 978, 983, + 988, 993, 998, 1003, 1008, 1013, 1018, 1023, 1028, 1035, + 1048, 1060, 1072, 1078, 1090, 1102, 1114, 1126, 1138, 1150, + 1159, 1168, 1180, 1189, 1201, 1213, 1225, 1237, 1249, 1261, + 1270, 1275, 1280, 1285, 1290, 1295, 1300, 1305, 1310, 1315, + 1320, 1325, 1330, 1335, 1340, 1345, 1350, 1355, 1360 }; #endif @@ -337,13 +339,14 @@ static const char *const yytname[] = "APPENDCLIENTHEADER", "ADDSERVERHEADER", "SETSERVERHEADER", "APPENDSERVERHEADER", "ALLOWFROM", "DENYFROM", "ALLOWFILE", "DENYFILE", "EXTERNALHANDLER", "ONEND", "USERACCOUNT", "BYCLIENTIP", "RETRIES", - "HEADERINSPECTION", "DEEP", "SHALLOW", "'{'", "'}'", "';'", "input", - "element", "service", "servicename", "servicestatements", - "servicestatement", "servicebody", "portstatement", "bindstatement", - "ipaddress", "number", "semicol", "verbositystatement", "onoff", - "dispatchmodestatement", "dispatchtail", "dispatchover", "overnumber", - "dispatchext", "dispatchmethod", "dispatchmethodspec", + "HEADERINSPECTION", "DEEP", "SHALLOW", "CHECKINTERVAL", "'{'", "'}'", + "';'", "input", "element", "service", "servicename", + "servicestatements", "servicestatement", "servicebody", "portstatement", + "bindstatement", "ipaddress", "number", "semicol", "verbositystatement", + "onoff", "dispatchmodestatement", "dispatchtail", "dispatchover", + "overnumber", "dispatchext", "dispatchmethod", "dispatchmethodspec", "useraccountstatement", "useraccount", "revivingintervalstatement", + "checkintervalstatement", "opt_externalhandler", "externalhandler", "backlogstatement", "shmkeystatement", "connectiontimeoutstatement", "maxconnectionsstatement", "typestatement", "typespec", "typespecifier", "inspectionstatement", "shallowdeepspec", "shallowdeepspecifier", @@ -370,20 +373,20 @@ static const char *const yytname[] = /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - 0, 58, 58, 59, 60, 61, 62, 62, 63, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 65, 66, 67, 68, - 69, 70, 71, 71, 72, 73, 73, 73, 74, 75, - 76, 77, 78, 78, 78, 78, 78, 78, 78, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 88, 89, 90, 91, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 99, 100, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, - 101, 101, 101, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141 + 0, 59, 59, 60, 61, 62, 63, 63, 64, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 66, 67, 68, + 69, 70, 71, 72, 72, 73, 74, 74, 74, 75, + 76, 77, 78, 79, 79, 79, 79, 79, 79, 79, + 79, 80, 81, 82, 83, 84, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 92, 93, 94, 95, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 103, 104, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -391,18 +394,18 @@ static const short yyr2[] = { 0, 2, 1, 5, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, - 2, 4, 1, 1, 4, 1, 1, 0, 2, 2, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 3, 3, 3, 3, 3, 3, 2, 1, - 1, 3, 2, 1, 1, 3, 3, 3, 3, 2, - 5, 2, 2, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 3, 2, + 2, 2, 4, 1, 1, 4, 1, 1, 0, 2, + 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 2, 4, 4, 1, 0, 2, 3, 3, + 3, 3, 3, 2, 1, 1, 3, 2, 1, 1, + 3, 3, 3, 3, 2, 5, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 4, 3, 3, 1, 3, 3, - 3, 3, 3, 3, 2, 2, 3, 2, 3, 3, - 3, 3, 3, 3, 2, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, + 3, 3, 1, 3, 3, 3, 3, 3, 3, 2, + 2, 3, 2, 3, 3, 3, 3, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -410,128 +413,132 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 119, 119, 2, 127, 0, 1, 0, 0, 4, 121, - 5, 121, 7, 0, 3, 6, 117, 128, 123, 124, - 117, 117, 117, 117, 117, 129, 130, 132, 132, 126, - 126, 133, 131, 8, 9, 10, 11, 12, 24, 13, - 14, 15, 16, 17, 18, 19, 20, 22, 21, 23, - 25, 122, 0, 0, 0, 0, 37, 0, 122, 122, - 122, 122, 122, 122, 0, 122, 0, 122, 0, 122, - 122, 0, 122, 122, 0, 122, 0, 26, 0, 29, - 120, 71, 32, 33, 122, 117, 122, 35, 36, 40, - 0, 42, 43, 44, 45, 47, 46, 48, 49, 41, - 52, 54, 53, 55, 56, 27, 28, 57, 59, 60, - 58, 65, 69, 66, 67, 105, 68, 50, 51, 61, - 63, 64, 62, 30, 120, 73, 0, 31, 38, 0, - 34, 104, 70, 72, 118, 117, 125, 125, 126, 117, - 126, 116, 115, 115, 115, 115, 115, 115, 125, 117, - 76, 77, 85, 74, 75, 83, 84, 93, 78, 80, - 79, 81, 82, 86, 87, 88, 89, 90, 91, 92, - 39, 0, 122, 122, 122, 122, 122, 122, 122, 0, - 122, 0, 122, 122, 122, 122, 122, 122, 122, 97, - 122, 95, 99, 100, 102, 96, 103, 106, 107, 108, - 114, 109, 110, 111, 112, 113, 101, 98, 94, 0, - 0 + 124, 124, 2, 132, 0, 1, 0, 0, 4, 126, + 5, 126, 7, 0, 3, 6, 122, 133, 128, 129, + 122, 122, 122, 122, 122, 134, 135, 137, 137, 131, + 131, 138, 136, 122, 8, 9, 10, 11, 12, 25, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, + 22, 24, 26, 127, 0, 0, 0, 0, 38, 0, + 56, 127, 127, 127, 127, 127, 0, 127, 0, 127, + 0, 127, 127, 0, 127, 127, 0, 127, 0, 56, + 27, 0, 30, 125, 76, 33, 34, 127, 122, 127, + 36, 37, 41, 0, 43, 44, 45, 46, 48, 47, + 49, 50, 42, 130, 127, 55, 59, 58, 60, 61, + 28, 29, 62, 64, 65, 63, 70, 74, 71, 72, + 110, 73, 51, 52, 66, 68, 69, 67, 127, 31, + 125, 78, 0, 32, 39, 0, 35, 109, 57, 53, + 54, 75, 77, 123, 122, 130, 130, 131, 122, 131, + 121, 120, 120, 120, 120, 120, 120, 130, 122, 81, + 82, 90, 79, 80, 88, 89, 98, 83, 85, 84, + 86, 87, 91, 92, 93, 94, 95, 96, 97, 40, + 0, 127, 127, 127, 127, 127, 127, 127, 0, 127, + 0, 127, 127, 127, 127, 127, 127, 127, 102, 127, + 100, 104, 105, 107, 101, 108, 111, 112, 113, 119, + 114, 115, 116, 117, 118, 106, 103, 99, 0, 0 }; static const short yydefgoto[] = { - 1, 2, 3, 6, 11, 12, 33, 34, 35, 63, - 51, 77, 36, 84, 37, 86, 87, 128, 88, 56, - 99, 38, 73, 39, 40, 41, 42, 43, 44, 65, - 110, 45, 75, 122, 46, 47, 48, 49, 67, 50, - 53, 124, 125, 153, 154, 155, 156, 190, 157, 158, - 159, 160, 161, 162, 89, 70, 163, 178, 164, 165, - 166, 167, 168, 169, 180, 181, 179, 52, 171, 4, - 126, 13, 78, 55, 57, 90, 71, 7, 54, 64, - 66, 76, 68, 74 + 1, 2, 3, 6, 11, 12, 34, 35, 36, 65, + 53, 80, 37, 87, 38, 89, 90, 134, 91, 58, + 102, 39, 75, 40, 41, 104, 105, 42, 43, 44, + 45, 46, 67, 115, 47, 77, 127, 48, 49, 50, + 51, 69, 52, 55, 130, 131, 162, 163, 164, 165, + 199, 166, 167, 168, 169, 170, 171, 92, 72, 172, + 187, 173, 174, 175, 176, 177, 178, 189, 190, 188, + 54, 180, 4, 132, 13, 81, 57, 59, 93, 73, + 7, 56, 66, 68, 78, 70, 76 }; static const short yypact[] = { - -32768, 8,-32768,-32768, 7,-32768, -30, 29,-32768,-32768, - -32768, -16,-32768, 22,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 7,-32768,-32768, 6,-32768, -44, 18,-32768,-32768, + -32768, -33,-32768, 30,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, 35, -9, 41, 21, -13, 36,-32768,-32768, - -32768,-32768,-32768,-32768, 31,-32768, 4,-32768, 32,-32768, - -32768, 33,-32768,-32768, 37,-32768, -10,-32768, -3,-32768, + -32768,-32768,-32768,-32768, 23, -29, 32, 21, -4, 65, + -6,-32768,-32768,-32768,-32768,-32768, 27,-32768, -1,-32768, + 33,-32768,-32768, 34,-32768,-32768, 35,-32768, -14, -6, + -32768, -9,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, 38,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 42,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, 6,-32768, 126,-32768,-32768, 58, + 1,-32768, 141,-32768,-32768, 45,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, 50,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 51, - -32768, 53,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 43,-32768, + 46,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 73, - -32768 + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 64,-32768 }; static const short yypgoto[] = { - -32768, 79,-32768,-32768,-32768, 70,-32768, -44,-32768,-32768, - -2, -58, -42,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768, -41,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 59,-32768, - -32768,-32768, -36,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, -113, -17,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, -68,-32768,-32768, 5,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768 + -32768, 76,-32768,-32768,-32768, 55,-32768, -52,-32768,-32768, + -3, -61, -51,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768, 4,-32768,-32768,-32768,-32768, + -48,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 62,-32768,-32768,-32768, -39,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, -98, -7,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, -84,-32768,-32768, + 5,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768 }; -#define YYLAST 177 +#define YYLAST 192 static const short yytable[] = { - 100, 101, 102, 103, 104, 105, -125, 107, 209, 111, - 8, 113, 114, 72, 116, 117, 85, 119, 58, 59, - 60, 61, 62, 173, 174, 9, 127, 16, 130, 17, - 18, 82, 83, 10, 19, 187, 20, 21, 108, 109, - 14, 79, 22, 120, 121, 81, 80, 23, 24, 91, - 106, 112, 115, 25, 123, 26, 118, 92, 93, 94, - 95, 131, 132, 96, 170, 27, 28, 29, 30, 189, - 198, 31, 200, 210, 32, 182, 183, 184, 185, 186, - 5, 15, 150, 97, 151, 152, 98, 69, 133, 0, - 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 106, 107, 108, 109, 110, 138, 112, 218, 116, 8, + 118, 119, 9, 121, 122, -130, 124, 60, 61, 62, + 63, 64, 10, 74, 14, 88, 133, 83, 136, 82, + 79, 85, 86, 113, 114, 16, 84, 17, 18, 125, + 126, 103, 19, 139, 20, 21, 111, 182, 183, 129, + 22, 179, 117, 120, 123, 23, 24, 137, 141, 196, + 198, 25, 207, 26, 219, 209, 15, 140, 191, 192, + 193, 194, 195, 27, 28, 29, 30, 5, 94, 31, + 159, 160, 32, 128, 161, 33, 95, 96, 97, 98, + 71, 142, 99, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 191, 192, 193, 194, 195, 196, - 197, 175, 199, 177, 201, 202, 203, 204, 205, 206, - 207, 16, 208, 172, 18, 134, 0, 176, 0, 0, - 0, 0, 135, 136, 137, 0, 0, 188, 0, 0, - 0, 0, 24, 0, 138, 0, 139, 0, 140, 0, - 0, 0, 141, 142, 143, 144, 145, 146, 147, 0, - 0, 0, 0, 0, 148, 0, 0, 149 + 0, 0, 100, 0, 0, 101, 0, 0, 0, 0, + 200, 201, 202, 203, 204, 205, 206, 0, 208, 0, + 210, 211, 212, 213, 214, 215, 216, 0, 217, 0, + 184, 181, 186, 0, 0, 185, 16, 0, 0, 18, + 143, 0, 0, 0, 0, 197, 0, 144, 145, 146, + 0, 0, 0, 0, 0, 0, 0, 24, 0, 147, + 0, 148, 0, 149, 0, 0, 0, 150, 151, 152, + 153, 154, 155, 156, 0, 0, 0, 0, 0, 157, + 0, 0, 158 }; static const short yycheck[] = { - 58, 59, 60, 61, 62, 63, 19, 65, 0, 67, - 3, 69, 70, 30, 72, 73, 29, 75, 20, 21, - 22, 23, 24, 136, 137, 55, 84, 5, 86, 7, - 8, 10, 11, 4, 12, 148, 14, 15, 34, 35, - 56, 6, 20, 53, 54, 4, 55, 25, 26, 13, - 19, 19, 19, 31, 57, 33, 19, 21, 22, 23, - 24, 19, 56, 27, 6, 43, 44, 45, 46, 19, - 19, 49, 19, 0, 52, 143, 144, 145, 146, 147, - 1, 11, 126, 47, 126, 126, 50, 28, 124, -1, - 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 61, 62, 63, 64, 65, 103, 67, 0, 69, 3, + 71, 72, 56, 74, 75, 19, 77, 20, 21, 22, + 23, 24, 4, 30, 57, 29, 87, 56, 89, 6, + 33, 10, 11, 34, 35, 5, 4, 7, 8, 53, + 54, 47, 12, 104, 14, 15, 19, 145, 146, 58, + 20, 6, 19, 19, 19, 25, 26, 19, 57, 157, + 19, 31, 19, 33, 0, 19, 11, 128, 152, 153, + 154, 155, 156, 43, 44, 45, 46, 1, 13, 49, + 132, 132, 52, 79, 132, 55, 21, 22, 23, 24, + 28, 130, 27, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 172, 173, 174, 175, 176, 177, - 178, 138, 180, 140, 182, 183, 184, 185, 186, 187, - 188, 5, 190, 135, 8, 9, -1, 139, -1, -1, - -1, -1, 16, 17, 18, -1, -1, 149, -1, -1, - -1, -1, 26, -1, 28, -1, 30, -1, 32, -1, - -1, -1, 36, 37, 38, 39, 40, 41, 42, -1, - -1, -1, -1, -1, 48, -1, -1, 51 + -1, -1, 47, -1, -1, 50, -1, -1, -1, -1, + 181, 182, 183, 184, 185, 186, 187, -1, 189, -1, + 191, 192, 193, 194, 195, 196, 197, -1, 199, -1, + 147, 144, 149, -1, -1, 148, 5, -1, -1, 8, + 9, -1, -1, -1, -1, 158, -1, 16, 17, 18, + -1, -1, -1, -1, -1, -1, -1, 26, -1, 28, + -1, 30, -1, 32, -1, -1, -1, 36, 37, 38, + 39, 40, 41, 42, -1, -1, -1, -1, -1, 48, + -1, -1, 51 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/sw/share/bison/bison.simple" @@ -1241,7 +1248,7 @@ yyreduce: switch (yyn) { case 3: -#line 157 "parser.y" +#line 158 "parser.y" { /* Verify the service description, supply defaults * and so on. @@ -1261,6 +1268,12 @@ case 3: if (!cur_service.bind) cur_service.bind = "any"; + if (cur_service.rev_interval && cur_service.check_interval) + error ("Service %s has both a revivinginterval and " + "a checkinterval", cur_service.name); + if (!cur_service.check_cmd) + cur_service.check_cmd = xstrdup (""); + /* Add to the list. */ service = xrealloc (service, ++nservice * sizeof(Service)); service[nservice - 1] = cur_service; @@ -1268,7 +1281,7 @@ case 3: ; break;} case 5: -#line 190 "parser.y" +#line 197 "parser.y" { psmsg ("service:", SYMBOL); for (i = 0; i < nservice; i++) @@ -1278,7 +1291,7 @@ case 5: ; break;} case 9: -#line 212 "parser.y" +#line 219 "parser.y" { pimsg ("sevice port:", yyvsp[0].set[0].v.ival); for (i = 0; i < nservice; i++) @@ -1289,7 +1302,7 @@ case 9: ; break;} case 10: -#line 221 "parser.y" +#line 228 "parser.y" { psmsg ("service binding:", yyvsp[0].set[0].v.sval); cur_service.bind = yyvsp[0].set[0].v.sval; @@ -1297,7 +1310,7 @@ case 10: ; break;} case 11: -#line 227 "parser.y" +#line 234 "parser.y" { pimsg ("service verbosity:", yyvsp[0].set[0].v.ival); cur_service.verbosity = yyvsp[0].set[0].v.ival; @@ -1305,7 +1318,7 @@ case 11: ; break;} case 12: -#line 233 "parser.y" +#line 240 "parser.y" { pimsg ("service dispatch mode:", yyvsp[0].set[0].v.ival); pimsg ("service dispatch over:", lastovernr); @@ -1317,95 +1330,106 @@ case 12: ; break;} case 13: -#line 243 "parser.y" +#line 250 "parser.y" { pimsg ("service revival interval:", yyvsp[0].set[0].v.ival); + psmsg ("service revival cmd:", yyvsp[0].set[1].v.sval); cur_service.rev_interval = yyvsp[0].set[0].v.ival; + cur_service.check_cmd = yyvsp[0].set[1].v.sval; free (yyvsp[0].set); ; break;} case 14: -#line 249 "parser.y" +#line 258 "parser.y" +{ + pimsg ("service check interval:", yyvsp[0].set[0].v.ival); + psmsg ("service check cmd:", yyvsp[0].set[1].v.sval); + cur_service.check_interval = yyvsp[0].set[0].v.ival; + cur_service.check_cmd = yyvsp[0].set[1].v.sval; + ; + break;} +case 15: +#line 265 "parser.y" { pimsg ("service backlog:", yyvsp[0].set[0].v.ival); cur_service.backlog = yyvsp[0].set[0].v.ival; free (yyvsp[0].set); ; break;} -case 15: -#line 255 "parser.y" +case 16: +#line 271 "parser.y" { pimsg ("service shmkey:", yyvsp[0].set[0].v.ival); cur_service.shmkey = yyvsp[0].set[0].v.ival; free (yyvsp[0].set); ; break;} -case 16: -#line 261 "parser.y" +case 17: +#line 277 "parser.y" { pimsg ("connection timout:", yyvsp[0].set[0].v.ival); cur_service.connectiontimeout = yyvsp[0].set[0].v.ival; free (yyvsp[0].set); ; break;} -case 17: -#line 267 "parser.y" +case 18: +#line 283 "parser.y" { pimsg ("max clients in service:", yyvsp[0].set[0].v.ival); cur_service.maxconnections = yyvsp[0].set[0].v.ival; free (yyvsp[0].set); ; break;} -case 18: -#line 273 "parser.y" +case 19: +#line 289 "parser.y" { pimsg ("service type: ", yyvsp[0].set[0].v.ival); cur_service.type = yyvsp[0].set[0].v.ival; free (yyvsp[0].set); ; break;} -case 19: -#line 279 "parser.y" +case 20: +#line 295 "parser.y" { pimsg ("service header inspection: ", yyvsp[0].set[0].v.ival); cur_service.inspection = yyvsp[0].set[0].v.ival; free (yyvsp[0].set); ; break;} -case 20: -#line 285 "parser.y" +case 21: +#line 301 "parser.y" { psmsg ("allow from: ", yyvsp[0].set[0].v.sval); add_allowfrom (yyvsp[0].set[0].v.sval); free (yyvsp[0].set); ; break;} -case 21: -#line 291 "parser.y" +case 22: +#line 307 "parser.y" { psmsg ("allow file: ", yyvsp[0].set[0].v.sval); cur_service.allowfile = yyvsp[0].set[0].v.sval; free (yyvsp[0].set); ; break;} -case 22: -#line 297 "parser.y" +case 23: +#line 313 "parser.y" { psmsg ("deny from: ", yyvsp[0].set[0].v.sval); add_denyfrom (yyvsp[0].set[0].v.sval); free (yyvsp[0].set); ; break;} -case 23: -#line 303 "parser.y" +case 24: +#line 319 "parser.y" { psmsg ("deny file: ", yyvsp[0].set[0].v.sval); cur_service.denyfile = yyvsp[0].set[0].v.sval; free (yyvsp[0].set); ; break;} -case 24: -#line 309 "parser.y" +case 25: +#line 325 "parser.y" { psmsg ("user account: ", yyvsp[0].set[0].v.sval); setuseraccount (yyvsp[0].set[0].v.sval); @@ -1413,8 +1437,8 @@ case 24: free (yyvsp[0].set); ; break;} -case 25: -#line 316 "parser.y" +case 26: +#line 332 "parser.y" { pimsg ("converting backend statements, count is", yyvsp[0].n); for (i = 0; i < yyvsp[0].n; i++) @@ -1580,12 +1604,12 @@ case 25: sizeof(Backend)); cur_service.backend[cur_service.nbackend - 1] = cur_backend; - pimsg ("this was backend defintion", cur_service.nbackend); + pimsg ("this was backend definition", cur_service.nbackend); memset (&cur_backend, 0, sizeof(cur_backend)); ; break;} -case 26: -#line 489 "parser.y" +case 27: +#line 505 "parser.y" { pimsg ("port statement:", lastnr); yyval.n = 1; @@ -1594,8 +1618,8 @@ case 26: yyval.set[0].v.ival = lastnr; ; break;} -case 27: -#line 501 "parser.y" +case 28: +#line 517 "parser.y" { psmsg ("bindto statement:", laststr); yyval.n = 1; @@ -1604,22 +1628,22 @@ case 27: yyval.set[0].v.sval = xstrdup(laststr); ; break;} -case 28: -#line 512 "parser.y" +case 29: +#line 528 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 29: -#line 521 "parser.y" +case 30: +#line 537 "parser.y" { setlastnr (SYMBOL); ; break;} -case 31: -#line 535 "parser.y" +case 32: +#line 551 "parser.y" { pimsg ("verbosity statement:", lastnr); yyval.n = 1; @@ -1628,26 +1652,26 @@ case 31: yyval.set[0].v.ival = lastnr; ; break;} -case 32: -#line 545 "parser.y" +case 33: +#line 561 "parser.y" { lastnr = 1; ; break;} -case 33: -#line 549 "parser.y" +case 34: +#line 565 "parser.y" { lastnr = 0; ; break;} -case 34: -#line 558 "parser.y" +case 35: +#line 574 "parser.y" { yyval = yyvsp[-2]; ; break;} -case 38: -#line 573 "parser.y" +case 39: +#line 589 "parser.y" { pimsg ("dispatch mode statement:", lastnr); yyval.n = 1; @@ -1662,14 +1686,14 @@ case 38: cur_service.name); ; break;} -case 39: -#line 590 "parser.y" +case 40: +#line 606 "parser.y" { setlastovernr (SYMBOL); ; break;} -case 40: -#line 596 "parser.y" +case 41: +#line 612 "parser.y" { psmsg ("external handler:", laststr); if (lastnr != ds_externalhandler) @@ -1678,102 +1702,130 @@ case 40: setlastext (laststr); ; break;} -case 41: -#line 607 "parser.y" +case 42: +#line 623 "parser.y" { yyval.n = 1; yyval.set = xmalloc (sizeof(Confset)); yyval.set[0].v.ival = lastnr; ; break;} -case 42: -#line 615 "parser.y" +case 43: +#line 631 "parser.y" { lastnr = ds_roundrobin; ; break;} -case 43: -#line 619 "parser.y" +case 44: +#line 635 "parser.y" { lastnr = ds_random; ; break;} -case 44: -#line 623 "parser.y" +case 45: +#line 639 "parser.y" { lastnr = ds_byduration; ; break;} -case 45: -#line 627 "parser.y" +case 46: +#line 643 "parser.y" { lastnr = ds_bysize; ; break;} -case 46: -#line 631 "parser.y" +case 47: +#line 647 "parser.y" { lastnr = ds_byorder; ; break;} -case 47: -#line 635 "parser.y" +case 48: +#line 651 "parser.y" { lastnr = ds_byconnections; ; break;} -case 48: -#line 639 "parser.y" +case 49: +#line 655 "parser.y" { lastnr = ds_externalhandler; ; break;} -case 49: -#line 643 "parser.y" +case 50: +#line 659 "parser.y" { lastnr = ds_byclientip; ; break;} -case 50: -#line 651 "parser.y" +case 51: +#line 667 "parser.y" { - pimsg ("user account statement:", laststr); + psmsg ("user account statement:", laststr); yyval.n = 1; yyval.set = xmalloc (sizeof(Confset)); yyval.set[0].cf = cf_useraccountspec; yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 51: -#line 662 "parser.y" +case 52: +#line 678 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 52: -#line 672 "parser.y" +case 53: +#line 689 "parser.y" { pimsg ("reviving interval statement:", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); + yyval.n = 2; + yyval.set = xmalloc (2 * sizeof(Confset)); yyval.set[0].cf = cf_revivespec; yyval.set[0].v.ival = lastnr; + if (yyvsp[-1].n) { + psmsg ("reviving externalhandler:", yyvsp[-1].set[0].v.sval); + yyval.set[1].v.sval = yyvsp[-1].set[0].v.sval; + } else + yyval.set[1].v.sval = 0; ; break;} -case 53: -#line 684 "parser.y" +case 54: +#line 707 "parser.y" +{ + pimsg ("check interval:", lastnr); + yyval.n = 2; + yyval.set = xmalloc (2 * sizeof(Confset)); + yyval.set[0].cf = cf_checkspec; + yyval.set[0].v.ival = lastnr; + if (yyvsp[-1].n) { + psmsg ("check externalhandler:", yyvsp[-1].set[0].v.sval); + yyval.set[1].v.sval = yyvsp[-1].set[0].v.sval; + } else + yyval.set[1].v.sval = 0; + ; + break;} +case 57: +#line 729 "parser.y" +{ + yyval.n = 1; + yyval.set = xmalloc (sizeof(Confset)); + yyval.set[0].v.sval = xstrdup (laststr); + ; + break;} +case 58: +#line 739 "parser.y" { pimsg ("backlog statement:", lastnr); yyval.n = 1; yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_revivespec; + yyval.set[0].cf = cf_backlogspec; yyval.set[0].v.ival = lastnr; ; break;} -case 54: -#line 696 "parser.y" +case 59: +#line 751 "parser.y" { pimsg ("shmkey statement:", lastnr); yyval.n = 1; @@ -1782,8 +1834,8 @@ case 54: yyval.set[0].v.ival = lastnr; ; break;} -case 55: -#line 708 "parser.y" +case 60: +#line 763 "parser.y" { pimsg ("connection timeout statement:", lastnr); yyval.n = 1; @@ -1792,8 +1844,8 @@ case 55: yyval.set[0].v.ival = lastnr; ; break;} -case 56: -#line 720 "parser.y" +case 61: +#line 775 "parser.y" { pimsg ("max clients statement (service):", lastnr); yyval.n = 1; @@ -1802,8 +1854,8 @@ case 56: yyval.set[0].v.ival = lastnr; ; break;} -case 57: -#line 732 "parser.y" +case 62: +#line 787 "parser.y" { pimsg ("service type:", lastnr); yyval.n = 1; @@ -1812,20 +1864,20 @@ case 57: yyval.set[0].v.ival = lastnr; ; break;} -case 59: -#line 747 "parser.y" +case 64: +#line 802 "parser.y" { lastnr = type_any; ; break;} -case 60: -#line 751 "parser.y" +case 65: +#line 806 "parser.y" { lastnr = type_http; ; break;} -case 61: -#line 759 "parser.y" +case 66: +#line 814 "parser.y" { pimsg ("service header inspection: ", lastnr); yyval.n = 1; @@ -1834,20 +1886,20 @@ case 61: yyval.set[0].v.ival = lastnr; ; break;} -case 63: -#line 774 "parser.y" +case 68: +#line 829 "parser.y" { lastnr = ins_deep; ; break;} -case 64: -#line 778 "parser.y" +case 69: +#line 833 "parser.y" { lastnr = ins_shallow; ; break;} -case 65: -#line 786 "parser.y" +case 70: +#line 841 "parser.y" { psmsg ("allow from: ", laststr); yyval.n = 1; @@ -1856,8 +1908,8 @@ case 65: yyval.set[0].v.sval = xstrdup(laststr); ; break;} -case 66: -#line 798 "parser.y" +case 71: +#line 853 "parser.y" { psmsg ("allow from: ", laststr); yyval.n = 1; @@ -1866,8 +1918,8 @@ case 66: yyval.set[0].v.sval = xstrdup(laststr); ; break;} -case 67: -#line 810 "parser.y" +case 72: +#line 865 "parser.y" { psmsg ("allow file: ", laststr); yyval.n = 1; @@ -1876,8 +1928,8 @@ case 67: yyval.set[0].v.sval = xstrdup(laststr); ; break;} -case 68: -#line 822 "parser.y" +case 73: +#line 877 "parser.y" { psmsg ("allow file: ", laststr); yyval.n = 1; @@ -1886,22 +1938,22 @@ case 68: yyval.set[0].v.sval = xstrdup(laststr); ; break;} -case 69: -#line 833 "parser.y" +case 74: +#line 888 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 70: -#line 845 "parser.y" +case 75: +#line 900 "parser.y" { yyval = yyvsp[-1]; ; break;} -case 71: -#line 852 "parser.y" +case 76: +#line 907 "parser.y" { psmsg ("backend name:", SYMBOL); for (i = 0; i < cur_service.nbackend; i++) @@ -1911,8 +1963,8 @@ case 71: cur_backend.name = xstrdup (SYMBOL); ; break;} -case 72: -#line 864 "parser.y" +case 77: +#line 919 "parser.y" { yyvsp[-1].n++; yyvsp[-1].set = xrealloc (yyvsp[-1].set, yyvsp[-1].n * sizeof(Confset)); @@ -1920,153 +1972,153 @@ case 72: yyval = yyvsp[-1]; ; break;} -case 73: -#line 871 "parser.y" +case 78: +#line 926 "parser.y" { yyval = yyvsp[0]; ; break;} -case 74: -#line 878 "parser.y" +case 79: +#line 933 "parser.y" { yyval = yyvsp[0]; ; break;} -case 75: -#line 884 "parser.y" +case 80: +#line 939 "parser.y" { psmsg ("backend server:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 76: -#line 889 "parser.y" +case 81: +#line 944 "parser.y" { pimsg ("backend port:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} -case 77: -#line 894 "parser.y" +case 82: +#line 949 "parser.y" { pimsg ("backend verbosity:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} -case 78: -#line 899 "parser.y" +case 83: +#line 954 "parser.y" { psmsg ("backend onstart:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 79: -#line 904 "parser.y" +case 84: +#line 959 "parser.y" { psmsg ("backend onend:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 80: -#line 909 "parser.y" +case 85: +#line 964 "parser.y" { psmsg ("backend onfail:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 81: -#line 914 "parser.y" +case 86: +#line 969 "parser.y" { psmsg ("backend trafficlog:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 82: -#line 919 "parser.y" +case 87: +#line 974 "parser.y" { psmsg ("backend trafficlog:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 83: -#line 924 "parser.y" +case 88: +#line 979 "parser.y" { pimsg ("backend weight:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} -case 84: -#line 929 "parser.y" +case 89: +#line 984 "parser.y" { pimsg ("backend decay:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} -case 85: -#line 934 "parser.y" +case 90: +#line 989 "parser.y" { pimsg ("backend maxconnections:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} -case 86: -#line 939 "parser.y" +case 91: +#line 994 "parser.y" { psmsg ("backend sticky cookie:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 87: -#line 944 "parser.y" +case 92: +#line 999 "parser.y" { psmsg ("addclientheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 88: -#line 949 "parser.y" +case 93: +#line 1004 "parser.y" { psmsg ("setclientheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 89: -#line 954 "parser.y" +case 94: +#line 1009 "parser.y" { psmsg ("appendclientheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 90: -#line 959 "parser.y" +case 95: +#line 1014 "parser.y" { psmsg ("addserverheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 91: -#line 964 "parser.y" +case 96: +#line 1019 "parser.y" { psmsg ("setserverheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 92: -#line 969 "parser.y" +case 97: +#line 1024 "parser.y" { psmsg ("appendserverheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} -case 93: -#line 974 "parser.y" +case 98: +#line 1029 "parser.y" { pimsg ("backend retries:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} -case 94: -#line 984 "parser.y" +case 99: +#line 1039 "parser.y" { psmsg ("server statement:", laststr); yyval.n = 1; @@ -2075,8 +2127,8 @@ case 94: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 95: -#line 996 "parser.y" +case 100: +#line 1051 "parser.y" { pimsg ("weight statement", lastnr); yyval.n = 1; @@ -2085,8 +2137,8 @@ case 95: yyval.set[0].v.ival = lastnr; ; break;} -case 96: -#line 1008 "parser.y" +case 101: +#line 1063 "parser.y" { pimsg ("decay statement", lastnr); yyval.n = 1; @@ -2095,14 +2147,14 @@ case 96: yyval.set[0].v.ival = lastnr; ; break;} -case 97: -#line 1018 "parser.y" +case 102: +#line 1073 "parser.y" { setlaststr (laststring); ; break;} -case 98: -#line 1026 "parser.y" +case 103: +#line 1081 "parser.y" { pimsg ("retries:", lastnr); yyval.n = 1; @@ -2111,8 +2163,8 @@ case 98: yyval.set[0].v.ival = lastnr; ; break;} -case 99: -#line 1038 "parser.y" +case 104: +#line 1093 "parser.y" { psmsg ("onstart statement:", laststr); yyval.n = 1; @@ -2121,8 +2173,8 @@ case 99: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 100: -#line 1050 "parser.y" +case 105: +#line 1105 "parser.y" { psmsg ("onfail statement:", laststr); yyval.n = 1; @@ -2131,8 +2183,8 @@ case 100: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 101: -#line 1062 "parser.y" +case 106: +#line 1117 "parser.y" { psmsg ("onend statement:", laststr); yyval.n = 1; @@ -2141,8 +2193,8 @@ case 101: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 102: -#line 1074 "parser.y" +case 107: +#line 1129 "parser.y" { psmsg ("trafficlog statement:", laststr); yyval.n = 1; @@ -2151,8 +2203,8 @@ case 102: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 103: -#line 1086 "parser.y" +case 108: +#line 1141 "parser.y" { psmsg ("throughputlog statement:", laststr); yyval.n = 1; @@ -2161,24 +2213,24 @@ case 103: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 104: -#line 1097 "parser.y" +case 109: +#line 1152 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 105: -#line 1106 "parser.y" +case 110: +#line 1161 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 106: -#line 1116 "parser.y" +case 111: +#line 1171 "parser.y" { psmsg ("insertcookie statement:", laststr); yyval.n = 1; @@ -2187,16 +2239,16 @@ case 106: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 107: -#line 1127 "parser.y" +case 112: +#line 1182 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 108: -#line 1137 "parser.y" +case 113: +#line 1192 "parser.y" { psmsg ("addclientheader statement:", laststr); yyval.n = 1; @@ -2205,8 +2257,8 @@ case 108: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 109: -#line 1149 "parser.y" +case 114: +#line 1204 "parser.y" { psmsg ("setclientheader statement:", laststr); yyval.n = 1; @@ -2215,8 +2267,8 @@ case 109: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 110: -#line 1161 "parser.y" +case 115: +#line 1216 "parser.y" { psmsg ("appendclientheader statement:", laststr); yyval.n = 1; @@ -2225,8 +2277,8 @@ case 110: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 111: -#line 1173 "parser.y" +case 116: +#line 1228 "parser.y" { psmsg ("addserverheader statement:", laststr); yyval.n = 1; @@ -2235,8 +2287,8 @@ case 111: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 112: -#line 1185 "parser.y" +case 117: +#line 1240 "parser.y" { psmsg ("setserverheader statement:", laststr); yyval.n = 1; @@ -2245,8 +2297,8 @@ case 112: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 113: -#line 1197 "parser.y" +case 118: +#line 1252 "parser.y" { psmsg ("appendserverheader statement:", laststr); yyval.n = 1; @@ -2255,124 +2307,124 @@ case 113: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 114: -#line 1208 "parser.y" +case 119: +#line 1263 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 115: -#line 1215 "parser.y" +case 120: +#line 1270 "parser.y" { yyerrmsg = "HTTP header specifier expected"; ; break;} -case 116: -#line 1220 "parser.y" +case 121: +#line 1275 "parser.y" { yyerrmsg = "cookie specifier expected"; ; break;} -case 117: -#line 1225 "parser.y" +case 122: +#line 1280 "parser.y" { yyerrmsg = "number expected"; ; break;} -case 118: -#line 1230 "parser.y" +case 123: +#line 1285 "parser.y" { yyerrmsg = "hostname or IP address expected"; ; break;} -case 119: -#line 1235 "parser.y" +case 124: +#line 1290 "parser.y" { yyerrmsg = "'service' expected"; ; break;} -case 120: -#line 1240 "parser.y" +case 125: +#line 1295 "parser.y" { yyerrmsg = "backend definition statement expected"; ; break;} -case 121: -#line 1245 "parser.y" +case 126: +#line 1300 "parser.y" { yyerrmsg = "service body statement expected"; ; break;} -case 122: -#line 1250 "parser.y" +case 127: +#line 1305 "parser.y" { yyerrmsg = "semicolon (;) expected"; ; break;} -case 123: -#line 1255 "parser.y" +case 128: +#line 1310 "parser.y" { yyerrmsg = "'on' or 'off' expetcted"; ; break;} -case 124: -#line 1260 "parser.y" +case 129: +#line 1315 "parser.y" { yyerrmsg = "dispatch method expected"; ; break;} -case 125: -#line 1265 "parser.y" +case 130: +#line 1320 "parser.y" { yyerrmsg = "command line expected"; ; break;} -case 126: -#line 1270 "parser.y" +case 131: +#line 1325 "parser.y" { yyerrmsg = "file name expected"; ; break;} -case 127: -#line 1275 "parser.y" +case 132: +#line 1330 "parser.y" { yyerrmsg = "service name (identifier) expected"; ; break;} -case 128: -#line 1280 "parser.y" +case 133: +#line 1335 "parser.y" { yyerrmsg = "backend name (identifier) expected"; ; break;} -case 129: -#line 1285 "parser.y" +case 134: +#line 1340 "parser.y" { yyerrmsg = "IP address such as 1.2.3.4 or 'any' expected"; ; break;} -case 130: -#line 1290 "parser.y" +case 135: +#line 1345 "parser.y" { yyerrmsg = "Service type expected ('any', 'stickyhttp', ...)"; ; break;} -case 131: -#line 1295 "parser.y" +case 136: +#line 1350 "parser.y" { yyerrmsg = "Header inspection mode mode expected ('shallow' or 'deep')"; ; break;} -case 132: -#line 1300 "parser.y" +case 137: +#line 1355 "parser.y" { yyerrmsg = "IP filter(s) expected"; ; break;} -case 133: -#line 1305 "parser.y" +case 138: +#line 1360 "parser.y" { yyerrmsg = "username expected"; ; @@ -2610,4 +2662,4 @@ yyreturn: #endif return yyresult; } -#line 1309 "parser.y" +#line 1364 "parser.y" diff --git a/src/lib/parser.h b/src/lib/parser.h @@ -57,6 +57,7 @@ # define HEADERINSPECTION 306 # define DEEP 307 # define SHALLOW 308 +# define CHECKINTERVAL 309 extern YYSTYPE yylval; diff --git a/src/lib/parser.y b/src/lib/parser.y @@ -12,7 +12,7 @@ static Backend cur_backend; /* Storage for a handled backend */ static Service cur_service; /* Storage for a handled service */ /* Parser debugging related */ -// #define PARSER_DEBUG +/* #define PARSER_DEBUG */ #ifdef PARSER_DEBUG static void pmsg (char const *x) { printf ("P: %s\n", x); @@ -138,6 +138,7 @@ static void setuseraccount (char *username) { ADDSERVERHEADER SETSERVERHEADER APPENDSERVERHEADER ALLOWFROM DENYFROM ALLOWFILE DENYFILE EXTERNALHANDLER ONEND USERACCOUNT BYCLIENTIP RETRIES HEADERINSPECTION DEEP SHALLOW + CHECKINTERVAL %% /* Config file grammar rules */ @@ -173,6 +174,12 @@ element: if (!cur_service.bind) cur_service.bind = "any"; + if (cur_service.rev_interval && cur_service.check_interval) + error ("Service %s has both a revivinginterval and " + "a checkinterval", cur_service.name); + if (!cur_service.check_cmd) + cur_service.check_cmd = xstrdup (""); + /* Add to the list. */ service = xrealloc (service, ++nservice * sizeof(Service)); service[nservice - 1] = cur_service; @@ -242,10 +249,19 @@ servicebody: | revivingintervalstatement { pimsg ("service revival interval:", $1.set[0].v.ival); + psmsg ("service revival cmd:", $1.set[1].v.sval); cur_service.rev_interval = $1.set[0].v.ival; + cur_service.check_cmd = $1.set[1].v.sval; free ($1.set); } | + checkintervalstatement { + pimsg ("service check interval:", $1.set[0].v.ival); + psmsg ("service check cmd:", $1.set[1].v.sval); + cur_service.check_interval = $1.set[0].v.ival; + cur_service.check_cmd = $1.set[1].v.sval; + } +| backlogstatement { pimsg ("service backlog:", $1.set[0].v.ival); cur_service.backlog = $1.set[0].v.ival; @@ -478,7 +494,7 @@ servicebody: sizeof(Backend)); cur_service.backend[cur_service.nbackend - 1] = cur_backend; - pimsg ("this was backend defintion", cur_service.nbackend); + pimsg ("this was backend definition", cur_service.nbackend); memset (&cur_backend, 0, sizeof(cur_backend)); } ; @@ -649,7 +665,7 @@ useraccountstatement: USERACCOUNT useraccount semicol { - pimsg ("user account statement:", laststr); + psmsg ("user account statement:", laststr); $$.n = 1; $$.set = xmalloc (sizeof(Confset)); $$.set[0].cf = cf_useraccountspec; @@ -669,12 +685,51 @@ useraccount: revivingintervalstatement: REVIVINGINTERVAL number + opt_externalhandler semicol { pimsg ("reviving interval statement:", lastnr); - $$.n = 1; - $$.set = xmalloc (sizeof(Confset)); + $$.n = 2; + $$.set = xmalloc (2 * sizeof(Confset)); $$.set[0].cf = cf_revivespec; $$.set[0].v.ival = lastnr; + if ($3.n) { + psmsg ("reviving externalhandler:", $3.set[0].v.sval); + $$.set[1].v.sval = $3.set[0].v.sval; + } else + $$.set[1].v.sval = 0; + } +; + +checkintervalstatement: + CHECKINTERVAL + number + opt_externalhandler + semicol { + pimsg ("check interval:", lastnr); + $$.n = 2; + $$.set = xmalloc (2 * sizeof(Confset)); + $$.set[0].cf = cf_checkspec; + $$.set[0].v.ival = lastnr; + if ($3.n) { + psmsg ("check externalhandler:", $3.set[0].v.sval); + $$.set[1].v.sval = $3.set[0].v.sval; + } else + $$.set[1].v.sval = 0; + } +; + +opt_externalhandler: + externalhandler + | + /* empty */ +; + +externalhandler: + EXTERNALHANDLER + commandline { + $$.n = 1; + $$.set = xmalloc (sizeof(Confset)); + $$.set[0].v.sval = xstrdup (laststr); } ; @@ -685,7 +740,7 @@ backlogstatement: pimsg ("backlog statement:", lastnr); $$.n = 1; $$.set = xmalloc (sizeof(Confset)); - $$.set[0].cf = cf_revivespec; + $$.set[0].cf = cf_backlogspec; $$.set[0].v.ival = lastnr; } ; diff --git a/src/lib/parserclose.c b/src/lib/parserclose.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserfilename.c b/src/lib/parserfilename.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserinput.c b/src/lib/parserinput.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parseropen.c b/src/lib/parseropen.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -42,7 +42,7 @@ void parser_open (char const *name) { parserstate[nparserstate].lineno = 0; parserstate[nparserstate].buf = xmalloc (statbuf.st_size + 1); nread = fread (parserstate[nparserstate].buf, 1, statbuf.st_size, f); - msg ("Got %d bytes from configuration %s", nread, actual); + /* msg ("Got %d bytes from configuration %s", nread, actual); */ if (nread < statbuf.st_size) error ("Read only %d bytes from configuration %s (out of %d)", nread, actual, (int) statbuf.st_size); diff --git a/src/lib/parserrun.c b/src/lib/parserrun.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserskipchar.c b/src/lib/parserskipchar.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserskipline.c b/src/lib/parserskipline.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/restart.c b/src/lib/restart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/runservice.c b/src/lib/runservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/serve.c b/src/lib/serve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/setproctitle.c b/src/lib/setproctitle.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/showconfig.c b/src/lib/showconfig.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/showservices.c b/src/lib/showservices.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/showstatus.c b/src/lib/showstatus.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -24,6 +24,8 @@ static char *timestr (double nsec) { free (tmp); } tmp = str_printf ("%.2fs", nsec); + if (!strcmp (tmp + strlen(tmp) - 4, ".00s")) + strcpy (tmp + strlen(tmp) - 4, "s"); buf = xstrcat (buf, tmp); free (tmp); @@ -55,6 +57,7 @@ static char *bytestr (double nbytes) { int show_status (int ac, char **av) { int i, j, services_shown = 0; + unsigned sec_ago; if (xml_status) { printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); @@ -92,6 +95,10 @@ int show_status (int ac, char **av) { for (j = 0; j < service[i].nbackend; j++) { if (ac > 2 && strcmp (service[i].backend[j].name, av[1])) continue; + if (! servicereport->backendstate[j].laststamp) + sec_ago = 0; + else + sec_ago = time(0) - servicereport->backendstate[j].laststamp; if (tabular_status) printf ("%s=%s ", service[i].backend[j].name, state_to_string(servicereport->backendstate[j].avail)); @@ -113,6 +120,8 @@ int show_status (int ac, char **av) { timestr (servicereport->backendstate[j].nsec), servicereport->backendstate[j].nbytes, bytestr (servicereport->backendstate[j].nbytes)); + printf (" <lastaccess sec=\"%u\">%s</lastaccess>\n", + sec_ago, timestr( (double) sec_ago)); if (service[i].type == type_http) printf (" <sessions>%lu</sessions>\n", servicereport->backendstate[j].sessions); @@ -138,6 +147,7 @@ int show_status (int ac, char **av) { printf (", avg %s, %s", timestr(servicereport->backendstate[j].avg_nsec), bytestr(servicereport->backendstate[j].avg_nbytes)); + printf (", last hit %s ago", timestr ( (double) sec_ago)); putchar ('\n'); } } diff --git a/src/lib/stagetostring.c b/src/lib/stagetostring.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/statetostring.c b/src/lib/statetostring.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/stopdaemon.c b/src/lib/stopdaemon.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strcasestr.c b/src/lib/strcasestr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strexpandformat.c b/src/lib/strexpandformat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -20,15 +20,18 @@ char *fmt_expand (char const *s, int *skip, int target_backend) { * %t, %T - timestamp of local or GMT time * %v - Crossroads version * %w - weight of current back end, %1w = first back end etc. + * %h - hostname of current back end, %1h = first etc. + * %p - port of current back end, %1p = first etc. */ *skip = 1; switch (*s) { case 'a': - if (backend_available (target_backend)) - return ("1"); - return ("0"); + if (target_backend < 0 || target_backend >= activeservice->nbackend || + !backend_available (target_backend)) + return ("0"); + return ("1"); case 'b': if (target_backend >= 0 && target_backend < activeservice->nbackend) @@ -39,6 +42,11 @@ char *fmt_expand (char const *s, int *skip, int target_backend) { snprintf (buf, sizeof(buf) - 1, "%u", (unsigned) time(0)); return (buf); + case 'h': + if (target_backend < 0 || target_backend >= activeservice->nbackend) + return ("noname"); + return (activeservice->backend[target_backend].server); + case 'n': if (target_backend >= 0 && target_backend < activeservice->nbackend) { snprintf (buf, sizeof(buf) - 1, "%u", @@ -47,6 +55,13 @@ char *fmt_expand (char const *s, int *skip, int target_backend) { return (buf); } return ("0"); + + case 'p': + if (target_backend < 0 || target_backend >= activeservice->nbackend) + return ("0"); + snprintf (buf, sizeof(buf), "%d", + activeservice->backend[target_backend].port); + return (buf); case 'r': if (client_ip && *client_ip) diff --git a/src/lib/stringtostate.c b/src/lib/stringtostate.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strlcat.c b/src/lib/strlcat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strprintf.c b/src/lib/strprintf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strvprintf.c b/src/lib/strvprintf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtabend.c b/src/lib/symtabend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtablookup.c b/src/lib/symtablookup.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtabset.c b/src/lib/symtabset.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtabstart.c b/src/lib/symtabstart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/sysrun.c b/src/lib/sysrun.c @@ -1,24 +1,28 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" -void sysrun (char const *cmd) { +int sysrun (char const *cmd) { char *expanded; int ret; if (!cmd || ! *cmd) - return; + return (0); expanded = str_expand_format (cmd); - msg ("Service %s: running command: '%s'", activeservice->name, expanded); + if (program_stage != stage_retrying) + msg ("Service %s: running command: '%s'", + activeservice->name, expanded); uid_assume(); - if ( (ret = system (expanded)) ) + if ( (ret = system (expanded)) && program_stage != stage_retrying) warning ("Service %s: command '%s' -> '%s' returned %d", activeservice->name, cmd, expanded, ret); uid_restore(); free (expanded); + + return (ret); } diff --git a/src/lib/tcpserve.c b/src/lib/tcpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -19,7 +19,8 @@ void tcpserve (int server_sock) { /* Child termination is ignored. */ signal (SIGCHLD, SIG_IGN); /* Set wakeup handler for the wakeup calls. */ - if (activeservice->rev_interval) { + if (activeservice->rev_interval || activeservice->check_interval) { + msg ("Service %s: Starting wakeup handler", activeservice->name); if ( (pid = fork()) < 0 ) error ("Fork failed: %s", strerror(errno)); else if (!pid) { @@ -31,6 +32,11 @@ void tcpserve (int server_sock) { activeservice->name, pid); servicereport->rev_pid = pid; } + } else { + msg ("Service %s: Wakeup hander not started (reviving interval " + "%d, check %d)", + activeservice->name, activeservice->rev_interval, + activeservice->check_interval); } } diff --git a/src/lib/tellservice.c b/src/lib/tellservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/thruputlog.c b/src/lib/thruputlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/trafficlog.c b/src/lib/trafficlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/uidassume.c b/src/lib/uidassume.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/uidrestore.c b/src/lib/uidrestore.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/unlockreporter.c b/src/lib/unlockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/usage.c b/src/lib/usage.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/vsyslog.c b/src/lib/vsyslog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/wakeuphandler.c b/src/lib/wakeuphandler.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -8,7 +8,9 @@ void wakeup_handler () { int sock, i; + Backendavail av, prev; + /* Set the stage and any signals that we want. */ program_stage = stage_retrying; for (i = 0; relevant_sigs[i]; i++) @@ -19,38 +21,70 @@ void wakeup_handler () { */ while (1) { /* Wait for the alarm to go off. */ - sleep (activeservice->rev_interval); + if (activeservice->rev_interval) + sleep (activeservice->rev_interval); + else + sleep (activeservice->check_interval); /* Now do our stuff. */ for (current_backend = 0; current_backend < activeservice->nbackend; current_backend++) { - /* Only loop through unavailable back ends. */ - if (servicereport->backendstate[current_backend].avail != - st_unavailable) + /* If we're in the REVIVING mode and the back end isn't + * unavailable, then we don't need to check it. Also, + * back ends marked DOWN on purpose are skipped. */ + prev = servicereport->backendstate[current_backend].avail; + if ( (prev == st_down) || + (activeservice->rev_interval && prev != st_unavailable) ) continue; - /* Mark state as WAKING */ + /* + msg ("Service %s: verifying back end %s, old state %s", + activeservice->name, + activeservice->backend[current_backend].name, + state_to_string(prev)); + */ + + /* Mark state as WAKING */ lock_reporter(); servicereport->backendstate[current_backend].avail = st_waking; unlock_reporter(); - /* Try to TCP connect */ - sock = backend_connect(); - + if (! activeservice->check_cmd) { + /* In TCP-only mode: do the connect */ + if ( (sock = backend_connect()) >= 0 ) { + close (sock); + av = st_available; + } else + av = st_unavailable; + } else { + /* In checkscript mode: do the checking */ + if (!sysrun (activeservice->check_cmd)) + av = st_available; + else + av = st_unavailable; + } + /* Set state accordingly */ - if (sock >= 0) { - close (sock); - warning ("Backend %s of service %s has woken up", - activeservice->backend[current_backend].name, - activeservice->name); + if (prev != av) { + if (av == st_available) + warning ("Backend %s of service %s has woken up", + activeservice->backend[current_backend].name, + activeservice->name); + else + warning ("Backend %s of service %s has died", + activeservice->backend[current_backend].name, + activeservice->name); } + + /* Store the new state. If the new state is AVAILABLE + * then reset the error count (used by retries config value). */ lock_reporter(); - servicereport->backendstate[current_backend].avail = - sock >= 0 ? st_available : st_unavailable; - servicereport->backendstate[current_backend].fail = 0; - unlock_reporter(); + servicereport->backendstate[current_backend].avail = av; + if (av == st_available) + servicereport->backendstate[current_backend].fail = 0; + unlock_reporter(); } } } diff --git a/src/lib/warning.c b/src/lib/warning.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/writelog.c b/src/lib/writelog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xcalloc.c b/src/lib/xcalloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xmalloc.c b/src/lib/xmalloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xrealloc.c b/src/lib/xrealloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xstrcat.c b/src/lib/xstrcat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xstrcatch.c b/src/lib/xstrcatch.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xstrdup.c b/src/lib/xstrdup.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.46, a load balancer and fail over + * This file is part of Crosroads 1.47, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/test/bad14.conf b/test/bad14.conf @@ -0,0 +1,40 @@ +/* Bad configuration + both revivinginterval and checkinterval present */ + +service test { + port 10001; + type http; + bindto any; + dispatchmode bysize; + connectiontimeout 600; + verbosity on; + revivinginterval 12; + checkinterval 13; + + backend a { + server localhost; + port 10000; + weight 2; + decay 5; + stickycookie BalancerID=Backend_A; + addclientheader "Set-Cookie: BalancerID=Backend_A; Path=/"; + } + + backend b { + server localhost; + port 10000; + weight 2; + decay 5; + stickycookie BalancerID=Backend_B; + addclientheader "Set-Cookie: BalancerID=Backend_B; Path=/"; + } + + backend c { + server localhost; + port 10000; + weight 3; + decay 5; + stickycookie BalancerID=Backend_C; + addclientheader "Set-Cookie: BalancerID=Backend_C; Path=/"; + } +} diff --git a/test/bad15.conf b/test/bad15.conf @@ -0,0 +1,39 @@ +/* Bad configuration + syntax error in checkinterval */ + +service test { + port 10001; + type http; + bindto any; + dispatchmode bysize; + connectiontimeout 600; + verbosity on; + checkinterval 13 xyzzy; + + backend a { + server localhost; + port 10000; + weight 2; + decay 5; + stickycookie BalancerID=Backend_A; + addclientheader "Set-Cookie: BalancerID=Backend_A; Path=/"; + } + + backend b { + server localhost; + port 10000; + weight 2; + decay 5; + stickycookie BalancerID=Backend_B; + addclientheader "Set-Cookie: BalancerID=Backend_B; Path=/"; + } + + backend c { + server localhost; + port 10000; + weight 3; + decay 5; + stickycookie BalancerID=Backend_C; + addclientheader "Set-Cookie: BalancerID=Backend_C; Path=/"; + } +} diff --git a/test/t11.conf b/test/t11.conf @@ -0,0 +1,41 @@ +#define SERVICENAME test +#define SERVICEPORT 10001 +#define BACKENDSERVER localhost +#define BACKPORT 80 + +service test { + port SERVICEPORT; + type http; + bindto any; + dispatchmode bysize; + connectiontimeout 600; + verbosity on; + checkinterval 5; + + backend a { + server BACKENDSERVER; + port BACKPORT; + weight 2; + decay 5; + stickycookie BalancerID=Backend_A; + addclientheader "Set-Cookie: BalancerID=Backend_A; Path=/"; + } + + backend b { + server BACKENDSERVER:BACKPORT; + port BACKPORT; + weight 2; + decay 5; + stickycookie BalancerID=Backend_B; + addclientheader "Set-Cookie: BalancerID=Backend_B; Path=/"; + } + + backend c { + server BACKENDSERVER; + port BACKPORT; + weight 3; + decay 5; + stickycookie BalancerID=Backend_C; + addclientheader "Set-Cookie: BalancerID=Backend_C; Path=/"; + } +} diff --git a/test/t12.conf b/test/t12.conf @@ -0,0 +1,41 @@ +#define SERVICENAME test +#define SERVICEPORT 10001 +#define BACKENDSERVER localhost +#define BACKPORT 80 + +service test { + port SERVICEPORT; + type http; + bindto any; + dispatchmode bysize; + connectiontimeout 600; + verbosity on; + checkinterval 5 externalhandler "myscript"; + + backend a { + server BACKENDSERVER; + port BACKPORT; + weight 2; + decay 5; + stickycookie BalancerID=Backend_A; + addclientheader "Set-Cookie: BalancerID=Backend_A; Path=/"; + } + + backend b { + server BACKENDSERVER:BACKPORT; + port BACKPORT; + weight 2; + decay 5; + stickycookie BalancerID=Backend_B; + addclientheader "Set-Cookie: BalancerID=Backend_B; Path=/"; + } + + backend c { + server BACKENDSERVER; + port BACKPORT; + weight 3; + decay 5; + stickycookie BalancerID=Backend_C; + addclientheader "Set-Cookie: BalancerID=Backend_C; Path=/"; + } +}