crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

commit 47934b5630003dd511e8292388698ff0d4b967c6
parent 7db9a3caf3cc61ce595263f7f905daf331a5dc0c
Author: finwo <finwo@pm.me>
Date:   Sat,  3 Jan 2026 19:33:15 +0100

1.50

Diffstat:
MChangeLog | 9+++++++++
Mdoc/crossroads.1 | 6+++++-
Mdoc/crossroads.conf.7 | 19+++++++++++++++++++
Mdoc/crossroads.html | 278+++++++++++++++++++++++++++++++++++++++++++------------------------------------
Mdoc/crossroads.pdf | 0
Adoc/main/conf/state.yo | 13+++++++++++++
Mdoc/main/config.yo | 1+
Mdoc/main/using.yo | 24+++++++++++++++---------
Mdoc/man/crossroads.yo | 5++++-
Metc/Makefile.conf | 2+-
Metc/Makefile.def | 5++++-
Metc/svnrev.txt | 2+-
Msrc/crossroads-daemon/main.c | 2+-
Msrc/crossroads-mgr/crossroads-mgr.in | 42+++++++++++++++++++++++++++++++++---------
Msrc/crossroads-mgr/crossroads-mgr.xslt | 36++++++++++++++++++++++++++++--------
Msrc/crossroads.h | 30+++++++++++++++++-------------
Msrc/crossroads/main.c | 4++--
Msrc/lib/Makefile | 1+
Msrc/lib/allocreporter.c | 2+-
Msrc/lib/ansistamp.c | 2+-
Msrc/lib/backendavailable.c | 4++--
Msrc/lib/backendconnect.c | 37+++++++++++++++++++------------------
Msrc/lib/backendcount.c | 2+-
Msrc/lib/choosebackend.c | 8++++----
Msrc/lib/configread.c | 7++++---
Msrc/lib/configtest.c | 2+-
Msrc/lib/configwrite.c | 7++++---
Msrc/lib/copysockets.c | 2+-
Msrc/lib/createcommandlinespace.c | 2+-
Msrc/lib/data.c | 2+-
Msrc/lib/deallocreporter.c | 2+-
Msrc/lib/decrclientcount.c | 2+-
Msrc/lib/dns.c | 2+-
Msrc/lib/error.c | 2+-
Msrc/lib/forktcpservicer.c | 2+-
Msrc/lib/hashpjw.c | 2+-
Msrc/lib/httpcopy.c | 2+-
Msrc/lib/httperror.c | 2+-
Msrc/lib/httpheaderaddheader.c | 2+-
Msrc/lib/httpheaderappendheader.c | 2+-
Msrc/lib/httpheaderconnectiontype.c | 2+-
Msrc/lib/httpheaderfree.c | 2+-
Msrc/lib/httpheaderhascookie.c | 2+-
Msrc/lib/httpheaderhttpver.c | 2+-
Msrc/lib/httpheadernew.c | 2+-
Msrc/lib/httpheaderread.c | 2+-
Msrc/lib/httpheaderremoveheader.c | 2+-
Msrc/lib/httpheadersetheader.c | 2+-
Msrc/lib/httpheaderval.c | 2+-
Msrc/lib/httpheaderwrite.c | 2+-
Msrc/lib/httpinsertheader.c | 2+-
Msrc/lib/httpserve.c | 2+-
Msrc/lib/httpserversocket.c | 4++--
Msrc/lib/httpwrite.c | 2+-
Msrc/lib/incrclientcount.c | 2+-
Msrc/lib/initsockaddr.c | 2+-
Msrc/lib/interrupt.c | 2+-
Msrc/lib/ipfaddallow.c | 2+-
Msrc/lib/ipfadddeny.c | 2+-
Msrc/lib/ipfallowed.c | 2+-
Msrc/lib/ipfdenied.c | 2+-
Msrc/lib/ipfloadfile.c | 2+-
Msrc/lib/ipfmatch.c | 2+-
Msrc/lib/ipfparse.c | 2+-
Msrc/lib/ishexdigit.c | 2+-
Msrc/lib/isspace.c | 2+-
Msrc/lib/lexer.c | 938+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Msrc/lib/lexer.l | 20++++++++++++++++++++
Msrc/lib/lockreporter.c | 2+-
Msrc/lib/logactivityany.c | 8+++++---
Msrc/lib/logactivitycontinuation.c | 2+-
Msrc/lib/logactivityend.c | 2+-
Msrc/lib/logactivitystart.c | 2+-
Msrc/lib/makesocket.c | 2+-
Msrc/lib/markactivity.c | 18+++++++++++-------
Msrc/lib/msg.c | 2+-
Msrc/lib/msgdumpbuf.c | 2+-
Msrc/lib/netbuffer.c | 2+-
Msrc/lib/netbufread.c | 2+-
Msrc/lib/netcopy.c | 2+-
Msrc/lib/netread.c | 2+-
Msrc/lib/netwrite.c | 2+-
Msrc/lib/parser.c | 690+++++++++++++++++++++++++++++++++++++++++++------------------------------------
Msrc/lib/parser.h | 4++++
Msrc/lib/parser.y | 55++++++++++++++++++++++++++++++++++++++++++++++++++-----
Msrc/lib/parserclose.c | 2+-
Msrc/lib/parserfilename.c | 2+-
Msrc/lib/parserinput.c | 2+-
Msrc/lib/parseropen.c | 2+-
Msrc/lib/parserrun.c | 2+-
Msrc/lib/parserskipchar.c | 2+-
Msrc/lib/parserskipline.c | 2+-
Msrc/lib/restart.c | 2+-
Msrc/lib/runservice.c | 2+-
Msrc/lib/serve.c | 2+-
Msrc/lib/setproctitle.c | 2+-
Msrc/lib/showconfig.c | 5+++--
Msrc/lib/showservices.c | 6+++---
Msrc/lib/showstatus.c | 27++++++++++++++++++---------
Msrc/lib/stagetostring.c | 2+-
Msrc/lib/statetostring.c | 2+-
Msrc/lib/stopdaemon.c | 2+-
Msrc/lib/strcasestr.c | 2+-
Msrc/lib/strexpandformat.c | 6+++---
Msrc/lib/stringtostate.c | 2+-
Msrc/lib/strlcat.c | 2+-
Msrc/lib/strprintf.c | 2+-
Msrc/lib/strupr.c | 2+-
Msrc/lib/strvprintf.c | 2+-
Msrc/lib/symtabend.c | 2+-
Msrc/lib/symtablookup.c | 2+-
Msrc/lib/symtabset.c | 2+-
Msrc/lib/symtabstart.c | 2+-
Msrc/lib/sysrun.c | 2+-
Msrc/lib/tcpserve.c | 38++++++++++++++++++++++++++++----------
Msrc/lib/tellservice.c | 51+++++++++++++++++++++++++++++++++++++--------------
Msrc/lib/thruputlog.c | 2+-
Msrc/lib/trafficlog.c | 2+-
Msrc/lib/uidassume.c | 2+-
Msrc/lib/uidrestore.c | 2+-
Msrc/lib/unlockreporter.c | 2+-
Msrc/lib/usage.c | 2+-
Msrc/lib/usage.txt | 11+++++++----
Msrc/lib/vsyslog.c | 2+-
Msrc/lib/wakeuphandler.c | 9+++++----
Msrc/lib/warning.c | 2+-
Msrc/lib/writelog.c | 2+-
Msrc/lib/xcalloc.c | 2+-
Msrc/lib/xmalloc.c | 2+-
Msrc/lib/xrealloc.c | 2+-
Msrc/lib/xstrcat.c | 2+-
Msrc/lib/xstrcatch.c | 2+-
Msrc/lib/xstrdup.c | 2+-
Atest/bad16.conf | 44++++++++++++++++++++++++++++++++++++++++++++
Atest/t13.conf | 43+++++++++++++++++++++++++++++++++++++++++++
135 files changed, 1583 insertions(+), 1124 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,6 +1,15 @@ ChangeLog for Crossroads ------------------------------------------------------------------------------ +1.50 [KK 2007-07-08] + - Back end states can be initially set using the "state" + directive. Command "crossroads tell" now requires keyword + "state" for setting the state. + - Introduced actual_server and actual_port in SHM block for back + end addresses. Introduced define FQDN_LENGTH. Back end addresses + can be set using "crossroads tell". + - Web front end crossroads-mgr can now redefine a back end address. + 1.49 [KK 2007-07-04] - Next development cycle version. diff --git a/doc/crossroads.1 b/doc/crossroads.1 @@ -18,7 +18,11 @@ configuration services .IP o \fBcrossroads\fP \fI[flags]\fP \fBtell\fP \fIservice\fP -\fIbackend\fP \fIstate\fP: sets a back end state +\fIbackend\fP \fBstate\fP \fInewstate\fP: sets a back end state +.IP o +\fBcrossroads\fP \fI[flags]\fP \fBtell\fP \fIservice\fP +\fIbackend\fP \fBserver\fP \fIhostname:port\fP: redefines the +address of a back end .PP .SH "DESCRIPTION" diff --git a/doc/crossroads.conf.7 b/doc/crossroads.conf.7 @@ -674,6 +674,25 @@ hit\&. 0, meaning that no decay is applied to usage statistics\&. .PP +\fBstate - Setting an initial back end state\fP +.IP "Description:" +Using the \f(CWstate\fP directive a back end can be \&'primed\&' with an +initial state\&. The keyword \f(CWstate\fP can be followed by +\f(CWavailable\fP, \f(CWunavailable\fP or \f(CWdown\fP\&. Back ends marked +\f(CWunavailable\fP are excluded as candidates, but are checked when +a \f(CWrevivinginterval\fP or a \f(CWcheckinterval\fP is used\&. Back ends +marked \f(CWdown\fP are excluded and never re-checked\&. +.IP "Syntax:" +.IP o +\f(CWstate\fP \fIspecifier\fP \f(CW;\fP +.IP o +where \fIspecifier\fP is one of \f(CWavailable\fP, +\f(CWunavailable\fP or \f(CWdown\fP +.IP "Default:" +\f(CWavailable\fP, meaning that a back end is a candidate for +initial dispatching\&. + +.PP \fBonstart, onend, onfail - Action Hooks\fP .IP "Description:" The three directives \f(CWonstart\fP, \f(CWonend\fP and \f(CWonfail\fP can be 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.48</title> +<title>Crossroads 1.50</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.48</h1> +<h1>Crossroads 1.50</h1> <h2>Karel Kubat <br> Maintained by Karel Kubat (karel@kubat.nl)</h2> @@ -85,90 +85,91 @@ <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> +<dt><a href="#l44">4.3.6: state - Setting an initial back end state</a></dt> +<dt><a href="#l45">4.3.7: onstart, onend, onfail - Action Hooks</a></dt> +<dt><a href="#l46">4.3.8: trafficlog and throughputlog - Debugging and Performance Aids</a></dt> +<dt><a href="#l47">4.3.9: stickycookie - Back end selection with an HTTP cookie</a></dt> +<dt><a href="#l48">4.3.10: HTTP Header Modification Directives</a></dt> </dl> </dl> -<dt><h3><a href="#l48">5: Tips, Tricks and Random Remarks</a></h3></dt> +<dt><h3><a href="#l49">5: Tips, Tricks and Random Remarks</a></h3></dt> <dl> -<dt><a href="#l49">5.1: Configuration examples</a></dt> +<dt><a href="#l50">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> +<dt><a href="#l51">5.1.1: A load balancer for three webserver back ends</a></dt> +<dt><a href="#l52">5.1.2: An HTTP forwarder when travelling</a></dt> +<dt><a href="#l53">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> +<dt><a href="#l54">5.2: How back ends are selected in load balancing</a></dt> <dl> -<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> +<dt><a href="#l55">5.2.1: Bysize, byduration or byconnections?</a></dt> +<dt><a href="#l56">5.2.2: Averaging size and duration</a></dt> +<dt><a href="#l57">5.2.3: Specifying decays</a></dt> +<dt><a href="#l58">5.2.4: Adjusting the weights</a></dt> </dl> -<dt><a href="#l58">5.3: Periodic probes and wake up calls</a></dt> +<dt><a href="#l59">5.3: Periodic probes and wake up calls</a></dt> <dl> -<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> +<dt><a href="#l60">5.3.1: Syntax</a></dt> +<dt><a href="#l61">5.3.2: Security Considerations</a></dt> +<dt><a href="#l62">5.3.3: An example</a></dt> </dl> -<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> +<dt><a href="#l63">5.4: Throttling the number of concurrent connections</a></dt> +<dt><a href="#l64">5.5: TCP Session Stickiness</a></dt> +<dt><a href="#l65">5.6: HTTP Session Stickiness</a></dt> <dl> -<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> +<dt><a href="#l66">5.6.1: Don't use stickiness!</a></dt> +<dt><a href="#l67">5.6.2: But if you must..</a></dt> </dl> -<dt><a href="#l67">5.7: Passing the client's IP address</a></dt> +<dt><a href="#l68">5.7: Passing the client's IP address</a></dt> <dl> -<dt><a href="#l68">5.7.1: Sample Crossroads configuration</a></dt> -<dt><a href="#l69">5.7.2: Sample Apache configuration</a></dt> +<dt><a href="#l69">5.7.1: Sample Crossroads configuration</a></dt> +<dt><a href="#l70">5.7.2: Sample Apache configuration</a></dt> </dl> -<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> +<dt><a href="#l71">5.8: Deep or shallow HTTP header inspection</a></dt> +<dt><a href="#l72">5.9: Debugging network traffic</a></dt> +<dt><a href="#l73">5.10: IP filtering: Limiting Access by Client IP Address</a></dt> <dl> -<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> +<dt><a href="#l74">5.10.1: General Examples</a></dt> +<dt><a href="#l75">5.10.2: Using External Files</a></dt> +<dt><a href="#l76">5.10.3: Mixing Directives</a></dt> </dl> -<dt><a href="#l76">5.11: Using an external program to dispatch</a></dt> +<dt><a href="#l77">5.11: Using an external program to dispatch</a></dt> <dl> -<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> +<dt><a href="#l78">5.11.1: Configuring the external handler</a></dt> +<dt><a href="#l79">5.11.2: Writing the external handler</a></dt> +<dt><a href="#l80">5.11.3: Examples of external handlers</a></dt> </dl> -<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> +<dt><a href="#l81">5.12: Linux and ip_conntrack_max</a></dt> +<dt><a href="#l82">5.13: Marking back ends as bad after more than one try</a></dt> +<dt><a href="#l83">5.14: Using the Web Interface crossroads-mgr</a></dt> <dl> -<dt><a href="#l83">5.14.1: Starting crossroads-mgr</a></dt> +<dt><a href="#l84">5.14.1: Starting crossroads-mgr</a></dt> </dl> -<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> +<dt><a href="#l85">5.15: Rendering Crossroads' status in a web page</a></dt> +<dt><a href="#l86">5.16: Crossroads and DNS caching</a></dt> </dl> -<dt><h3><a href="#l86">6: Benchmarking</a></h3></dt> +<dt><h3><a href="#l87">6: Benchmarking</a></h3></dt> <dl> -<dt><a href="#l87">6.1: Benchmark 1: Accessing a proxy via crossroads or directly</a></dt> +<dt><a href="#l88">6.1: Benchmark 1: Accessing a proxy via crossroads or directly</a></dt> <dl> -<dt><a href="#l88">6.1.1: Results</a></dt> -<dt><a href="#l89">6.1.2: Discussion</a></dt> +<dt><a href="#l89">6.1.1: Results</a></dt> +<dt><a href="#l90">6.1.2: Discussion</a></dt> </dl> -<dt><a href="#l90">6.2: Benchmark 2: Crossroads versus Linux Virtual Server (LVS)</a></dt> +<dt><a href="#l91">6.2: Benchmark 2: Crossroads versus Linux Virtual Server (LVS)</a></dt> <dl> -<dt><a href="#l91">6.2.1: Environment</a></dt> -<dt><a href="#l92">6.2.2: Tests and results</a></dt> +<dt><a href="#l92">6.2.1: Environment</a></dt> +<dt><a href="#l93">6.2.2: Tests and results</a></dt> </dl> </dl> -<dt><h3><a href="#l93">7: Compiling and Installing</a></h3></dt> +<dt><h3><a href="#l94">7: Compiling and Installing</a></h3></dt> <dl> -<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> +<dt><a href="#l95">7.1: Prerequisites</a></dt> +<dt><a href="#l96">7.2: Compiling and installing</a></dt> +<dt><a href="#l97">7.3: Configuring crossroads</a></dt> +<dt><a href="#l98">7.4: A boot script</a></dt> <dl> -<dt><a href="#l98">7.4.1: SysV Style Startup</a></dt> -<dt><a href="#l99">7.4.2: BSD Style Startup</a></dt> +<dt><a href="#l99">7.4.1: SysV Style Startup</a></dt> +<dt><a href="#l100">7.4.2: BSD Style Startup</a></dt> </dl> <p><hr><p> @@ -547,12 +548,16 @@ This section shows the most basic usage. As said above, start <li> <code>crossroad status</code> reports on each running service. Per service, the state of each back end is reported. - <li> <code>crossroads tell</code> <em>service backend state</em> is a + <li> <code>crossroads tell</code> <em>service backend</em> <code>state</code> + <em>newstate</em> is a command line way of telling crossroads that a given back end, of a given service, is in a given state. Normally crossroads maintains state information itself, but by using <code>crossroads tell</code>, a back end can be e.g. taken 'off line' for servicing. + <li> <code>crossroads tel</code> <em>service backend</em> <code>server</code> + <em>hostname:port</em> redefines the back end address of a + running back end. <li> <code>crossroads configtest</code> tells you whether the configuration is syntactially correct. <li> <code>crossroads services</code> reports on the configured @@ -560,10 +565,6 @@ This section shows the most basic usage. As said above, start option only shows what's configured -- not what's up and running. Therefore, <code>crossroads services</code> doesn't report on back end states. - <li> <code>crossroads sampleconf</code> shows a sample configuration on - screen. A good way of quicky viewing the configuration - file syntax, or of getting a start for your own - configuration /etc/crossroads.conf. </ul> <p> <a name="l15"></a> @@ -591,16 +592,22 @@ follows: <li> The first string on the line is the service name. <li> After this, a series follows of <em>backendname=state</em>, where the back end name is the configured name of the back - end, and where state is e.g. <code>available</code>, <code>DOWN</code>, - <code>UNAVAILABLE</code>, <code>WAKING</code>. All statuses that cause - Crossroads not to use the back end are in caps. The series is - repeated for all back ends of the given service.</ul> + end, and where state is e.g. <code>available</code>, <code>down</code>, + <code>unavailable</code>, <code>waking</code>. The statuses may occur in caps. + The series is repeated for all back ends of the given service.</ul> <p> The flag <code>-x</code> causes the overview to be presented as an XML 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> +The status reporter shows the number of running connections per back +end, and the total of connections of the entire service. Due to +technical reasons the total count can be one off. (There is a +technical reason for this: the total counter gets updated at a +different rate than separate back end counts. This may be fixed in a +future release.) +<p> <a name="l16"></a> <strong>3.1.3: Logging-related options</strong> <p> @@ -1300,8 +1307,25 @@ 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="l44"></a> -<strong>4.3.6: onstart, onend, onfail - Action Hooks</strong> <a name="confonstart, onend, onfail - Action Hooks"></a> +<a name="conf/state"></a><a name="l44"></a> +<strong>4.3.6: state - Setting an initial back end state</strong> <a name="confstate - Setting an initial back end state"></a> + <dl> + <p><dt><strong>Description:</strong><dd> Using the <code>state</code> directive a back end can be 'primed' with an + initial state. The keyword <code>state</code> can be followed by + <code>available</code>, <code>unavailable</code> or <code>down</code>. Back ends marked + <code>unavailable</code> are excluded as candidates, but are checked when + a <code>revivinginterval</code> or a <code>checkinterval</code> is used. Back ends + marked <code>down</code> are excluded and never re-checked. + <p><dt><strong>Syntax:</strong><dd> <ul> + <li> <code>state</code> <em>specifier</em> <code>;</code> + <li> where <em>specifier</em> is one of <code>available</code>, + <code>unavailable</code> or <code>down</code></ul> + <p><dt><strong>Default:</strong><dd> <code>available</code>, meaning that a back end is a candidate for + initial dispatching. + </dl> +<p> +<a name="conf/onhooks"></a><a name="l45"></a> +<strong>4.3.7: 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 specified to start system commands (external programs) when a @@ -1360,8 +1384,8 @@ 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="l45"></a> -<strong>4.3.7: trafficlog and throughputlog - Debugging and Performance Aids</strong> <a name="conftrafficlog and throughputlog - Debugging and Performance Aids"></a> +<a name="conf/trafficlog"></a><a name="l46"></a> +<strong>4.3.8: 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 to log network traffic to files. They are <code>trafficlog</code> and @@ -1380,8 +1404,8 @@ 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="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> +<a name="conf/stickycookie"></a><a name="l47"></a> +<strong>4.3.9: 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> causes Crossroads to unpack clients' requests, to check for @@ -1420,8 +1444,8 @@ 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="l47"></a> -<strong>4.3.9: HTTP Header Modification Directives</strong> <a name="confHTTP Header Modification Directives"></a> +<a name="conf/addclientheader"></a><a name="l48"></a> +<strong>4.3.10: HTTP Header Modification Directives</strong> <a name="confHTTP Header Modification Directives"></a> <dl> <p><dt><strong>Description:</strong><dd> Crossroads understands the following header modification directives: <code>addclientheader</code>, @@ -1602,16 +1626,16 @@ service ... { <p><dt><strong>Default:</strong><dd> There is no default. </dl> <p> -<a name="l48"></a> +<a name="l49"></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="l49"></a> +<a name="l50"></a> <h3>5.1: Configuration examples</h3> <a name="tips/examples"></a> -<a name="l50"></a> +<a name="l51"></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 @@ -1740,7 +1764,7 @@ service www { </pre> <p> -<a name="l51"></a> +<a name="l52"></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 @@ -1829,7 +1853,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="l52"></a> +<a name="l53"></a> <strong>5.1.3: SSH login with enforced idle logout</strong> <p> The following example shows how crossroads 'throttles' SSH @@ -1855,7 +1879,7 @@ service Ssh { </pre> <p> -<a name="l53"></a> +<a name="l54"></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 @@ -1863,7 +1887,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="l54"></a> +<a name="l55"></a> <strong>5.2.1: Bysize, byduration or byconnections?</strong> <p> As stated before, crossroads doesn't know 'what a service does' and @@ -1913,7 +1937,7 @@ E.g., consider a database connection. What's <p> </ul> <p> -<a name="l55"></a> +<a name="l56"></a> <strong>5.2.2: Averaging size and duration</strong> <p> The configuration statement <code>dispatchmode bysize</code> or <code>byduration</code> @@ -1934,7 +1958,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="l56"></a> +<a name="l57"></a> <strong>5.2.3: Specifying decays</strong> <p> Decays are also only relevant when crossroads computes the 'next best @@ -1988,7 +2012,7 @@ service soap { </pre> <p> -<a name="l57"></a> +<a name="l58"></a> <strong>5.2.4: Adjusting the weights</strong> <p> The back end modifier <code>weight</code> is useful in situations where your @@ -2042,7 +2066,7 @@ 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="l58"></a> +<a name="l59"></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> @@ -2066,7 +2090,7 @@ than its smaller siblings. <code>checkinterval</code>. During each check, back ends can be marked as available or as unavailable.</ul> <p> -<a name="l59"></a> +<a name="l60"></a> <strong>5.3.1: Syntax</strong> <p> The syntax of both verifications is: @@ -2118,7 +2142,7 @@ The <em>arguments</em> are expanded according to the following table: <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> +<a name="l61"></a> <strong>5.3.2: Security Considerations</strong> <p> When <code>externalhandler</code> is in effect, Crossroads spawns an external @@ -2127,7 +2151,7 @@ a restricted user account. <p> The directive <code>useraccount</code> can be used to accomplish this. <p> -<a name="l61"></a> +<a name="l62"></a> <strong>5.3.3: An example</strong> <p> The following configuration balances SMTP requests to two back @@ -2164,7 +2188,7 @@ service smtp { </pre> <p> -<a name="l62"></a> +<a name="l63"></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&nbsp;(which you should always assume), then it might be a @@ -2193,7 +2217,7 @@ 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="l63"></a> +<a name="l64"></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 @@ -2218,7 +2242,7 @@ 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="l64"></a> +<a name="l65"></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 @@ -2226,7 +2250,7 @@ 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="l65"></a> +<a name="l66"></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 @@ -2258,7 +2282,7 @@ 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="l66"></a> +<a name="l67"></a> <strong>5.6.2: But if you must..</strong> <p> If you really need stickiness, think first whether you might use TCP @@ -2340,7 +2364,7 @@ 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="l67"></a> +<a name="l68"></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, @@ -2370,7 +2394,7 @@ 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="l68"></a> +<a name="l69"></a> <strong>5.7.1: Sample Crossroads configuration</strong> <p> The below sample configuration shows two HTTP back ends that receive @@ -2397,7 +2421,7 @@ service www { </pre> <p> -<a name="l69"></a> +<a name="l70"></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> @@ -2429,7 +2453,7 @@ LogFormat "%{X-Real-IP}i %l %u %t %D \"%r\" %&gt;s %b" common </pre> <p> -<a name="l70"></a> +<a name="l71"></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 @@ -2541,7 +2565,7 @@ 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="l71"></a> +<a name="l72"></a> <h3>5.9: Debugging network traffic</h3> <a name="tips/debugging"></a> Incase the traffic between client and backend @@ -2664,9 +2688,9 @@ 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="l72"></a> +<a name="l73"></a> <h3>5.10: IP filtering: Limiting Access by Client IP Address</h3> -<a name="tips/ipfiltering"></a><a name="l73"></a> +<a name="tips/ipfiltering"></a><a name="l74"></a> <strong>5.10.1: General Examples</strong> <p> The directives <code>allowfrom</code>, <code>denyfrom</code>, <code>allowfile</code> and @@ -2703,7 +2727,7 @@ 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="l74"></a> +<a name="l75"></a> <strong>5.10.2: Using External Files</strong> <p> The directives <code>allowfile</code> and <code>denyfile</code> allow you to specify IP @@ -2735,7 +2759,7 @@ 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="l75"></a> +<a name="l76"></a> <strong>5.10.3: Mixing Directives</strong> <p> Crossroads allows to mix all directives in one service @@ -2802,14 +2826,14 @@ 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="l76"></a> +<a name="l77"></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="l77"></a> +<a name="l78"></a> <strong>5.11.1: Configuring the external handler</strong> <p> First, the <code>dispatchmode</code> statement needs to inform Crossroads that @@ -2855,7 +2879,7 @@ 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="l78"></a> +<a name="l79"></a> <strong>5.11.2: Writing the external handler</strong> <p> The external handler is activated using the arguments that are @@ -2864,7 +2888,7 @@ 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="l79"></a> +<a name="l80"></a> <strong>5.11.3: Examples of external handlers</strong> <p> This section shows some examples of Crossroads configurations @@ -3291,7 +3315,7 @@ if ($action eq 'dispatch') { </pre> <p> -<a name="l80"></a> +<a name="l81"></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 @@ -3328,7 +3352,7 @@ 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="l81"></a> +<a name="l82"></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 @@ -3373,7 +3397,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="l82"></a> +<a name="l83"></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 @@ -3424,7 +3448,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="l83"></a> +<a name="l84"></a> <strong>5.14.1: Starting crossroads-mgr</strong> <p> The basic command to start <code>crossroads-mgr</code> is @@ -3487,7 +3511,7 @@ echo -e 'viewer:showme\nmodifier:changeit' | </pre> <p> -<a name="l84"></a> +<a name="l85"></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 @@ -3557,7 +3581,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="l85"></a> +<a name="l86"></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 @@ -3581,13 +3605,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="l86"></a> +<a name="l87"></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="l87"></a> +<a name="l88"></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: @@ -3615,7 +3639,7 @@ service HttpProxy { </pre> <p> -<a name="l88"></a> +<a name="l89"></a> <strong>6.1.1: Results</strong> <p> The results of this test are that crossroads causes a negligible @@ -3638,7 +3662,7 @@ sys 0m0.230s </pre> <p> -<a name="l89"></a> +<a name="l90"></a> <strong>6.1.2: Discussion</strong> <p> The above shown results are quite favorable to crossroads. However, @@ -3670,7 +3694,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="l90"></a> +<a name="l91"></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 @@ -3684,7 +3708,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="l91"></a> +<a name="l92"></a> <strong>6.2.1: Environment</strong> <p> On the balancer, LVS was run on port 80, its forwarding set up for two @@ -3715,7 +3739,7 @@ service http { </pre> <p> -<a name="l92"></a> +<a name="l93"></a> <strong>6.2.2: Tests and results</strong> <p> In the first test, ports 80 and 81 on the balancer were 'bombed' with @@ -3794,9 +3818,9 @@ 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="l93"></a> +<a name="l94"></a> <h2>7: Compiling and Installing</h2> <a name="installation"></a> -<a name="compiling"></a><a name="l94"></a> +<a name="compiling"></a><a name="l95"></a> <h3>7.1: Prerequisites</h3> <p> The creation of crossroads requires: @@ -3815,7 +3839,7 @@ 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="l95"></a> +<a name="l96"></a> <h3>7.2: Compiling and installing</h3> <p> <ul> @@ -3879,7 +3903,7 @@ crossroads, follow these steps. <p> </ul> <p> -<a name="l96"></a> +<a name="l97"></a> <h3>7.3: Configuring crossroads</h3> <p> Now that the binary is available on your system, you need to create a @@ -3927,13 +3951,13 @@ 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="l97"></a> +<a name="l98"></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="l98"></a> +<a name="l99"></a> <strong>7.4.1: SysV Style Startup</strong> <p> On SysV style systems, there's a startup script directory @@ -3987,7 +4011,7 @@ 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="l99"></a> +<a name="l100"></a> <strong>7.4.2: BSD Style Startup</strong> <p> On BSD style systems, daemons are booted directly from <code>/etc/rc</code> and diff --git a/doc/crossroads.pdf b/doc/crossroads.pdf Binary files differ. diff --git a/doc/main/conf/state.yo b/doc/main/conf/state.yo @@ -0,0 +1,13 @@ +conf(state - Setting an initial back end state) + (Using the tt(state) directive a back end can be 'primed' with an + initial state. The keyword tt(state) can be followed by + tt(available), tt(unavailable) or tt(down). Back ends marked + tt(unavailable) are excluded as candidates, but are checked when + a tt(revivinginterval) or a tt(checkinterval) is used. Back ends + marked tt(down) are excluded and never re-checked.) + (itemization( + it() tt(state) em(specifier) tt(;) + it() where em(specifier) is one of tt(available), + tt(unavailable) or tt(down))) + (tt(available), meaning that a back end is a candidate for + initial dispatching.) diff --git a/doc/main/config.yo b/doc/main/config.yo @@ -191,6 +191,7 @@ includefile(conf/verbose-backend.yo) includefile(conf/retries.yo) includefile(conf/weight) includefile(conf/decay) +includefile(conf/state) includefile(conf/onhooks) includefile(conf/trafficlog) includefile(conf/stickycookie) diff --git a/doc/main/using.yo b/doc/main/using.yo @@ -28,12 +28,16 @@ itemization( it() tt(crossroad status) reports on each running service. Per service, the state of each back end is reported. - it() tt(crossroads tell) em(service backend state) is a + it() tt(crossroads tell) em(service backend) tt(state) + em(newstate) is a command line way of telling crossroads that a given back end, of a given service, is in a given state. Normally crossroads maintains state information itself, but by using tt(crossroads tell), a back end can be e.g. taken 'off line' for servicing. + it() tt(crossroads tel) em(service backend) tt(server) + em(hostname:port) redefines the back end address of a + running back end. it() tt(crossroads configtest) tells you whether the configuration is syntactially correct. it() tt(crossroads services) reports on the configured @@ -41,10 +45,6 @@ itemization( option only shows what's configured -- not what's up and running. Therefore, tt(crossroads services) doesn't report on back end states. - it() tt(crossroads sampleconf) shows a sample configuration on - screen. A good way of quicky viewing the configuration - file syntax, or of getting a start for your own - configuration DEFAULTCONF(). ) subsubsect(Status Reporting from the Command Line) @@ -71,15 +71,21 @@ itemization( it() The first string on the line is the service name. it() After this, a series follows of em(backendname=state), where the back end name is the configured name of the back - end, and where state is e.g. tt(available), tt(DOWN), - tt(UNAVAILABLE), tt(WAKING). All statuses that cause - Crossroads not to use the back end are in caps. The series is - repeated for all back ends of the given service.) + end, and where state is e.g. tt(available), tt(down), + tt(unavailable), tt(waking). The statuses may occur in caps. + The series is repeated for all back ends of the given service.) The flag tt(-x) causes the overview to be presented as an XML 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 ref(xmlstatus) for more information.) + +The status reporter shows the number of running connections per back +end, and the total of connections of the entire service. Due to +technical reasons the total count can be one off. (There is a +technical reason for this: the total counter gets updated at a +different rate than separate back end counts. This may be fixed in a +future release.) subsubsect(Logging-related options) diff --git a/doc/man/crossroads.yo b/doc/man/crossroads.yo @@ -12,7 +12,10 @@ manpagesynopsis() it() bf(crossroads) em([flags]) bf(services): shows configured services it() bf(crossroads) em([flags]) bf(tell) em(service) - em(backend) em(state): sets a back end state) + em(backend) bf(state) em(newstate): sets a back end state + it() bf(crossroads) em([flags]) bf(tell) em(service) + em(backend) bf(server) em(hostname:port): redefines the + address of a back end) manpagedescription() diff --git a/etc/Makefile.conf b/etc/Makefile.conf @@ -17,7 +17,7 @@ DEFS := -DDEFAULT_CONF='"$(DEFAULT_CONF)"' -DMAX_BACKEND=$(MAX_BACKEND) \ -DPREFIX='"$(PREFIX)"' -DYEARS='"$(YEARS)"' \ -DEXTRALIBS='"$(EXTRALIBS)"' -DLIBS='"$(LIBS)"' \ -DAUTHORNAME='"$(AUTHORNAME)"' -DMAINTAINERNAME='"$(MAINTAINERNAME)"' \ - -DMAINTAINEREMAIL='"$(MAINTAINEREMAIL)"' \ + -DMAINTAINEREMAIL='"$(MAINTAINEREMAIL)"' -DFQDN_LENGTH=$(FQDN_LENGTH) \ -DDEFAULT_SPT_BUFSIZE=$(DEFAULT_SPT_BUFSIZE) \ $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ ifheader01 malloc.h HAVE_MALLOC_H) \ 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.49 +VER = 1.50 # Years that Crossroads has been 'round. YEARS = 2005-2007 @@ -26,6 +26,9 @@ DEFAULT_CONF = /etc/crossroads.conf # because it defines the size of the shared memory that crossroads claims. MAX_BACKEND = 20 +# The length of a fully qualified domain name. See RFC2181. +FQDN_LENGTH = 256 + # Sleep time (sec). When we detect that there are too many clients, or # no back ends, then we'll wait during this period. SLEEP_TIME = 10 diff --git a/etc/svnrev.txt b/etc/svnrev.txt @@ -1 +1 @@ -181 +184 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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 @@ -180,6 +180,8 @@ ENDUSAGE for my $a (@_) { $ret .= " $a"; } + $ret .= " 2>&1"; + $self->msg ("External call: [$ret]"); return ($ret); } @@ -367,18 +369,40 @@ ENDUSAGE sub act_set { my ($self, $uri) = @_; - # The uri is /set/{service}/{backend}/{numericalstate} + # The uri is /set/{service}/{backend}/state/{numericalstate} or + # /set/{service}/{backend}/server/{hostname}/{port} # Get the variables, and run crossroads tell. $self->checkauth ($prog->authset(), "Status Modification") or return; - my (undef, undef, $service, $backend, $nr) = split (/\//, $uri); - $prog->msg ("Setting service $service, ", - "backend $backend to state $nr"); - system ($prog->call ("tell $service $backend $nr")) - and die ("Failed to tell service $service, backend $backend, ", - "new state $nr\n"); - - # Status is updated. Redirect to the overview page. + my (undef, undef, $service, $backend, $action) = split (/\//, $uri); + my ($nr, $hostname, $port, $if); + if ($action eq 'state') { + (undef, undef, undef, undef, undef, $nr) = split (/\//, $uri); + $prog->msg ("Setting service $service, backend $backend ", + "to state $nr"); + open ($if, $prog->call ("tell $service $backend state $nr") . '|') + or die ("Cannot start crossroads\n"); + } elsif ($action eq 'server') { + (undef, undef, undef, undef, undef, $hostname, $port) = + split (/\//, $uri); + $prog->msg ("Setting service $service, backend $backend ", + "to address $hostname:$port"); + open ($if, $prog->call ("tell $service $backend " . + "server $hostname:$port") . '|') + or die ("Cannot start crossroads\n"); + } else { + die ("Action '$action' not supported in 'set'\n"); + } + + my $resp = ''; + while (<$if>) { + $resp .= $_; + } + close ($if); + die ("Failed to modify runtime environment: $resp\n") + if ($resp ne ''); + + # Runtime environment is updated. Redirect to the overview page. $prog->msg ("Redirecting to status overview page"); my $r = HTTP::Response->new (302, 'Moved Temporarily'); $r->header ('Location' => '/'); diff --git a/src/crossroads-mgr/crossroads-mgr.xslt b/src/crossroads-mgr/crossroads-mgr.xslt @@ -8,8 +8,16 @@ <head> <title>Crossroads Status Overview</title> <script type="text/javascript"> - function set (target, index) { - document.location = '/set/' + target + '/' + index; + function setstate (target, index) { + document.location = '/set/' + target + '/state/' + index; + } + function setaddress (target) { + var hostname = document.getElementById (target + '/hostname').value; + var port = document.getElementById (target + '/port').value; + // alert ('Setting address for ' + target + ' to ' + + // hostname + ':' + port); + document.location = '/set/' + target + '/server/' + + hostname + '/' + port; } </script> <style type="text/css"> @@ -70,12 +78,11 @@ <xsl:template match="/status/service/backend"> <tr> - <td> </td> - <td class="backend"> Back end </td> - <td class="backend"> <b> <xsl:value-of select="@name"/> </b> </td> + <td width="15%"> </td> + <td class="backend" width="15%"> Back end </td> + <td class="backend" width="15%"> <b> <xsl:value-of select="@name"/> </b> </td> <td class="backend"> - is - <select onchange="set('{../@name}/{@name}', this.selectedIndex);"> + <select onchange="setstate('{../@name}/{@name}', this.selectedIndex);"> <xsl:choose> <xsl:when test="availability/@id = 0"> <option value="available" selected="1">available</option> @@ -126,7 +133,20 @@ </xsl:choose> </select> </td> - <td> </td> + </tr> + <tr> + <td class="info"/> + <td class="info"/> + <td class="info"> Address: </td> + <td class="info"> + <input name="{../@name}/{@name}/hostname" type="text" + id="{../@name}/{@name}/hostname" value="{server}" maxlength="255"/> + : + <input name="{../@name}/{@name}/port" type="text" value="{port}" + id="{../@name}/{@name}/port" size="7"/> + <input type="button" class="info" value="Set" + onclick="setaddress('{../@name}/{@name}');"/> + </td> </tr> <tr> <td class="info"/> diff --git a/src/crossroads.h b/src/crossroads.h @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -111,6 +111,7 @@ typedef enum { /* Config parsing related */ cf_denyfilespec, cf_useraccountspec, cf_retriesspec, + cf_statespec, } Conftype; typedef union { /* Integer of string value */ @@ -144,10 +145,19 @@ typedef enum { /* Service types */ type_http } Servicetype; +typedef enum { /* Backend availability */ + st_available, /* .. all OK */ + st_unavailable, /* .. temporarily unavailable */ + st_down, /* .. permanently unavailable */ + st_waking, /* .. scheduled for wake up */ + st_intermediate, /* .. bogus, for mark_activity() */ + st_unknown /* .. no idea (terminator) */ +} Backendavail; + typedef struct { /* Backend description */ char *name; /* .. back end identifier */ - int port; /* .. TCP port */ - char *server; /* .. server name */ + int initial_port; /* .. TCP port */ + char *initial_server; /* .. server name */ int verbosity; /* .. debugging on/off */ int weight; /* .. weight in backend selection */ int decay; /* .. decay in % */ @@ -171,6 +181,7 @@ typedef struct { /* Backend description */ int nsetserverheader; /* .. table size */ char **appendserverheader; /* .. server hdrs to APPEND */ int nappendserverheader; /* .. table size */ + Backendavail initial_avail; /* .. initial back end state */ } Backend; typedef struct { /* Filtering information: */ @@ -218,17 +229,8 @@ typedef struct { /* Service description */ Backend *backend; /* .. the back ends */ } Service; -typedef enum { /* Backend availability */ - st_available, /* .. all OK */ - st_unavailable, /* .. temporarily unavailable */ - st_down, /* .. permanently unavailable */\ - st_waking, /* .. scheduled for wake up */ - st_intermediate, /* .. bogus, for mark_activity() */ - st_unknown /* .. no idea (terminator) */ -} Backendavail; - typedef struct { /* Backend state */ - Backendavail avail; /* .. availability */ + Backendavail actual_avail; /* .. availability */ unsigned long totuses; /* .. times hit */ unsigned long failures; /* .. times failed */ double nbytes; /* .. transferred bytes */ @@ -239,6 +241,8 @@ typedef struct { /* Backend state */ unsigned nclients; /* .. active clients */ unsigned fail; /* .. failures so far */ unsigned laststamp; /* .. last usage */ + int actual_port; /* .. currently used port */ + char actual_server[FQDN_LENGTH]; /* .. currently used server */ } Backendstate; typedef struct { /* Service reporting (shmem) */ diff --git a/src/crossroads/main.c b/src/crossroads/main.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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,7 +24,7 @@ int main (int argc, char **argv) { { "stop", 0, 1, stop_daemon }, { "start", 0, 1, serve }, { "restart", 0, 1, restart }, - { "tell", 3, 1, tell_service }, + { "tell", 4, 1, tell_service }, { "configtest", 0, 1, configtest }, }; diff --git a/src/lib/Makefile b/src/lib/Makefile @@ -51,3 +51,4 @@ clean: strexpandformat.o: strexpandformat.c $(BASE)/etc/Makefile.def showconfig.o: showconfig.c $(BASE)/etc/Makefile.def Makefile data.o: data.c $(BASE)/src/crossroads.h +usage.o: usage.c usage.h diff --git a/src/lib/allocreporter.c b/src/lib/allocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -12,7 +12,7 @@ int backend_available (int target) { * (b) Either, there is no max to the active connections, or * the # of connections is below the max. */ - if (servicereport->backendstate[target].avail == st_available && + if (servicereport->backendstate[target].actual_avail == st_available && (activeservice->backend[target].maxconnections == 0 || activeservice->backend[target].maxconnections > servicereport->backendstate[target].nclients)) { diff --git a/src/lib/backendconnect.c b/src/lib/backendconnect.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -43,13 +43,14 @@ int backend_connect () { #endif /* Assign to back end server address. */ - if (init_sockaddr (&servername, - activeservice->backend[current_backend].server, - activeservice->backend[current_backend].port)) { + if (init_sockaddr ( + &servername, + servicereport->backendstate[current_backend].actual_server, + servicereport->backendstate[current_backend].actual_port)) { /* The hostname is unusable.. */ warning ("Service %s: unknown host %s", activeservice->name, - activeservice->backend[current_backend].server); + servicereport->backendstate[current_backend].actual_server); close (sock); mark_activity (0, 0, st_unavailable); return (-3); @@ -57,8 +58,8 @@ int backend_connect () { if (program_stage != stage_retrying) msg ("Service %s: Network socket to %s:%d created", activeservice->name, - activeservice->backend[current_backend].server, - activeservice->backend[current_backend].port); + servicereport->backendstate[current_backend].actual_server, + servicereport->backendstate[current_backend].actual_port); /* If retrying, delay a bit, unless we're in the wakeup handler. */ if (program_stage != stage_retrying && @@ -87,17 +88,18 @@ int backend_connect () { if (program_stage != stage_retrying) { if (timed_out) - warning ("Service %s: server %s:%d not usable" - " due to timeout", - activeservice->name, - activeservice->backend[current_backend].server, - activeservice->backend[current_backend].port); + warning ( + "Service %s: server %s:%d not usable due to timeout", + activeservice->name, + servicereport->backendstate[current_backend].actual_server, + servicereport->backendstate[current_backend].actual_port); else - warning ("Service %s: server %s:%d: cannot connect: %s", - activeservice->name, - activeservice->backend[current_backend].server, - activeservice->backend[current_backend].port, - strerror(errno)); + warning ( + "Service %s: server %s:%d: cannot connect: %s", + activeservice->name, + servicereport->backendstate[current_backend].actual_server, + servicereport->backendstate[current_backend].actual_port, + strerror(errno)); } mark_activity (0, 0, st_unavailable); return (-3); @@ -110,4 +112,3 @@ int backend_connect () { 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -35,7 +35,7 @@ void choose_backend () { h = hashpjw (client_ip) % activeservice->nbackend; msg ("Service %s: Client IP %s hashed to back end index %d", activeservice->name, client_ip, h); - if (servicereport->backendstate[h].avail == st_available && + if (servicereport->backendstate[h].actual_avail == st_available && (activeservice->backend[h].maxconnections == 0 || activeservice->backend[h].maxconnections > servicereport->backendstate[h].nclients)) { @@ -55,7 +55,7 @@ void choose_backend () { * (b) there's no max of connections, or the actual nr of connections * is below max */ - if (servicereport->backendstate[i].avail == st_available && + if (servicereport->backendstate[i].actual_avail == st_available && (activeservice->backend[i].maxconnections == 0 || activeservice->backend[i].maxconnections > servicereport->backendstate[i].nclients)) { @@ -65,7 +65,7 @@ void choose_backend () { activeservice->name, i, activeservice->backend[i].maxconnections, servicereport->backendstate[i].nclients, - state_to_string(servicereport->backendstate[i].avail)); + state_to_string(servicereport->backendstate[i].actual_avail)); backends[nbackends++] = i; } } diff --git a/src/lib/configread.c b/src/lib/configread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -101,8 +101,8 @@ void config_read (int fd) { for (j = 0; j < service[i].nbackend; j++) { service[i].backend[j].name = rd_str (fd); msg (" Backend %d: %s", j + i, service[i].backend[j].name); - service[i].backend[j].port = rd_int (fd); - service[i].backend[j].server = rd_str (fd); + service[i].backend[j].initial_port = rd_int (fd); + service[i].backend[j].initial_server = rd_str (fd); service[i].backend[j].verbosity = rd_int (fd); service[i].backend[j].weight = rd_int (fd); service[i].backend[j].decay = rd_int (fd); @@ -113,6 +113,7 @@ void config_read (int fd) { service[i].backend[j].maxconnections = rd_uns (fd); service[i].backend[j].stickycookie = rd_str (fd); service[i].backend[j].retries = rd_int (fd); + service[i].backend[j].initial_avail = rd_int (fd); service[i].backend[j].naddclientheader = rd_int (fd); service[i].backend[j].addclientheader = diff --git a/src/lib/configtest.c b/src/lib/configtest.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -77,8 +77,8 @@ void config_write (int fd) { wr_int (fd, service[i].nbackend); for (j = 0; j < service[i].nbackend; j++) { wr_str (fd, service[i].backend[j].name); - wr_int (fd, service[i].backend[j].port); - wr_str (fd, service[i].backend[j].server); + wr_int (fd, service[i].backend[j].initial_port); + wr_str (fd, service[i].backend[j].initial_server); wr_int (fd, service[i].backend[j].verbosity); wr_int (fd, service[i].backend[j].weight); wr_int (fd, service[i].backend[j].decay); @@ -89,6 +89,7 @@ void config_write (int fd) { wr_uns (fd, service[i].backend[j].maxconnections); wr_str (fd, service[i].backend[j].stickycookie); wr_int (fd, service[i].backend[j].retries); + wr_int (fd, service[i].backend[j].initial_avail); wr_int (fd, service[i].backend[j].naddclientheader); for (k = 0; k < service[i].backend[j].naddclientheader; k++) diff --git a/src/lib/copysockets.c b/src/lib/copysockets.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -13,7 +13,7 @@ int http_serversocket (HttpHeader *m, int *is_continuation) { /* Try to find a sticky cookie in the request. */ for (i = 0; i < activeservice->nbackend; i++) { - if (servicereport->backendstate[i].avail == st_unavailable) + if (servicereport->backendstate[i].actual_avail == st_unavailable) continue; if (activeservice->backend[i].maxconnections > 0 && activeservice->backend[i].maxconnections <= diff --git a/src/lib/httpwrite.c b/src/lib/httpwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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,63 +288,67 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 82 -#define YY_END_OF_BUFFER 83 -static yyconst short int yy_accept[489] = +#define YY_NUM_RULES 86 +#define YY_END_OF_BUFFER 87 +static yyconst short int yy_accept[513] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 + 83, 83, 84, 84, 87, 64, 62, 63, 64, 61, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 64, + 73, 74, 72, 73, 73, 71, 68, 67, 68, 78, + 76, 77, 75, 82, 81, 79, 80, 79, 86, 83, + 84, 85, 62, 65, 0, 61, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 59, 60, 58, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + + 60, 11, 60, 60, 60, 60, 0, 0, 0, 0, + 69, 0, 70, 66, 75, 79, 80, 79, 83, 84, + 0, 3, 60, 60, 38, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 58, + 0, 0, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 36, 60, 60, + 13, 60, 60, 60, 60, 40, 60, 60, 60, 60, + + 7, 6, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 34, 60, 60, 60, 60, + 0, 0, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 20, 60, 60, + 60, 60, 60, 60, 46, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 10, 60, 60, + 60, 60, 60, 60, 60, 0, 0, 60, 60, 60, + 60, 60, 60, 60, 5, 60, 60, 60, 60, 26, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 45, + 60, 24, 60, 60, 60, 21, 60, 60, 60, 60, + + 8, 60, 60, 60, 60, 60, 60, 19, 0, 0, + 60, 60, 60, 60, 60, 60, 60, 9, 14, 60, + 60, 60, 27, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 44, 15, 60, 60, 4, 60, 60, 37, + 60, 60, 60, 60, 60, 60, 16, 60, 2, 0, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 57, 55, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 1, 60, 60, 56, 54, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 30, 60, 25, 60, 60, 60, 60, 60, 60, + 60, 60, 23, 60, 60, 60, 39, 60, 42, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 43, + 60, 60, 60, 60, 60, 60, 60, 60, 12, 31, + 60, 60, 60, 60, 60, 60, 60, 22, 60, 60, + 60, 60, 60, 60, 47, 60, 60, 60, 60, 60, + 28, 33, 60, 60, 60, 60, 60, 60, 60, 41, + 60, 60, 60, 60, 60, 60, 60, 18, 60, 60, + 60, 48, 51, 60, 60, 60, 29, 60, 60, 49, + + 52, 60, 60, 60, 35, 32, 60, 60, 17, 50, + 53, 0 } ; static yyconst int yy_ec[256] = @@ -387,270 +391,280 @@ static yyconst int yy_meta[38] = 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst short int yy_base[502] = +static yyconst short int yy_base[526] = { 0, - 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 + 0, 608, 35, 41, 46, 47, 55, 67, 79, 109, + 62, 74, 610, 609, 611, 615, 39, 615, 84, 599, + 0, 105, 110, 72, 108, 574, 594, 77, 593, 579, + 108, 578, 129, 124, 115, 70, 586, 585, 584, 146, + 615, 615, 615, 596, 593, 615, 615, 615, 589, 615, + 615, 615, 0, 615, 615, 93, 0, 98, 615, 99, + 0, 615, 102, 615, 595, 586, 0, 579, 571, 558, + 565, 578, 575, 564, 137, 571, 562, 143, 557, 552, + 560, 553, 559, 568, 550, 545, 0, 560, 147, 560, + 548, 550, 74, 543, 129, 148, 38, 545, 138, 545, + + 558, 0, 553, 541, 547, 538, 170, 549, 540, 560, + 615, 557, 615, 615, 0, 145, 0, 153, 174, 0, + 560, 615, 155, 535, 0, 543, 538, 536, 541, 155, + 525, 527, 533, 538, 527, 538, 523, 514, 521, 522, + 519, 528, 515, 527, 515, 526, 515, 526, 508, 509, + 506, 519, 506, 512, 507, 499, 164, 507, 507, 498, + 512, 500, 507, 507, 506, 490, 493, 506, 500, 0, + 500, 502, 493, 498, 481, 488, 489, 166, 481, 489, + 484, 480, 491, 470, 483, 487, 468, 0, 484, 488, + 0, 470, 471, 481, 480, 0, 470, 479, 473, 480, + + 0, 0, 466, 470, 458, 473, 171, 465, 470, 463, + 468, 467, 461, 451, 463, 0, 467, 466, 452, 457, + 455, 452, 453, 445, 454, 455, 457, 444, 442, 441, + 449, 440, 451, 446, 445, 440, 445, 0, 159, 429, + 430, 432, 428, 430, 0, 431, 425, 428, 434, 429, + 421, 420, 432, 425, 417, 418, 408, 0, 407, 422, + 419, 418, 423, 408, 406, 410, 403, 416, 400, 169, + 170, 417, 414, 410, 0, 403, 410, 396, 397, 0, + 399, 393, 399, 395, 405, 406, 405, 396, 391, 0, + 385, 0, 385, 388, 386, 0, 394, 393, 377, 375, + + 0, 180, 387, 391, 382, 389, 177, 0, 386, 386, + 376, 383, 376, 372, 374, 379, 372, 0, 0, 364, + 378, 371, 0, 361, 369, 372, 364, 367, 368, 362, + 359, 366, 0, 0, 363, 367, 0, 355, 362, 0, + 352, 347, 349, 352, 361, 347, 0, 342, 615, 354, + 340, 341, 351, 343, 345, 337, 347, 342, 332, 335, + 343, 333, 0, 0, 334, 339, 336, 326, 339, 332, + 331, 321, 322, 323, 318, 316, 320, 331, 313, 308, + 615, 322, 321, 0, 0, 323, 307, 311, 316, 311, + 307, 309, 307, 311, 318, 303, 299, 303, 302, 306, + + 305, 302, 296, 292, 302, 297, 294, 301, 300, 291, + 298, 0, 288, 0, 281, 282, 295, 295, 284, 291, + 286, 276, 0, 288, 287, 282, 0, 279, 0, 284, + 270, 286, 285, 267, 268, 270, 281, 272, 275, 0, + 275, 275, 263, 271, 274, 273, 268, 258, 0, 0, + 267, 266, 261, 260, 250, 255, 253, 0, 253, 245, + 249, 245, 256, 255, 0, 251, 252, 251, 250, 249, + 0, 0, 248, 247, 242, 233, 229, 243, 242, 0, + 230, 229, 243, 242, 228, 225, 226, 0, 238, 222, + 221, 0, 0, 232, 231, 215, 0, 220, 221, 0, + + 0, 226, 219, 166, 0, 0, 108, 96, 0, 0, + 0, 615, 201, 205, 209, 213, 217, 221, 68, 225, + 229, 231, 47, 235, 239 } ; -static yyconst short int yy_def[502] = +static yyconst short int yy_def[526] = { 0, - 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 + 512, 1, 513, 513, 514, 514, 515, 515, 516, 516, + 517, 517, 518, 518, 512, 512, 512, 512, 512, 512, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 512, + 512, 512, 512, 520, 521, 512, 512, 512, 512, 512, + 512, 512, 522, 512, 512, 512, 523, 523, 512, 512, + 524, 512, 512, 512, 525, 512, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + + 519, 519, 519, 519, 519, 519, 512, 512, 512, 520, + 512, 521, 512, 512, 522, 512, 523, 523, 512, 524, + 525, 512, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 512, 512, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 512, 512, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 512, 512, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + + 519, 519, 519, 519, 519, 519, 519, 519, 512, 512, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 512, 512, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 512, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 0, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512 } ; -static yyconst short int yy_nxt[628] = +static yyconst short int yy_nxt[653] = { 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, - 113, 67, 46, 49, 49, 50, 51, 52, 51, 487, + 117, 160, 46, 49, 49, 50, 51, 52, 51, 161, 50, 50, 50, 60, 55, 60, 50, 50, 51, 52, - 51, 112, 50, 50, 50, 60, 55, 60, 50, 54, + 51, 67, 50, 50, 50, 60, 55, 60, 50, 54, 54, 55, 56, 54, 54, 54, 54, 54, 54, 54, - 54, 64, 68, 65, 75, 486, 115, 112, 115, 69, + 54, 64, 76, 65, 84, 101, 116, 102, 77, 103, - 76, 70, 112, 71, 63, 147, 63, 148, 58, 54, + 119, 116, 119, 63, 153, 63, 154, 85, 58, 54, 54, 55, 56, 54, 54, 54, 54, 54, 54, 54, - 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, + 54, 68, 116, 73, 511, 78, 88, 118, 69, 79, + 70, 74, 71, 89, 80, 98, 510, 72, 58, 81, + 90, 95, 92, 99, 96, 75, 93, 107, 116, 107, + 100, 163, 130, 131, 97, 94, 116, 156, 136, 157, + 137, 158, 108, 132, 147, 148, 133, 109, 138, 164, + 173, 107, 159, 107, 116, 119, 149, 119, 180, 208, + 283, 181, 118, 228, 174, 315, 108, 284, 252, 229, + 313, 109, 253, 209, 347, 341, 509, 314, 348, 316, + + 342, 41, 41, 41, 41, 47, 47, 47, 47, 53, + 53, 53, 53, 57, 57, 57, 57, 59, 59, 59, + 59, 61, 61, 61, 61, 110, 110, 110, 110, 112, + 112, 112, 112, 115, 115, 120, 508, 120, 120, 121, + 121, 121, 121, 507, 506, 505, 504, 503, 502, 501, + 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, + 490, 489, 488, 487, 486, 485, 484, 483, 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, 347, 407, 406, 405, 404, 403, 402, + 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, + 391, 390, 389, 388, 102, 387, 386, 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, 346, 345, 344, 343, 340, 339, + 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, + 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, + 318, 317, 312, 311, 310, 309, 308, 307, 306, 305, + 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, + 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 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 + 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, + 262, 261, 260, 259, 258, 257, 256, 255, 254, 251, + 250, 249, 248, 247, 246, 245, 244, 243, 87, 242, + + 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, + 231, 230, 227, 226, 225, 224, 223, 222, 221, 220, + 219, 218, 217, 216, 170, 215, 214, 213, 212, 211, + 210, 207, 206, 205, 204, 203, 202, 201, 200, 199, + 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, + 188, 187, 186, 185, 184, 183, 182, 179, 178, 177, + 176, 175, 122, 113, 111, 172, 171, 170, 169, 168, + 167, 166, 165, 162, 155, 152, 151, 150, 87, 146, + 145, 144, 143, 142, 141, 140, 139, 135, 134, 129, + 128, 127, 126, 125, 124, 123, 66, 122, 114, 113, + + 111, 106, 105, 104, 91, 87, 86, 83, 82, 66, + 512, 62, 62, 40, 15, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512 } ; -static yyconst short int yy_chk[628] = +static yyconst short int yy_chk[653] = { 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, - 499, 495, 4, 5, 6, 7, 7, 7, 7, 484, + 523, 97, 4, 5, 6, 7, 7, 7, 7, 97, 7, 7, 7, 11, 11, 11, 7, 8, 8, 8, - 8, 56, 8, 8, 8, 12, 12, 12, 8, 9, + 8, 519, 8, 8, 8, 12, 12, 12, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 19, 22, 19, 24, 483, 60, 56, 60, 22, + 9, 19, 24, 19, 28, 36, 56, 36, 24, 36, - 24, 22, 58, 22, 63, 91, 63, 91, 9, 10, + 60, 58, 60, 63, 93, 63, 93, 28, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 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 + 10, 22, 56, 23, 508, 25, 31, 58, 22, 25, + 22, 23, 22, 31, 25, 35, 507, 22, 10, 25, + 31, 34, 33, 35, 34, 23, 33, 40, 116, 40, + 35, 99, 75, 75, 34, 33, 118, 95, 78, 95, + 78, 96, 40, 75, 89, 89, 75, 40, 78, 99, + 123, 107, 96, 107, 116, 119, 89, 119, 130, 157, + 239, 130, 118, 178, 123, 271, 107, 239, 207, 178, + 270, 107, 207, 157, 307, 302, 504, 270, 307, 271, + + 302, 513, 513, 513, 513, 514, 514, 514, 514, 515, + 515, 515, 515, 516, 516, 516, 516, 517, 517, 517, + 517, 518, 518, 518, 518, 520, 520, 520, 520, 521, + 521, 521, 521, 522, 522, 524, 503, 524, 524, 525, + 525, 525, 525, 502, 499, 498, 496, 495, 494, 491, + 490, 489, 487, 486, 485, 484, 483, 482, 481, 479, + 478, 477, 476, 475, 474, 473, 470, 469, 468, 467, + 466, 464, 463, 462, 461, 460, 459, 457, 456, 455, + 454, 453, 452, 451, 448, 447, 446, 445, 444, 443, + 442, 441, 439, 438, 437, 436, 435, 434, 433, 432, + + 431, 430, 428, 426, 425, 424, 422, 421, 420, 419, + 418, 417, 416, 415, 413, 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, 383, 382, 380, 379, 378, 377, 376, 375, 374, + 373, 372, 371, 370, 369, 368, 367, 366, 365, 362, + 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, + 351, 350, 348, 346, 345, 344, 343, 342, 341, 339, + 338, 336, 335, 332, 331, 330, 329, 328, 327, 326, + 325, 324, 322, 321, 320, 317, 316, 315, 314, 313, + + 312, 311, 310, 309, 306, 305, 304, 303, 300, 299, + 298, 297, 295, 294, 293, 291, 289, 288, 287, 286, + 285, 284, 283, 282, 281, 279, 278, 277, 276, 274, + 273, 272, 269, 268, 267, 266, 265, 264, 263, 262, + 261, 260, 259, 257, 256, 255, 254, 253, 252, 251, + 250, 249, 248, 247, 246, 244, 243, 242, 241, 240, + 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, + 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, + 217, 215, 214, 213, 212, 211, 210, 209, 208, 206, + 205, 204, 203, 200, 199, 198, 197, 195, 194, 193, + + 192, 190, 189, 187, 186, 185, 184, 183, 182, 181, + 180, 179, 177, 176, 175, 174, 173, 172, 171, 169, + 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + 158, 156, 155, 154, 153, 152, 151, 150, 149, 148, + 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, + 137, 136, 135, 134, 133, 132, 131, 129, 128, 127, + 126, 124, 121, 112, 110, 109, 108, 106, 105, 104, + 103, 101, 100, 98, 94, 92, 91, 90, 88, 86, + 85, 84, 83, 82, 81, 80, 79, 77, 76, 74, + 73, 72, 71, 70, 69, 68, 66, 65, 49, 45, + + 44, 39, 38, 37, 32, 30, 29, 27, 26, 20, + 15, 14, 13, 2, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, + 512, 512 } ; static yy_state_type yy_last_accepting_state; @@ -694,7 +708,7 @@ char *yytext; #define defineredef 5 #define definesym 6 -#line 693 "lexer.c" +#line 707 "lexer.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -851,7 +865,7 @@ YY_DECL #line 27 "lexer.l" -#line 850 "lexer.c" +#line 864 "lexer.c" if ( yy_init ) { @@ -903,13 +917,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 >= 489 ) + if ( yy_current_state >= 513 ) 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] != 590 ); + while ( yy_base[yy_current_state] != 615 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1014,62 +1028,94 @@ case 10: YY_RULE_SETUP #line 78 "lexer.l" { - lmsg ("backlog"); - return (BACKLOG); + lmsg ("state"); + return (STATE); } YY_BREAK case 11: YY_RULE_SETUP #line 83 "lexer.l" { - lmsg ("retries"); - return (RETRIES); + lmsg ("available"); + return (AVAILABLE); } YY_BREAK case 12: YY_RULE_SETUP #line 88 "lexer.l" { - lmsg ("verbosity"); - return (VERBOSITY); + lmsg ("unavailable"); + return (UNAVAILABLE); } YY_BREAK case 13: YY_RULE_SETUP #line 93 "lexer.l" { - lmsg ("connectiontimeout"); - return (CONNECTIONTIMEOUT); + lmsg ("down"); + return (DOWN); } YY_BREAK case 14: YY_RULE_SETUP #line 98 "lexer.l" { - lmsg ("maxconnections"); - return (MAXCONNECTIONS); + lmsg ("backlog"); + return (BACKLOG); } YY_BREAK case 15: YY_RULE_SETUP #line 103 "lexer.l" { - lmsg ("weight"); - return (WEIGHT); + lmsg ("retries"); + return (RETRIES); } YY_BREAK case 16: YY_RULE_SETUP #line 108 "lexer.l" { - lmsg ("decay"); - return (DECAY); + lmsg ("verbosity"); + return (VERBOSITY); } YY_BREAK case 17: YY_RULE_SETUP #line 113 "lexer.l" { + lmsg ("connectiontimeout"); + return (CONNECTIONTIMEOUT); +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 118 "lexer.l" +{ + lmsg ("maxconnections"); + return (MAXCONNECTIONS); +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 123 "lexer.l" +{ + lmsg ("weight"); + return (WEIGHT); +} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 128 "lexer.l" +{ + lmsg ("decay"); + return (DECAY); +} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 133 "lexer.l" +{ lmsg ("server"); BEGIN (stringstate); free (laststring); @@ -1077,65 +1123,65 @@ YY_RULE_SETUP return (SERVER); } YY_BREAK -case 18: +case 22: YY_RULE_SETUP -#line 121 "lexer.l" +#line 141 "lexer.l" { lmsg ("dispatchmode"); return (DISPATCHMODE); } YY_BREAK -case 19: +case 23: YY_RULE_SETUP -#line 126 "lexer.l" +#line 146 "lexer.l" { lmsg ("roundrobin"); return (ROUNDROBIN); } YY_BREAK -case 20: +case 24: YY_RULE_SETUP -#line 131 "lexer.l" +#line 151 "lexer.l" { lmsg ("random"); return (RANDOM); } YY_BREAK -case 21: +case 25: YY_RULE_SETUP -#line 136 "lexer.l" +#line 156 "lexer.l" { lmsg ("byduration"); return (BYDURATION); } YY_BREAK -case 22: +case 26: YY_RULE_SETUP -#line 141 "lexer.l" +#line 161 "lexer.l" { lmsg ("bysize"); return (BYSIZE); } YY_BREAK -case 23: +case 27: YY_RULE_SETUP -#line 146 "lexer.l" +#line 166 "lexer.l" { lmsg ("byorder"); return (BYORDER); } YY_BREAK -case 24: +case 28: YY_RULE_SETUP -#line 151 "lexer.l" +#line 171 "lexer.l" { lmsg ("byconnections"); return (BYCONNECTIONS); } YY_BREAK -case 25: +case 29: YY_RULE_SETUP -#line 156 "lexer.l" +#line 176 "lexer.l" { lmsg ("externalhandler"); BEGIN (stringstate); @@ -1144,17 +1190,17 @@ YY_RULE_SETUP return (EXTERNALHANDLER); } YY_BREAK -case 26: +case 30: YY_RULE_SETUP -#line 164 "lexer.l" +#line 184 "lexer.l" { lmsg ("byclientip"); return (BYCLIENTIP); } YY_BREAK -case 27: +case 31: YY_RULE_SETUP -#line 169 "lexer.l" +#line 189 "lexer.l" { lmsg ("useraccount"); BEGIN (stringstate); @@ -1163,65 +1209,65 @@ YY_RULE_SETUP return (USERACCOUNT); } YY_BREAK -case 28: +case 32: YY_RULE_SETUP -#line 177 "lexer.l" +#line 197 "lexer.l" { lmsg ("revivinginterval"); return (REVIVINGINTERVAL); } YY_BREAK -case 29: +case 33: YY_RULE_SETUP -#line 182 "lexer.l" +#line 202 "lexer.l" { lmsg ("checkinterval"); return (CHECKINTERVAL); } YY_BREAK -case 30: +case 34: YY_RULE_SETUP -#line 187 "lexer.l" +#line 207 "lexer.l" { lmsg ("type"); return (TYPE); } YY_BREAK -case 31: +case 35: YY_RULE_SETUP -#line 192 "lexer.l" +#line 212 "lexer.l" { lmsg ("headerinspection"); return (HEADERINSPECTION); } YY_BREAK -case 32: +case 36: YY_RULE_SETUP -#line 197 "lexer.l" +#line 217 "lexer.l" { lmsg ("deep"); return (DEEP); } YY_BREAK -case 33: +case 37: YY_RULE_SETUP -#line 202 "lexer.l" +#line 222 "lexer.l" { lmsg ("shallow"); return (SHALLOW); } YY_BREAK -case 34: +case 38: YY_RULE_SETUP -#line 207 "lexer.l" +#line 227 "lexer.l" { lmsg ("any"); return (ANY); } YY_BREAK -case 35: +case 39: YY_RULE_SETUP -#line 212 "lexer.l" +#line 232 "lexer.l" { lmsg ("stickyhttp"); warning ("The 'stickyhttp protocol is obsolte.\n" @@ -1229,17 +1275,17 @@ YY_RULE_SETUP return (HTTP); } YY_BREAK -case 36: +case 40: YY_RULE_SETUP -#line 219 "lexer.l" +#line 239 "lexer.l" { lmsg ("http"); return (HTTP); } YY_BREAK -case 37: +case 41: YY_RULE_SETUP -#line 224 "lexer.l" +#line 244 "lexer.l" { lmsg ("throughputlog"); BEGIN (stringstate); @@ -1248,9 +1294,9 @@ YY_RULE_SETUP return (THROUGHPUTLOG); } YY_BREAK -case 38: +case 42: YY_RULE_SETUP -#line 232 "lexer.l" +#line 252 "lexer.l" { lmsg ("trafficlog"); BEGIN (stringstate); @@ -1259,9 +1305,9 @@ YY_RULE_SETUP return (TRAFFICLOG); } YY_BREAK -case 39: +case 43: YY_RULE_SETUP -#line 240 "lexer.l" +#line 260 "lexer.l" { lmsg ("dumptraffic"); warning ("The 'dumptraffic' statement is obsolete.\n" @@ -1272,9 +1318,9 @@ YY_RULE_SETUP return (TRAFFICLOG); } YY_BREAK -case 40: +case 44: YY_RULE_SETUP -#line 250 "lexer.l" +#line 270 "lexer.l" { lmsg ("onstart"); BEGIN (stringstate); @@ -1283,9 +1329,9 @@ YY_RULE_SETUP return (ONSTART); } YY_BREAK -case 41: +case 45: YY_RULE_SETUP -#line 258 "lexer.l" +#line 278 "lexer.l" { lmsg ("onfail"); BEGIN (stringstate); @@ -1294,9 +1340,9 @@ YY_RULE_SETUP return (ONFAIL); } YY_BREAK -case 42: +case 46: YY_RULE_SETUP -#line 266 "lexer.l" +#line 286 "lexer.l" { lmsg ("onend"); BEGIN (stringstate); @@ -1305,9 +1351,9 @@ YY_RULE_SETUP return (ONEND); } YY_BREAK -case 43: +case 47: YY_RULE_SETUP -#line 274 "lexer.l" +#line 294 "lexer.l" { lmsg ("stickycookie"); BEGIN (stringstate); @@ -1316,9 +1362,9 @@ YY_RULE_SETUP return (STICKYCOOKIE); } YY_BREAK -case 44: +case 48: YY_RULE_SETUP -#line 282 "lexer.l" +#line 302 "lexer.l" { lmsg ("addclientheader"); BEGIN (stringstate); @@ -1327,9 +1373,9 @@ YY_RULE_SETUP return (ADDCLIENTHEADER); } YY_BREAK -case 45: +case 49: YY_RULE_SETUP -#line 290 "lexer.l" +#line 310 "lexer.l" { lmsg ("setclientheader"); BEGIN (stringstate); @@ -1338,9 +1384,9 @@ YY_RULE_SETUP return (SETCLIENTHEADER); } YY_BREAK -case 46: +case 50: YY_RULE_SETUP -#line 298 "lexer.l" +#line 318 "lexer.l" { lmsg ("appendclientheader"); BEGIN (stringstate); @@ -1349,9 +1395,9 @@ YY_RULE_SETUP return (APPENDCLIENTHEADER); } YY_BREAK -case 47: +case 51: YY_RULE_SETUP -#line 306 "lexer.l" +#line 326 "lexer.l" { lmsg ("addserverheader"); BEGIN (stringstate); @@ -1360,9 +1406,9 @@ YY_RULE_SETUP return (ADDSERVERHEADER); } YY_BREAK -case 48: +case 52: YY_RULE_SETUP -#line 314 "lexer.l" +#line 334 "lexer.l" { lmsg ("setserverheader"); BEGIN (stringstate); @@ -1371,9 +1417,9 @@ YY_RULE_SETUP return (SETSERVERHEADER); } YY_BREAK -case 49: +case 53: YY_RULE_SETUP -#line 322 "lexer.l" +#line 342 "lexer.l" { lmsg ("appendserverheader"); BEGIN (stringstate); @@ -1382,9 +1428,9 @@ YY_RULE_SETUP return (APPENDSERVERHEADER); } YY_BREAK -case 50: +case 54: YY_RULE_SETUP -#line 330 "lexer.l" +#line 350 "lexer.l" { lmsg ("allowfrom"); BEGIN (stringstate); @@ -1393,9 +1439,9 @@ YY_RULE_SETUP return (ALLOWFROM); } YY_BREAK -case 51: +case 55: YY_RULE_SETUP -#line 338 "lexer.l" +#line 358 "lexer.l" { lmsg ("denyfrom"); BEGIN (stringstate); @@ -1404,9 +1450,9 @@ YY_RULE_SETUP return (DENYFROM); } YY_BREAK -case 52: +case 56: YY_RULE_SETUP -#line 346 "lexer.l" +#line 366 "lexer.l" { lmsg ("allowfile"); BEGIN (stringstate); @@ -1415,9 +1461,9 @@ YY_RULE_SETUP return (ALLOWFILE); } YY_BREAK -case 53: +case 57: YY_RULE_SETUP -#line 354 "lexer.l" +#line 374 "lexer.l" { lmsg ("denyfile"); BEGIN (stringstate); @@ -1426,110 +1472,110 @@ YY_RULE_SETUP return (DENYFILE); } YY_BREAK -case 54: +case 58: YY_RULE_SETUP -#line 362 "lexer.l" +#line 382 "lexer.l" { lmsg ("on"); return (ON); } YY_BREAK -case 55: +case 59: YY_RULE_SETUP -#line 367 "lexer.l" +#line 387 "lexer.l" { lmsg ("off"); return (OFF); } YY_BREAK -case 56: +case 60: YY_RULE_SETUP -#line 372 "lexer.l" +#line 392 "lexer.l" { llmsg ("identifier", yytext); return (IDENTIFIER); } YY_BREAK -case 57: +case 61: YY_RULE_SETUP -#line 377 "lexer.l" +#line 397 "lexer.l" { llmsg ("number", yytext); return (NUMBER); } YY_BREAK -case 58: +case 62: YY_RULE_SETUP -#line 382 "lexer.l" +#line 402 "lexer.l" { lmsg ("space(s)"); } YY_BREAK -case 59: +case 63: YY_RULE_SETUP -#line 386 "lexer.l" +#line 406 "lexer.l" { lmsg ("newline"); yylineno++; } YY_BREAK -case 60: +case 64: YY_RULE_SETUP -#line 391 "lexer.l" +#line 411 "lexer.l" { llmsg ("lone char", yytext); return (*yytext); } YY_BREAK -case 61: +case 65: YY_RULE_SETUP -#line 396 "lexer.l" +#line 416 "lexer.l" { lmsg ("C-comment starts"); BEGIN(commentstate); } YY_BREAK -case 62: +case 66: YY_RULE_SETUP -#line 400 "lexer.l" +#line 420 "lexer.l" { lmsg ("C-comment ends"); BEGIN(0); } YY_BREAK -case 63: +case 67: YY_RULE_SETUP -#line 404 "lexer.l" +#line 424 "lexer.l" { yylineno++; } YY_BREAK -case 64: +case 68: YY_RULE_SETUP -#line 407 "lexer.l" +#line 427 "lexer.l" ; YY_BREAK -case 65: +case 69: YY_RULE_SETUP -#line 409 "lexer.l" +#line 429 "lexer.l" { llmsg ("string part", yytext); laststring = xstrcat (laststring, yytext + 1); laststring[strlen(laststring) - 1] = 0; } YY_BREAK -case 66: +case 70: YY_RULE_SETUP -#line 414 "lexer.l" +#line 434 "lexer.l" { llmsg ("string part", yytext); laststring = xstrcat (laststring, yytext + 1); laststring[strlen(laststring) - 1] = 0; } YY_BREAK -case 67: +case 71: YY_RULE_SETUP -#line 419 "lexer.l" +#line 439 "lexer.l" { BEGIN (0); unput (';'); @@ -1537,9 +1583,9 @@ YY_RULE_SETUP return (STRING); } YY_BREAK -case 68: +case 72: YY_RULE_SETUP -#line 425 "lexer.l" +#line 445 "lexer.l" { if (laststring) { laststring = xstrcat (laststring, yytext); @@ -1547,17 +1593,17 @@ YY_RULE_SETUP } } YY_BREAK -case 69: +case 73: YY_RULE_SETUP -#line 431 "lexer.l" +#line 451 "lexer.l" { llmsg ("string part", yytext); laststring = xstrcat (laststring, yytext); } YY_BREAK -case 70: +case 74: YY_RULE_SETUP -#line 435 "lexer.l" +#line 455 "lexer.l" { if (laststring) { laststring = xstrcat (laststring, " "); @@ -1566,9 +1612,9 @@ YY_RULE_SETUP yylineno++; } YY_BREAK -case 71: +case 75: YY_RULE_SETUP -#line 443 "lexer.l" +#line 463 "lexer.l" { lmsg ("includefile"); /* parser_skipline(); */ @@ -1577,38 +1623,38 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(includestate): -#line 449 "lexer.l" +#line 469 "lexer.l" { error ("Unterminated #include"); } YY_BREAK -case 72: +case 76: YY_RULE_SETUP -#line 452 "lexer.l" +#line 472 "lexer.l" ; YY_BREAK -case 73: +case 77: YY_RULE_SETUP -#line 453 "lexer.l" +#line 473 "lexer.l" { yylineno++; } YY_BREAK -case 74: +case 78: YY_RULE_SETUP -#line 456 "lexer.l" +#line 476 "lexer.l" { error ("Illegal character 0x%2.2x in #include line", *yytext); } YY_BREAK -case 75: +case 79: YY_RULE_SETUP -#line 460 "lexer.l" +#line 480 "lexer.l" ; YY_BREAK -case 76: +case 80: YY_RULE_SETUP -#line 461 "lexer.l" +#line 481 "lexer.l" { symtab_start (yytext); BEGIN (defineredef); @@ -1617,54 +1663,54 @@ YY_RULE_SETUP case YY_STATE_EOF(definestate): case YY_STATE_EOF(defineredef): case YY_STATE_EOF(definesym): -#line 465 "lexer.l" +#line 485 "lexer.l" { error ("Unterminated #define"); } YY_BREAK -case 77: +case 81: YY_RULE_SETUP -#line 468 "lexer.l" +#line 488 "lexer.l" { error ("Unterminated #define"); } YY_BREAK -case 78: +case 82: YY_RULE_SETUP -#line 471 "lexer.l" +#line 491 "lexer.l" { error ("Unrecognized character '%c' in #define", *yytext); } YY_BREAK -case 79: +case 83: YY_RULE_SETUP -#line 475 "lexer.l" +#line 495 "lexer.l" { BEGIN (definesym); } YY_BREAK -case 80: +case 84: YY_RULE_SETUP -#line 478 "lexer.l" +#line 498 "lexer.l" { symtab_set (yytext); } YY_BREAK -case 81: +case 85: YY_RULE_SETUP -#line 481 "lexer.l" +#line 501 "lexer.l" { yylineno++; symtab_end(); BEGIN (0); } YY_BREAK -case 82: +case 86: YY_RULE_SETUP -#line 486 "lexer.l" +#line 506 "lexer.l" ECHO; YY_BREAK -#line 1663 "lexer.c" +#line 1709 "lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(stringstate): case YY_STATE_EOF(commentstate): @@ -1959,7 +2005,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 >= 489 ) + if ( yy_current_state >= 513 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1994,11 +2040,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 >= 489 ) + if ( yy_current_state >= 513 ) 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 == 488); + yy_is_jam = (yy_current_state == 512); return yy_is_jam ? 0 : yy_current_state; } @@ -2554,4 +2600,4 @@ int main() return 0; } #endif -#line 486 "lexer.l" +#line 506 "lexer.l" diff --git a/src/lib/lexer.l b/src/lib/lexer.l @@ -75,6 +75,26 @@ backend { return (BACKEND); } +state { + lmsg ("state"); + return (STATE); +} + +(available)|(up) { + lmsg ("available"); + return (AVAILABLE); +} + +unavailable { + lmsg ("unavailable"); + return (UNAVAILABLE); +} + +down { + lmsg ("down"); + return (DOWN); +} + backlog { lmsg ("backlog"); return (BACKLOG); diff --git a/src/lib/lockreporter.c b/src/lib/lockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -10,7 +10,9 @@ void log_activity_any (char const *action) { return; if (!logstarted++) openlog ("crossroads", LOG_PID, log_facility); - syslog (LOG_NOTICE, "%s %s %s from %s to %s", + syslog (LOG_NOTICE, "%s %s %s from %s to %s:%d", ansistamp(tm_localtime), action, activeservice->name, - client_ip, activeservice->backend[current_backend].server); + client_ip, + servicereport->backendstate[current_backend].actual_server, + servicereport->backendstate[current_backend].actual_port); } diff --git a/src/lib/logactivitycontinuation.c b/src/lib/logactivitycontinuation.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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,7 +24,8 @@ void mark_activity (double nbytes, double nsec, /* If the new activity is a failure: increase fails count. * Upon other state, set fails count to zero. */ if (newstate == st_unavailable && - servicereport->backendstate[current_backend].avail != st_unavailable) { + servicereport->backendstate[current_backend].actual_avail != + st_unavailable) { servicereport->backendstate[current_backend].fail++; // msg ("Service %s: Back end %d's unavailability increased to %d", // activeservice->name, current_backend, @@ -84,8 +85,10 @@ void mark_activity (double nbytes, double nsec, /* Set the state, unless it's already marked for wakeup or brought down. * Do this only for 'final' states, not for intermediate. */ - if (servicereport->backendstate[current_backend].avail != st_waking && - servicereport->backendstate[current_backend].avail != st_down) { + if (servicereport->backendstate[current_backend].actual_avail + != st_waking && + servicereport->backendstate[current_backend].actual_avail + != st_down) { /* When trying to mark as unavailable, only proceed when we * actually exceed the retries setting. */ if (newstate == st_unavailable) { @@ -96,7 +99,7 @@ void mark_activity (double nbytes, double nsec, servicereport->backendstate[current_backend].fail, activeservice->backend[current_backend].retries); servicereport->backendstate[current_backend].fail = 0; - servicereport->backendstate[current_backend].avail = + servicereport->backendstate[current_backend].actual_avail = st_unavailable; marked_unavailable++; } @@ -104,7 +107,8 @@ void mark_activity (double nbytes, double nsec, } else if (newstate != st_intermediate) { /* When applying any other state than intermediate, it's OK */ servicereport->backendstate[current_backend].fail = 0; - servicereport->backendstate[current_backend].avail = newstate; + servicereport->backendstate[current_backend].actual_avail = + newstate; servicereport->backendstate[current_backend].totuses++; } } @@ -127,7 +131,7 @@ void mark_activity (double nbytes, double nsec, servicereport->backendstate[current_backend].nbytes, servicereport->backendstate[current_backend].avg_nbytes, state_to_string - (servicereport->backendstate[current_backend].avail)); + (servicereport->backendstate[current_backend].actual_avail)); /* Run the onfailure hook if one is specified. */ if (marked_unavailable && program_stage != stage_retrying) { diff --git a/src/lib/msg.c b/src/lib/msg.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -61,6 +61,10 @@ # define DEEP 307 # define SHALLOW 308 # define CHECKINTERVAL 309 +# define STATE 310 +# define AVAILABLE 311 +# define UNAVAILABLE 312 +# define DOWN 313 #line 3 "parser.y" @@ -199,12 +203,12 @@ static void setuseraccount (char *username) { -#define YYFINAL 219 +#define YYFINAL 228 #define YYFLAG -32768 -#define YYNTBASE 59 +#define YYNTBASE 63 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 309 ? yytranslate[x] : 146) +#define YYTRANSLATE(x) ((unsigned)(x) <= 313 ? yytranslate[x] : 154) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -214,14 +218,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, 58, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 62, 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, 56, 2, 57, 2, 2, 2, 2, + 2, 2, 2, 60, 2, 61, 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, @@ -239,7 +243,8 @@ 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, 55 + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59 }; #if YYDEBUG @@ -255,49 +260,52 @@ static const short yyprhs[] = 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 + 261, 266, 270, 274, 276, 280, 284, 287, 289, 291, + 293, 297, 301, 305, 309, 313, 316, 319, 323, 326, + 330, 334, 338, 342, 346, 350, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + 367, 368, 369, 370, 371, 372 }; static const short yyrhs[] = { - 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, + 63, 64, 0, 64, 0, 65, 66, 60, 67, 61, + 0, 138, 3, 0, 146, 4, 0, 67, 68, 0, + 68, 0, 140, 69, 0, 70, 0, 71, 0, 75, + 0, 77, 0, 86, 0, 87, 0, 90, 0, 91, + 0, 92, 0, 93, 0, 94, 0, 97, 0, 100, + 0, 102, 0, 101, 0, 103, 0, 84, 0, 105, + 0, 5, 73, 74, 0, 31, 72, 74, 0, 148, + 19, 0, 136, 6, 0, 141, 62, 0, 8, 142, + 76, 74, 0, 10, 0, 11, 0, 12, 82, 78, + 74, 0, 79, 0, 81, 0, 0, 29, 80, 0, + 136, 6, 0, 123, 0, 143, 83, 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, + 47, 0, 50, 0, 49, 85, 74, 0, 152, 19, + 0, 14, 73, 88, 74, 0, 55, 73, 88, 74, + 0, 89, 0, 0, 47, 123, 0, 20, 73, 74, + 0, 15, 73, 74, 0, 25, 73, 74, 0, 26, + 73, 74, 0, 33, 95, 74, 0, 149, 96, 0, + 34, 0, 35, 0, 52, 98, 74, 0, 150, 99, + 0, 53, 0, 54, 0, 43, 104, 74, 0, 44, + 104, 74, 0, 45, 124, 74, 0, 46, 124, 74, + 0, 151, 19, 0, 7, 106, 60, 107, 61, 0, + 147, 4, 0, 107, 108, 0, 108, 0, 139, 109, + 0, 110, 0, 70, 0, 75, 0, 118, 0, 120, + 0, 119, 0, 121, 0, 122, 0, 111, 0, 112, + 0, 93, 0, 125, 0, 127, 0, 128, 0, 129, + 0, 130, 0, 131, 0, 132, 0, 114, 0, 115, + 0, 9, 137, 113, 74, 0, 16, 73, 74, 0, + 30, 73, 74, 0, 19, 0, 51, 73, 74, 0, + 56, 116, 74, 0, 153, 117, 0, 57, 0, 58, + 0, 59, 0, 17, 123, 74, 0, 18, 123, 74, + 0, 48, 123, 74, 0, 28, 124, 74, 0, 32, + 124, 74, 0, 144, 19, 0, 145, 19, 0, 36, + 126, 74, 0, 135, 19, 0, 37, 133, 74, 0, + 38, 133, 74, 0, 39, 133, 74, 0, 40, 133, + 74, 0, 41, 133, 74, 0, 42, 133, 74, 0, + 134, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0 }; #endif @@ -308,18 +316,19 @@ static const short yyrline[] = { 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 + 294, 300, 306, 312, 318, 324, 331, 506, 518, 530, + 539, 546, 551, 564, 568, 574, 583, 585, 587, 591, + 608, 615, 625, 634, 638, 642, 646, 650, 654, 658, + 662, 668, 680, 689, 707, 725, 727, 731, 740, 752, + 764, 776, 788, 800, 805, 809, 815, 827, 832, 836, + 842, 854, 866, 878, 890, 899, 909, 921, 929, 935, + 942, 947, 952, 957, 962, 967, 972, 977, 982, 987, + 992, 997, 1002, 1007, 1012, 1017, 1022, 1027, 1032, 1037, + 1044, 1057, 1069, 1081, 1087, 1099, 1111, 1116, 1120, 1124, + 1130, 1142, 1154, 1166, 1178, 1190, 1199, 1208, 1220, 1229, + 1241, 1253, 1265, 1277, 1289, 1301, 1310, 1315, 1320, 1325, + 1330, 1335, 1340, 1345, 1350, 1355, 1360, 1365, 1370, 1375, + 1380, 1385, 1390, 1395, 1400, 1405 }; #endif @@ -339,12 +348,13 @@ static const char *const yytname[] = "APPENDCLIENTHEADER", "ADDSERVERHEADER", "SETSERVERHEADER", "APPENDSERVERHEADER", "ALLOWFROM", "DENYFROM", "ALLOWFILE", "DENYFILE", "EXTERNALHANDLER", "ONEND", "USERACCOUNT", "BYCLIENTIP", "RETRIES", - "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", + "HEADERINSPECTION", "DEEP", "SHALLOW", "CHECKINTERVAL", "STATE", + "AVAILABLE", "UNAVAILABLE", "DOWN", "'{'", "'}'", "';'", "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", @@ -354,9 +364,10 @@ static const char *const yytname[] = "denyfilestatement", "ipfilters", "backendblock", "backendname", "backenddefinitions", "backenddefinition", "backendstatement", "serverstatement", "weightstatement", "decaystatement", "serveraddress", - "retriesstatement", "onstartstatement", "onfailstatement", - "onendstatement", "dumptrafficstatement", "throughputstatement", - "commandline", "filename", "stickycookiestatement", "cookiespecifier", + "retriesstatement", "initialstatestatement", "statedef", "somestate", + "onstartstatement", "onfailstatement", "onendstatement", + "dumptrafficstatement", "throughputstatement", "commandline", + "filename", "stickycookiestatement", "cookiespecifier", "addclientheaderstatement", "setclientheaderstatement", "appendclientheaderstatement", "addserverheaderstatement", "setserverheaderstatement", "appendserverheaderstatement", @@ -366,27 +377,28 @@ static const char *const yytname[] = "onoff_expected", "dispatchmethod_expected", "commandline_expected", "filename_expected", "servicename_expected", "backendname_expected", "ipaddress_expected", "type_expected", "shallowdeep_expected", - "ipfilters_expected", "useraccount_expected", 0 + "ipfilters_expected", "useraccount_expected", "statedef_expected", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - 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 + 0, 63, 63, 64, 65, 66, 67, 67, 68, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 70, 71, 72, + 73, 74, 75, 76, 76, 77, 78, 78, 78, 79, + 80, 81, 82, 83, 83, 83, 83, 83, 83, 83, + 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 96, 97, 98, 99, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 107, 108, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 117, 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, 146, 147, + 148, 149, 150, 151, 152, 153 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -401,11 +413,12 @@ static const short yyr2[] = 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, 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, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 4, 3, 3, 1, 3, 3, 2, 1, 1, 1, + 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 + 0, 0, 0, 0, 0, 0 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -413,28 +426,29 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 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, + 130, 130, 2, 138, 0, 1, 0, 0, 4, 132, + 5, 132, 7, 0, 3, 6, 128, 139, 134, 135, + 128, 128, 128, 128, 128, 140, 141, 143, 143, 137, + 137, 144, 142, 128, 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, + 22, 24, 26, 133, 0, 0, 0, 0, 38, 0, + 56, 133, 133, 133, 133, 133, 0, 133, 0, 133, + 0, 133, 133, 0, 133, 133, 0, 133, 0, 56, + 27, 0, 30, 131, 76, 33, 34, 133, 128, 133, 36, 37, 41, 0, 43, 44, 45, 46, 48, 47, - 49, 50, 42, 130, 127, 55, 59, 58, 60, 61, + 49, 50, 42, 136, 133, 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 + 116, 73, 51, 52, 66, 68, 69, 67, 133, 31, + 131, 78, 0, 32, 39, 0, 35, 115, 57, 53, + 54, 75, 77, 129, 128, 136, 136, 137, 128, 137, + 127, 126, 126, 126, 126, 126, 126, 136, 128, 145, + 81, 82, 90, 79, 80, 88, 89, 98, 99, 83, + 85, 84, 86, 87, 91, 92, 93, 94, 95, 96, + 97, 40, 0, 133, 133, 133, 133, 133, 133, 133, + 0, 133, 0, 133, 133, 133, 133, 133, 133, 133, + 133, 0, 103, 133, 101, 110, 111, 113, 102, 114, + 117, 118, 119, 125, 120, 121, 122, 123, 124, 112, + 104, 105, 107, 108, 109, 106, 100, 0, 0 }; static const short yydefgoto[] = @@ -443,102 +457,105 @@ static const short yydefgoto[] = 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 + 51, 69, 52, 55, 130, 131, 163, 164, 165, 166, + 203, 167, 168, 200, 225, 169, 170, 171, 172, 173, + 92, 72, 174, 189, 175, 176, 177, 178, 179, 180, + 191, 192, 190, 54, 182, 4, 132, 13, 81, 57, + 59, 93, 73, 7, 56, 66, 68, 78, 70, 76, + 201 }; static const short yypact[] = { - -32768, 7,-32768,-32768, 6,-32768, -44, 18,-32768,-32768, - -32768, -33,-32768, 30,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 7,-32768,-32768, 6,-32768, -33, 27,-32768,-32768, + -32768, -22,-32768, 139,-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, 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,-32768,-32768,-32768, 40, -11, 47, 34, -4, 55, + 8,-32768,-32768,-32768,-32768,-32768, 52,-32768, 23,-32768, + 54,-32768,-32768, 62,-32768,-32768, 64,-32768, 16, 8, -32768, -9,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 38,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, 65,-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, - 1,-32768, 141,-32768,-32768, 45,-32768,-32768,-32768,-32768, + 13,-32768, 24,-32768,-32768, 79,-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, - 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 43,-32768, - 46,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, 67,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 68,-32768, 69,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, -35,-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, 64,-32768 + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 89,-32768 }; static const short yypgoto[] = { - -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 + -32768, 90,-32768,-32768,-32768, 81,-32768, -42,-32768,-32768, + -3, -61, -39,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768, 15,-32768,-32768,-32768,-32768, + -37,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 70,-32768,-32768,-32768, -34,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -98, -18,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -118,-32768,-32768, 9,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768 }; -#define YYLAST 192 +#define YYLAST 194 static const short yytable[] = { - 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, + 106, 107, 108, 109, 110, 138, 112, 227, 116, 8, + 118, 119, 74, 121, 122, -136, 124, 60, 61, 62, + 63, 64, 222, 223, 224, 88, 133, 9, 136, 16, + 79, 10, 18, 143, 193, 194, 195, 196, 197, 14, + 144, 145, 146, 139, 85, 86, 82, 184, 185, 83, + 24, 84, 147, 129, 148, 103, 149, 113, 114, 198, + 150, 151, 152, 153, 154, 155, 156, 140, 94, 125, + 126, 111, 157, 117, 141, 158, 95, 96, 97, 98, + 159, 120, 99, 123, 137, 181, 202, 211, 213, 228, + 160, 5, 15, 161, 128, 162, 142, 135, 71, 0, 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 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 204, 205, 206, 207, 208, 209, 210, 186, + 212, 188, 214, 215, 216, 217, 218, 219, 220, 221, + 0, 183, 226, 0, 16, 187, 17, 18, 0, 0, + 0, 19, 0, 20, 21, 199, 0, 0, 0, 22, + 0, 0, 0, 0, 23, 24, 0, 0, 0, 0, + 25, 0, 26, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 27, 28, 29, 30, 0, 0, 31, 0, + 0, 32, 0, 0, 33 }; static const short yycheck[] = { 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, + 71, 72, 30, 74, 75, 19, 77, 20, 21, 22, + 23, 24, 57, 58, 59, 29, 87, 60, 89, 5, + 33, 4, 8, 9, 152, 153, 154, 155, 156, 61, + 16, 17, 18, 104, 10, 11, 6, 145, 146, 60, + 26, 4, 28, 62, 30, 47, 32, 34, 35, 157, + 36, 37, 38, 39, 40, 41, 42, 128, 13, 53, + 54, 19, 48, 19, 61, 51, 21, 22, 23, 24, + 56, 19, 27, 19, 19, 6, 19, 19, 19, 0, + 132, 1, 11, 132, 79, 132, 130, 88, 28, -1, -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 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 183, 184, 185, 186, 187, 188, 189, 147, + 191, 149, 193, 194, 195, 196, 197, 198, 199, 200, + -1, 144, 203, -1, 5, 148, 7, 8, -1, -1, + -1, 12, -1, 14, 15, 158, -1, -1, -1, 20, + -1, -1, -1, -1, 25, 26, -1, -1, -1, -1, + 31, -1, 33, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 43, 44, 45, 46, -1, -1, 49, -1, + -1, 52, -1, -1, 55 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/sw/share/bison/bison.simple" @@ -1445,12 +1462,12 @@ case 26: switch (yyvsp[0].set[i].cf) { case cf_portspec: pimsg ("backend block port:", yyvsp[0].set[i].v.ival); - cur_backend.port = yyvsp[0].set[i].v.ival; + cur_backend.initial_port = yyvsp[0].set[i].v.ival; break; case cf_serverspec: psmsg ("backend block server:", yyvsp[0].set[i].v.sval); - cur_backend.server = serverpart (yyvsp[0].set[i].v.sval); - cur_backend.port = portpart (yyvsp[0].set[i].v.sval); + cur_backend.initial_server = serverpart (yyvsp[0].set[i].v.sval); + cur_backend.initial_port = portpart (yyvsp[0].set[i].v.sval); free (yyvsp[0].set[i].v.sval); break; case cf_verbosityspec: @@ -1568,6 +1585,10 @@ case 26: pimsg ("backend retries:", yyvsp[0].set[i].v.ival); cur_backend.retries = yyvsp[0].set[i].v.ival; break; + case cf_statespec: + pimsg ("backend initial state:", yyvsp[0].set[i].v.ival); + cur_backend.initial_avail = yyvsp[0].set[i].v.ival; + break; default: error ("Internal jam, unhandled type %d " "in backend specification", @@ -1578,7 +1599,7 @@ case 26: /* Verify the backend block, supply defaults, * And so on. */ - if (!cur_backend.port) + if (!cur_backend.initial_port) error ("Service %s: back end %s lacks port", cur_service.name, cur_backend.name); if (cur_backend.weight < 1) @@ -1609,7 +1630,7 @@ case 26: ; break;} case 27: -#line 505 "parser.y" +#line 509 "parser.y" { pimsg ("port statement:", lastnr); yyval.n = 1; @@ -1619,7 +1640,7 @@ case 27: ; break;} case 28: -#line 517 "parser.y" +#line 521 "parser.y" { psmsg ("bindto statement:", laststr); yyval.n = 1; @@ -1629,7 +1650,7 @@ case 28: ; break;} case 29: -#line 528 "parser.y" +#line 532 "parser.y" { setlaststr (laststring); free (laststring); @@ -1637,13 +1658,13 @@ case 29: ; break;} case 30: -#line 537 "parser.y" +#line 541 "parser.y" { setlastnr (SYMBOL); ; break;} case 32: -#line 551 "parser.y" +#line 555 "parser.y" { pimsg ("verbosity statement:", lastnr); yyval.n = 1; @@ -1653,25 +1674,25 @@ case 32: ; break;} case 33: -#line 561 "parser.y" +#line 565 "parser.y" { lastnr = 1; ; break;} case 34: -#line 565 "parser.y" +#line 569 "parser.y" { lastnr = 0; ; break;} case 35: -#line 574 "parser.y" +#line 578 "parser.y" { yyval = yyvsp[-2]; ; break;} case 39: -#line 589 "parser.y" +#line 593 "parser.y" { pimsg ("dispatch mode statement:", lastnr); yyval.n = 1; @@ -1687,13 +1708,13 @@ case 39: ; break;} case 40: -#line 606 "parser.y" +#line 610 "parser.y" { setlastovernr (SYMBOL); ; break;} case 41: -#line 612 "parser.y" +#line 616 "parser.y" { psmsg ("external handler:", laststr); if (lastnr != ds_externalhandler) @@ -1703,7 +1724,7 @@ case 41: ; break;} case 42: -#line 623 "parser.y" +#line 627 "parser.y" { yyval.n = 1; yyval.set = xmalloc (sizeof(Confset)); @@ -1711,55 +1732,55 @@ case 42: ; break;} case 43: -#line 631 "parser.y" +#line 635 "parser.y" { lastnr = ds_roundrobin; ; break;} case 44: -#line 635 "parser.y" +#line 639 "parser.y" { lastnr = ds_random; ; break;} case 45: -#line 639 "parser.y" +#line 643 "parser.y" { lastnr = ds_byduration; ; break;} case 46: -#line 643 "parser.y" +#line 647 "parser.y" { lastnr = ds_bysize; ; break;} case 47: -#line 647 "parser.y" +#line 651 "parser.y" { lastnr = ds_byorder; ; break;} case 48: -#line 651 "parser.y" +#line 655 "parser.y" { lastnr = ds_byconnections; ; break;} case 49: -#line 655 "parser.y" +#line 659 "parser.y" { lastnr = ds_externalhandler; ; break;} case 50: -#line 659 "parser.y" +#line 663 "parser.y" { lastnr = ds_byclientip; ; break;} case 51: -#line 667 "parser.y" +#line 671 "parser.y" { psmsg ("user account statement:", laststr); yyval.n = 1; @@ -1769,7 +1790,7 @@ case 51: ; break;} case 52: -#line 678 "parser.y" +#line 682 "parser.y" { setlaststr (laststring); free (laststring); @@ -1777,7 +1798,7 @@ case 52: ; break;} case 53: -#line 689 "parser.y" +#line 693 "parser.y" { pimsg ("reviving interval statement:", lastnr); yyval.n = 2; @@ -1792,7 +1813,7 @@ case 53: ; break;} case 54: -#line 707 "parser.y" +#line 711 "parser.y" { pimsg ("check interval:", lastnr); yyval.n = 2; @@ -1807,7 +1828,7 @@ case 54: ; break;} case 57: -#line 729 "parser.y" +#line 733 "parser.y" { yyval.n = 1; yyval.set = xmalloc (sizeof(Confset)); @@ -1815,7 +1836,7 @@ case 57: ; break;} case 58: -#line 739 "parser.y" +#line 743 "parser.y" { pimsg ("backlog statement:", lastnr); yyval.n = 1; @@ -1825,7 +1846,7 @@ case 58: ; break;} case 59: -#line 751 "parser.y" +#line 755 "parser.y" { pimsg ("shmkey statement:", lastnr); yyval.n = 1; @@ -1835,7 +1856,7 @@ case 59: ; break;} case 60: -#line 763 "parser.y" +#line 767 "parser.y" { pimsg ("connection timeout statement:", lastnr); yyval.n = 1; @@ -1845,7 +1866,7 @@ case 60: ; break;} case 61: -#line 775 "parser.y" +#line 779 "parser.y" { pimsg ("max clients statement (service):", lastnr); yyval.n = 1; @@ -1855,7 +1876,7 @@ case 61: ; break;} case 62: -#line 787 "parser.y" +#line 791 "parser.y" { pimsg ("service type:", lastnr); yyval.n = 1; @@ -1865,19 +1886,19 @@ case 62: ; break;} case 64: -#line 802 "parser.y" +#line 806 "parser.y" { lastnr = type_any; ; break;} case 65: -#line 806 "parser.y" +#line 810 "parser.y" { lastnr = type_http; ; break;} case 66: -#line 814 "parser.y" +#line 818 "parser.y" { pimsg ("service header inspection: ", lastnr); yyval.n = 1; @@ -1887,19 +1908,19 @@ case 66: ; break;} case 68: -#line 829 "parser.y" +#line 833 "parser.y" { lastnr = ins_deep; ; break;} case 69: -#line 833 "parser.y" +#line 837 "parser.y" { lastnr = ins_shallow; ; break;} case 70: -#line 841 "parser.y" +#line 845 "parser.y" { psmsg ("allow from: ", laststr); yyval.n = 1; @@ -1909,7 +1930,7 @@ case 70: ; break;} case 71: -#line 853 "parser.y" +#line 857 "parser.y" { psmsg ("allow from: ", laststr); yyval.n = 1; @@ -1919,7 +1940,7 @@ case 71: ; break;} case 72: -#line 865 "parser.y" +#line 869 "parser.y" { psmsg ("allow file: ", laststr); yyval.n = 1; @@ -1929,7 +1950,7 @@ case 72: ; break;} case 73: -#line 877 "parser.y" +#line 881 "parser.y" { psmsg ("allow file: ", laststr); yyval.n = 1; @@ -1939,7 +1960,7 @@ case 73: ; break;} case 74: -#line 888 "parser.y" +#line 892 "parser.y" { setlaststr (laststring); free (laststring); @@ -1947,13 +1968,13 @@ case 74: ; break;} case 75: -#line 900 "parser.y" +#line 904 "parser.y" { yyval = yyvsp[-1]; ; break;} case 76: -#line 907 "parser.y" +#line 911 "parser.y" { psmsg ("backend name:", SYMBOL); for (i = 0; i < cur_service.nbackend; i++) @@ -1964,7 +1985,7 @@ case 76: ; break;} case 77: -#line 919 "parser.y" +#line 923 "parser.y" { yyvsp[-1].n++; yyvsp[-1].set = xrealloc (yyvsp[-1].set, yyvsp[-1].n * sizeof(Confset)); @@ -1973,152 +1994,159 @@ case 77: ; break;} case 78: -#line 926 "parser.y" +#line 930 "parser.y" { yyval = yyvsp[0]; ; break;} case 79: -#line 933 "parser.y" +#line 937 "parser.y" { yyval = yyvsp[0]; ; break;} case 80: -#line 939 "parser.y" +#line 943 "parser.y" { psmsg ("backend server:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 81: -#line 944 "parser.y" +#line 948 "parser.y" { pimsg ("backend port:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} case 82: -#line 949 "parser.y" +#line 953 "parser.y" { pimsg ("backend verbosity:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} case 83: -#line 954 "parser.y" +#line 958 "parser.y" { psmsg ("backend onstart:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 84: -#line 959 "parser.y" +#line 963 "parser.y" { psmsg ("backend onend:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 85: -#line 964 "parser.y" +#line 968 "parser.y" { psmsg ("backend onfail:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 86: -#line 969 "parser.y" +#line 973 "parser.y" { psmsg ("backend trafficlog:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 87: -#line 974 "parser.y" +#line 978 "parser.y" { psmsg ("backend trafficlog:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 88: -#line 979 "parser.y" +#line 983 "parser.y" { pimsg ("backend weight:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} case 89: -#line 984 "parser.y" +#line 988 "parser.y" { pimsg ("backend decay:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} case 90: -#line 989 "parser.y" +#line 993 "parser.y" { pimsg ("backend maxconnections:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} case 91: -#line 994 "parser.y" +#line 998 "parser.y" { psmsg ("backend sticky cookie:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 92: -#line 999 "parser.y" +#line 1003 "parser.y" { psmsg ("addclientheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 93: -#line 1004 "parser.y" +#line 1008 "parser.y" { psmsg ("setclientheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 94: -#line 1009 "parser.y" +#line 1013 "parser.y" { psmsg ("appendclientheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 95: -#line 1014 "parser.y" +#line 1018 "parser.y" { psmsg ("addserverheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 96: -#line 1019 "parser.y" +#line 1023 "parser.y" { psmsg ("setserverheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 97: -#line 1024 "parser.y" +#line 1028 "parser.y" { psmsg ("appendserverheader:", yyvsp[0].set[0].v.sval); yyval = yyvsp[0]; ; break;} case 98: -#line 1029 "parser.y" +#line 1033 "parser.y" { pimsg ("backend retries:", yyvsp[0].set[0].v.ival); yyval = yyvsp[0]; ; break;} case 99: -#line 1039 "parser.y" +#line 1038 "parser.y" +{ + pimsg ("backend state:", yyvsp[0].set[0].v.ival); + yyval = yyvsp[0]; + ; + break;} +case 100: +#line 1048 "parser.y" { psmsg ("server statement:", laststr); yyval.n = 1; @@ -2127,8 +2155,8 @@ case 99: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 100: -#line 1051 "parser.y" +case 101: +#line 1060 "parser.y" { pimsg ("weight statement", lastnr); yyval.n = 1; @@ -2137,8 +2165,8 @@ case 100: yyval.set[0].v.ival = lastnr; ; break;} -case 101: -#line 1063 "parser.y" +case 102: +#line 1072 "parser.y" { pimsg ("decay statement", lastnr); yyval.n = 1; @@ -2147,14 +2175,14 @@ case 101: yyval.set[0].v.ival = lastnr; ; break;} -case 102: -#line 1073 "parser.y" +case 103: +#line 1082 "parser.y" { setlaststr (laststring); ; break;} -case 103: -#line 1081 "parser.y" +case 104: +#line 1090 "parser.y" { pimsg ("retries:", lastnr); yyval.n = 1; @@ -2163,8 +2191,36 @@ case 103: yyval.set[0].v.ival = lastnr; ; break;} -case 104: -#line 1093 "parser.y" +case 105: +#line 1102 "parser.y" +{ + pimsg ("state:", lastnr); + yyval.n = 1; + yyval.set = xmalloc (sizeof(Confset)); + yyval.set[0].cf = cf_statespec; + yyval.set[0].v.ival = lastnr; + ; + break;} +case 107: +#line 1117 "parser.y" +{ + lastnr = st_available; + ; + break;} +case 108: +#line 1121 "parser.y" +{ + lastnr = st_unavailable; + ; + break;} +case 109: +#line 1125 "parser.y" +{ + lastnr = st_down; + ; + break;} +case 110: +#line 1133 "parser.y" { psmsg ("onstart statement:", laststr); yyval.n = 1; @@ -2173,8 +2229,8 @@ case 104: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 105: -#line 1105 "parser.y" +case 111: +#line 1145 "parser.y" { psmsg ("onfail statement:", laststr); yyval.n = 1; @@ -2183,8 +2239,8 @@ case 105: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 106: -#line 1117 "parser.y" +case 112: +#line 1157 "parser.y" { psmsg ("onend statement:", laststr); yyval.n = 1; @@ -2193,8 +2249,8 @@ case 106: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 107: -#line 1129 "parser.y" +case 113: +#line 1169 "parser.y" { psmsg ("trafficlog statement:", laststr); yyval.n = 1; @@ -2203,8 +2259,8 @@ case 107: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 108: -#line 1141 "parser.y" +case 114: +#line 1181 "parser.y" { psmsg ("throughputlog statement:", laststr); yyval.n = 1; @@ -2213,24 +2269,24 @@ case 108: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 109: -#line 1152 "parser.y" +case 115: +#line 1192 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 110: -#line 1161 "parser.y" +case 116: +#line 1201 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 111: -#line 1171 "parser.y" +case 117: +#line 1211 "parser.y" { psmsg ("insertcookie statement:", laststr); yyval.n = 1; @@ -2239,16 +2295,16 @@ case 111: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 112: -#line 1182 "parser.y" +case 118: +#line 1222 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 113: -#line 1192 "parser.y" +case 119: +#line 1232 "parser.y" { psmsg ("addclientheader statement:", laststr); yyval.n = 1; @@ -2257,8 +2313,8 @@ case 113: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 114: -#line 1204 "parser.y" +case 120: +#line 1244 "parser.y" { psmsg ("setclientheader statement:", laststr); yyval.n = 1; @@ -2267,8 +2323,8 @@ case 114: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 115: -#line 1216 "parser.y" +case 121: +#line 1256 "parser.y" { psmsg ("appendclientheader statement:", laststr); yyval.n = 1; @@ -2277,8 +2333,8 @@ case 115: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 116: -#line 1228 "parser.y" +case 122: +#line 1268 "parser.y" { psmsg ("addserverheader statement:", laststr); yyval.n = 1; @@ -2287,8 +2343,8 @@ case 116: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 117: -#line 1240 "parser.y" +case 123: +#line 1280 "parser.y" { psmsg ("setserverheader statement:", laststr); yyval.n = 1; @@ -2297,8 +2353,8 @@ case 117: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 118: -#line 1252 "parser.y" +case 124: +#line 1292 "parser.y" { psmsg ("appendserverheader statement:", laststr); yyval.n = 1; @@ -2307,128 +2363,134 @@ case 118: yyval.set[0].v.sval = xstrdup (laststr); ; break;} -case 119: -#line 1263 "parser.y" +case 125: +#line 1303 "parser.y" { setlaststr (laststring); free (laststring); laststring = 0; ; break;} -case 120: -#line 1270 "parser.y" +case 126: +#line 1310 "parser.y" { yyerrmsg = "HTTP header specifier expected"; ; break;} -case 121: -#line 1275 "parser.y" +case 127: +#line 1315 "parser.y" { yyerrmsg = "cookie specifier expected"; ; break;} -case 122: -#line 1280 "parser.y" +case 128: +#line 1320 "parser.y" { yyerrmsg = "number expected"; ; break;} -case 123: -#line 1285 "parser.y" +case 129: +#line 1325 "parser.y" { yyerrmsg = "hostname or IP address expected"; ; break;} -case 124: -#line 1290 "parser.y" +case 130: +#line 1330 "parser.y" { yyerrmsg = "'service' expected"; ; break;} -case 125: -#line 1295 "parser.y" +case 131: +#line 1335 "parser.y" { yyerrmsg = "backend definition statement expected"; ; break;} -case 126: -#line 1300 "parser.y" +case 132: +#line 1340 "parser.y" { yyerrmsg = "service body statement expected"; ; break;} -case 127: -#line 1305 "parser.y" +case 133: +#line 1345 "parser.y" { yyerrmsg = "semicolon (;) expected"; ; break;} -case 128: -#line 1310 "parser.y" +case 134: +#line 1350 "parser.y" { yyerrmsg = "'on' or 'off' expetcted"; ; break;} -case 129: -#line 1315 "parser.y" +case 135: +#line 1355 "parser.y" { yyerrmsg = "dispatch method expected"; ; break;} -case 130: -#line 1320 "parser.y" +case 136: +#line 1360 "parser.y" { yyerrmsg = "command line expected"; ; break;} -case 131: -#line 1325 "parser.y" +case 137: +#line 1365 "parser.y" { yyerrmsg = "file name expected"; ; break;} -case 132: -#line 1330 "parser.y" +case 138: +#line 1370 "parser.y" { yyerrmsg = "service name (identifier) expected"; ; break;} -case 133: -#line 1335 "parser.y" +case 139: +#line 1375 "parser.y" { yyerrmsg = "backend name (identifier) expected"; ; break;} -case 134: -#line 1340 "parser.y" +case 140: +#line 1380 "parser.y" { yyerrmsg = "IP address such as 1.2.3.4 or 'any' expected"; ; break;} -case 135: -#line 1345 "parser.y" +case 141: +#line 1385 "parser.y" { yyerrmsg = "Service type expected ('any', 'stickyhttp', ...)"; ; break;} -case 136: -#line 1350 "parser.y" +case 142: +#line 1390 "parser.y" { yyerrmsg = "Header inspection mode mode expected ('shallow' or 'deep')"; ; break;} -case 137: -#line 1355 "parser.y" +case 143: +#line 1395 "parser.y" { yyerrmsg = "IP filter(s) expected"; ; break;} -case 138: -#line 1360 "parser.y" +case 144: +#line 1400 "parser.y" { yyerrmsg = "username expected"; ; break;} +case 145: +#line 1405 "parser.y" +{ + yyerrmsg = "state definition expected"; +; + break;} } #line 705 "/sw/share/bison/bison.simple" @@ -2662,4 +2724,4 @@ yyreturn: #endif return yyresult; } -#line 1364 "parser.y" +#line 1409 "parser.y" diff --git a/src/lib/parser.h b/src/lib/parser.h @@ -58,6 +58,10 @@ # define DEEP 307 # define SHALLOW 308 # define CHECKINTERVAL 309 +# define STATE 310 +# define AVAILABLE 311 +# define UNAVAILABLE 312 +# define DOWN 313 extern YYSTYPE yylval; diff --git a/src/lib/parser.y b/src/lib/parser.y @@ -138,7 +138,7 @@ static void setuseraccount (char *username) { ADDSERVERHEADER SETSERVERHEADER APPENDSERVERHEADER ALLOWFROM DENYFROM ALLOWFILE DENYFILE EXTERNALHANDLER ONEND USERACCOUNT BYCLIENTIP RETRIES HEADERINSPECTION DEEP SHALLOW - CHECKINTERVAL + CHECKINTERVAL STATE AVAILABLE UNAVAILABLE DOWN %% /* Config file grammar rules */ @@ -335,12 +335,12 @@ servicebody: switch ($1.set[i].cf) { case cf_portspec: pimsg ("backend block port:", $1.set[i].v.ival); - cur_backend.port = $1.set[i].v.ival; + cur_backend.initial_port = $1.set[i].v.ival; break; case cf_serverspec: psmsg ("backend block server:", $1.set[i].v.sval); - cur_backend.server = serverpart ($1.set[i].v.sval); - cur_backend.port = portpart ($1.set[i].v.sval); + cur_backend.initial_server = serverpart ($1.set[i].v.sval); + cur_backend.initial_port = portpart ($1.set[i].v.sval); free ($1.set[i].v.sval); break; case cf_verbosityspec: @@ -458,6 +458,10 @@ servicebody: pimsg ("backend retries:", $1.set[i].v.ival); cur_backend.retries = $1.set[i].v.ival; break; + case cf_statespec: + pimsg ("backend initial state:", $1.set[i].v.ival); + cur_backend.initial_avail = $1.set[i].v.ival; + break; default: error ("Internal jam, unhandled type %d " "in backend specification", @@ -468,7 +472,7 @@ servicebody: /* Verify the backend block, supply defaults, * And so on. */ - if (!cur_backend.port) + if (!cur_backend.initial_port) error ("Service %s: back end %s lacks port", cur_service.name, cur_backend.name); if (cur_backend.weight < 1) @@ -1030,6 +1034,11 @@ backendstatement: pimsg ("backend retries:", $1.set[0].v.ival); $$ = $1; } +| + initialstatestatement { + pimsg ("backend state:", $1.set[0].v.ival); + $$ = $1; + } ; serverstatement: @@ -1087,6 +1096,37 @@ retriesstatement: } ; +initialstatestatement: + STATE + statedef + semicol { + pimsg ("state:", lastnr); + $$.n = 1; + $$.set = xmalloc (sizeof(Confset)); + $$.set[0].cf = cf_statespec; + $$.set[0].v.ival = lastnr; + } +; + +statedef: + statedef_expected + somestate +; + +somestate: + AVAILABLE { + lastnr = st_available; + } +| + UNAVAILABLE { + lastnr = st_unavailable; + } +| + DOWN { + lastnr = st_down; + } +; + onstartstatement: ONSTART commandline @@ -1361,3 +1401,8 @@ useraccount_expected: { yyerrmsg = "username expected"; } ; + +statedef_expected: { + yyerrmsg = "state definition expected"; +} +; diff --git a/src/lib/parserclose.c b/src/lib/parserclose.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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/parserrun.c b/src/lib/parserrun.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -18,6 +18,7 @@ void show_config () { "MAINTAINEREMAIL e-mail of maintainer: %s\n" "DEFAULT_CONF default configuration file: %s\n" "MAX_BACKEND max nr. of backends in service: %d\n" + "FQDN_LENGTH max length of a hostname %d\n" "SLEEP_TIME service inactivy pause: %d\n" "DEF_MAX max nr of defines in a file %d\n" "DNS_CACHESIZE size of the DNS cache: %d\n" @@ -35,7 +36,7 @@ void show_config () { , VER, REVVER, YEARS, AUTHORNAME, MAINTAINERNAME, MAINTAINEREMAIL, - DEFAULT_CONF, MAX_BACKEND, SLEEP_TIME, DEF_MAX, + DEFAULT_CONF, MAX_BACKEND, FQDN_LENGTH, SLEEP_TIME, DEF_MAX, DNS_CACHESIZE, DNS_CACHETTL, CONNECT_TIMEOUT, RETRY_WAIT, DEFAULT_TCP_BUFSZ, PREFIX, BINDIR, DEFAULT_SPT_BUFSIZE, SPT_BUFSIZE, diff --git a/src/lib/showservices.c b/src/lib/showservices.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -18,8 +18,8 @@ int show_services (int ac, char **av) { for (j = 0; j < service[i].nbackend; j++) printf (" Backend %s (%s:%d)\n", service[i].backend[j].name, - service[i].backend[j].server, - service[i].backend[j].port); + service[i].backend[j].initial_server, + service[i].backend[j].initial_port); } return (1); } diff --git a/src/lib/showstatus.c b/src/lib/showstatus.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -101,7 +101,7 @@ int show_status (int ac, char **av) { 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)); + state_to_string(servicereport->backendstate[j].actual_avail)); else if (xml_status) { printf (" <backend id=\"%d\" name=\"%s\">\n" " <availability id=\"%d\">%s</availability>\n" @@ -111,8 +111,9 @@ int show_status (int ac, char **av) { " <duration sec=\"%g\">%s</duration>\n" " <throughput bytes=\"%g\">%s</throughput>\n", j, service[i].backend[j].name, - servicereport->backendstate[j].avail, - state_to_string(servicereport->backendstate[j].avail), + servicereport->backendstate[j].actual_avail, + state_to_string( + servicereport->backendstate[j].actual_avail), servicereport->backendstate[j].nclients, servicereport->backendstate[j].failures, servicereport->backendstate[j].totuses, @@ -120,8 +121,12 @@ 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)); + printf (" <lastaccess sec=\"%u\">%s</lastaccess>\n" + " <server>%s</server>\n" + " <port>%d</port>\n", + sec_ago, timestr( (double) sec_ago), + servicereport->backendstate[j].actual_server, + servicereport->backendstate[j].actual_port); if (service[i].type == type_http) printf (" <sessions>%lu</sessions>\n", servicereport->backendstate[j].sessions); @@ -132,7 +137,8 @@ int show_status (int ac, char **av) { " Stats : %lu failures out of %lu connections", j, service[i].backend[j].name, - state_to_string (servicereport->backendstate[j].avail), + state_to_string ( + servicereport->backendstate[j].actual_avail), servicereport->backendstate[j].nclients, servicereport->backendstate[j].failures, servicereport->backendstate[j].totuses); @@ -147,8 +153,11 @@ 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'); + printf (", last hit %s ago\n" + " address %s:%d\n", + timestr ( (double) sec_ago), + servicereport->backendstate[j].actual_server, + servicereport->backendstate[j].actual_port); } } diff --git a/src/lib/stagetostring.c b/src/lib/stagetostring.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -45,7 +45,7 @@ char *fmt_expand (char const *s, int *skip, int target_backend) { case 'h': if (target_backend < 0 || target_backend >= activeservice->nbackend) return ("noname"); - return (activeservice->backend[target_backend].server); + return (servicereport->backendstate[target_backend].actual_server); case 'n': if (target_backend >= 0 && target_backend < activeservice->nbackend) { @@ -60,7 +60,7 @@ char *fmt_expand (char const *s, int *skip, int target_backend) { if (target_backend < 0 || target_backend >= activeservice->nbackend) return ("0"); snprintf (buf, sizeof(buf), "%d", - activeservice->backend[target_backend].port); + servicereport->backendstate[target_backend].actual_port); return (buf); case 'r': diff --git a/src/lib/stringtostate.c b/src/lib/stringtostate.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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/strupr.c b/src/lib/strupr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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/tcpserve.c b/src/lib/tcpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -39,10 +39,27 @@ void tcpserve (int server_sock) { activeservice->check_interval); } } - + + /* Promote all config-side "initial" settings to "actual" ones. */ + for (i = 0; i < activeservice->nbackend; i++) { + msg ("Service %s: Initial availability of back end %s: %s, " + "initial server:port: %s:%d", + activeservice->name, activeservice->backend[i].name, + state_to_string(activeservice->backend[i].initial_avail), + activeservice->backend[i].initial_server, + activeservice->backend[i].initial_port); + servicereport->backendstate[i].actual_avail = + activeservice->backend[i].initial_avail; + servicereport->backendstate[i].actual_port = + activeservice->backend[i].initial_port; + strncpy (servicereport->backendstate[i].actual_server, + activeservice->backend[i].initial_server, + FQDN_LENGTH - 1); + } + + /* Start the listener. */ msg ("Service %s: awaiting activity on port %d (socket fd %d)", activeservice->name, activeservice->port, server_sock); - if (listen (server_sock, activeservice->backlog + 1) < 0) error ("Service %s: failed to listen to server_socket: %s", activeservice->name, strerror(errno)); @@ -144,14 +161,15 @@ void tcpserve (int server_sock) { * In the loop we may need to decide to return after all. */ msg ("Service %s: trying back end %s, port %d", activeservice->name, - activeservice->backend[current_backend].server, - activeservice->backend[current_backend].port); + servicereport->backendstate[current_backend].actual_server, + servicereport->backendstate[current_backend].actual_port); if ( (backend_sock = backend_connect()) < 0 ) { - warning ("Service %s: failed to connect to server %s:%d " - "(ret %d)", activeservice->name, - activeservice->backend[current_backend].server, - activeservice->backend[current_backend].port, - backend_sock); + warning ( + "Service %s: failed to connect to server %s:%d " + "(ret %d)", activeservice->name, + servicereport->backendstate[current_backend].actual_server, + servicereport->backendstate[current_backend].actual_port, + backend_sock); continue; } diff --git a/src/lib/tellservice.c b/src/lib/tellservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -10,7 +10,8 @@ int tell_service (int ac, char **av) { Service *target_service = 0; int target_backend = -1, i; Backendavail avail; - + int newstate, port; + char *hostname, *cp; /* Locate service */ for (i = 0; i < nservice; i++) @@ -32,19 +33,41 @@ int tell_service (int ac, char **av) { error ("Backend '%s' of service '%s' isn't known. " "Maybe the configuration has changed?", av[1], av[0]); - /* Locate new state: either the direct number, or alpha name */ - if (sscanf (av[2], "%d", &avail) > 0) { - if (avail < st_available || avail > st_unknown) - error ("Bad state number '%s'", av[2]); - } else if ( (avail = string_to_state (av[2])) == st_unknown ) - error ("Incorrect state '%s'.", av[2]); + /* Let's see what we need to tell the back end of that service. */ + if (!strcmp (av[2], "state")) { + /* Locate new state: either the direct number, or alpha name */ + if (sscanf (av[3], "%d", &newstate) > 0) { + avail = (Backendavail) newstate; + if (avail > st_unknown) + error ("Bad state number '%s'", av[3]); + } else if ( (avail = string_to_state (av[3])) == st_unknown ) + error ("Incorrect state '%s'.", av[3]); - /* Got all data. Poke the new state into shared memory. */ - alloc_reporter (target_service, 0); - servicereport->backendstate[target_backend].avail = avail; - servicereport->backendstate[target_backend].fail = 0; - msg ("Marked backend %s of service %s as %s.", - av[1], av[0], state_to_string (avail)); + /* Got all data. Poke the new state into shared memory. */ + alloc_reporter (target_service, 0); + servicereport->backendstate[target_backend].actual_avail = avail; + servicereport->backendstate[target_backend].fail = 0; + msg ("Marked backend %s of service %s as %s.", + av[1], av[0], state_to_string (avail)); + } else if (!strcmp (av[2], "server")) { + /* Get the hostname and port part. */ + hostname = av[3]; + if (! (cp = strchr (hostname, ':')) ) + error ("Bad address '%s' (hostname:port expected)", av[3]); + *cp = 0; + if (sscanf (cp + 1, "%d", &port) < 1) + error ("Bad port part in address"); + /* Got all data. Poke the new state into shared memory. */ + alloc_reporter (target_service, 0); + strncpy (servicereport->backendstate[target_backend].actual_server, + hostname, FQDN_LENGTH - 1); + servicereport->backendstate[target_backend].actual_port = port; + msg ("Address for backend %s of service %s set to %s:%d.", + av[1], av[0], hostname, port); + } else { + usage(); + } + /* All done.. success */ return (1); } diff --git a/src/lib/thruputlog.c b/src/lib/thruputlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.txt b/src/lib/usage.txt @@ -10,10 +10,13 @@ Usage: and their status, optionally of stated service and/or back end crossroads [flags] stop: stop all services crossroads [flags] restart: stop and then start - crossroads [flags] tell SERVICE BACKEND STATE: mark the named - BACKEND of the SERVICE with the STATE ('available/up', 'unavailable' - or 'down'). Use the action 'services' to determine SERVICE and - BACKEND names. + crossroads [flags] tell SERVICE BACKEND ACTION ARGS + Backend BACKEND of service SERVICE is controlled. The ACTION + and ARGS can be: + 'state' NEWSTATE: Sets the state of the back end. The NEWSTATE + must be 'available'/'up', 'unavailable', or 'down'. + 'server' ADDRESS: Sets the back end address, which must be a + hostname, colon, and a port. ** Configuration related: ** crossroads [flags] configtest: verify that the config is OK crossroads [flags] services: show the configured services diff --git a/src/lib/vsyslog.c b/src/lib/vsyslog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -34,7 +34,7 @@ void wakeup_handler () { /* 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; + prev = servicereport->backendstate[current_backend].actual_avail; if ( (prev == st_down) || (activeservice->rev_interval && prev != st_unavailable) ) continue; @@ -48,7 +48,8 @@ void wakeup_handler () { /* Mark state as WAKING */ lock_reporter(); - servicereport->backendstate[current_backend].avail = st_waking; + servicereport->backendstate[current_backend].actual_avail = + st_waking; unlock_reporter(); if (! activeservice->check_cmd) { @@ -81,7 +82,7 @@ void wakeup_handler () { /* 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 = av; + servicereport->backendstate[current_backend].actual_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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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.48, a load balancer and fail over + * This file is part of Crosroads 1.50, 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/bad16.conf b/test/bad16.conf @@ -0,0 +1,44 @@ +/* bad state def */ + +#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=/"; + state blabla; + } +} diff --git a/test/t13.conf b/test/t13.conf @@ -0,0 +1,43 @@ +#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=/"; + state down; + } + + backend b { + server BACKENDSERVER:BACKPORT; + port BACKPORT; + weight 2; + decay 5; + stickycookie BalancerID=Backend_B; + addclientheader "Set-Cookie: BalancerID=Backend_B; Path=/"; + state unavailable; + } + + backend c { + server BACKENDSERVER; + port BACKPORT; + weight 3; + decay 5; + stickycookie BalancerID=Backend_C; + addclientheader "Set-Cookie: BalancerID=Backend_C; Path=/"; + } +}