commit ed5aff209cd74f74335a8cbfd8cf3a682c0aab27 parent 360b87cfcd91506f703ec72a1de668f0a5d82541 Author: finwo <finwo@pm.me> Date: Sat, 3 Jan 2026 19:34:45 +0100 1.79 Diffstat:
155 files changed, 3997 insertions(+), 2915 deletions(-)
diff --git a/ChangeLog b/ChangeLog @@ -2,6 +2,19 @@ ChangeLog for Crossroads ------------------------------------------------------------------------------ +1.79 [KK 2008-04-01] + - Changed 'make' in '$(MAKE)' in all Makefiles to support 'gmake' + invocations. + - Added debugging to config_write() (Solaris problems) + - Changed limits_msg() to avoid RLIMIT_MEMLOCK, RLIMIT_NPROC, + RLIMIT_RSS on systems that don't have these (Solaris problems) + - Rewrote Messaging functions msg(), error(), warning() to + autosupply the service name. + - The configuration file is now searched relative to the program, + then as /etc/crossroads.conf. So if eg. the program is + /opt/crossroads/bin/crossroads, then the config may be + /opt/crossroads/etc/crossroads.conf. + 1.78 [KK 2008-03-14] - Limits of running service are shown when verbosity is on. - Fixed "no child processes" error when doing system() calls diff --git a/Makefile b/Makefile @@ -53,7 +53,7 @@ dist: documentation $(BASE)/tools/makedist $(VER) commit: clean headers documentation local - make clean + BASE=$(BASE) $(MAKE) clean BASE=$(BASE) etc/svncheck svn commit svn commit -m 'Revision number update' $(BASE)/etc/svnrev.txt diff --git a/doc/Makefile b/doc/Makefile @@ -22,7 +22,6 @@ main/keywords.yo: $(BASE)/src/lib/parser.y defs: echo 'redef(VER)(1)($(VER))' > crossroads-defs.yo echo 'redef(YEARS)(1)($(YEARS))' >> crossroads-defs.yo - echo 'redef(DEFAULTCONF)(1)($(DEFAULT_CONF))' >> crossroads-defs.yo echo 'redef(AUTHORNAME)(1)($(AUTHORNAME))' >> crossroads-defs.yo echo 'redef(DNSCACHETTL)(1)($(DNS_CACHETTL))' >> crossroads-defs.yo echo 'redef(MAINTAINERNAME)(1)($(MAINTAINERNAME))' \ diff --git a/doc/crossroads-mgr.1 b/doc/crossroads-mgr.1 @@ -26,9 +26,9 @@ View the states of back ends, and their usage; Set the states of back ends (e\&.g\&., to take a back end out of service)\&. .PP -The web interface cannot be used to configure Crossroads (e\&.g\&., to +The web interface cannot be used to fully configure Crossroads (e\&.g\&., to add new back ends)\&. This must be done via the configuration file -\fB/etc/crossroads\&.conf\fP\&. Note furthermore that \fBcrossroads status\fP and +\fBcrossroads\&.conf\fP\&. Note furthermore that \fBcrossroads status\fP and \fBcrossroads tell\fP are commandline tools that achieve the same functionality as \fBcrossroads-mgr\fP\&. .PP diff --git a/doc/crossroads.1 b/doc/crossroads.1 @@ -71,7 +71,12 @@ footprint\&. Usually the default value will do fine\&. .IP .IP o \fB-c\fP \fIconfig\fP: Uses \fIconfig\fP as the configuration -file\&. The default is \fB/etc/crossroads\&.conf\fP\&. +file\&. The default is \fB/some/path/etc/crossroads\&.conf\fP +or \fB/etc/crossroads\&.conf\fP\&. The first alternative +applies when Crossroads is installed as +\fB/some/path/bin/crossroads\fP; in that case, Crossroads +tries to find its configuration by trying an \&'etc\&' +diretory \&'near\&' its own path\&. .IP .IP o \fB-d\fP \fIsec\fP: Sets the DNS cache time-to-live to @@ -115,7 +120,7 @@ using \fBverbosity\fP statements in the configuration\&.) \fB-?\fP: Shows an overview of the usage\&. .PP .SH "FILES" -\fB/etc/crossroads\&.conf\fP, the default configuration file +\fBcrossroads\&.conf\fP, the default configuration file .PP .SH "SEE ALSO" .IP o diff --git a/doc/crossroads.conf.7 b/doc/crossroads.conf.7 @@ -4,13 +4,24 @@ crossroads\&.conf \- Crossroads configuration .PP .SH "SYNOPSIS" -This manpage describes the configuration of Crossroads, normally the -file \fB/etc/crossroads\&.conf\fP\&. Crossroads can however be started with a flag -\fB-c\fP to overrule this name\&. +This manpage describes the configuration of +Crossroads, usually the file \fBcrossroads\&.conf\fP\&. This file is often +located in an \&'etc\&' directory near the path where Crossroads is +installed\&. E\&.g\&., when Crossroads is installed as +\fB/usr/local/bin/crossroads\fP, then the configuration file can be +\f(CW/usr/local/etc/crossroads\&.conf\fP\&. Alternatively the configuration +can always be put in \fB/etc/crossroads\&.conf\fP\&. Crossroads can however +be started with a flag \fB-c\fP to specify an entirely different name\&.\&. .PP .SH "DESCRIPTION" + + + The configuration that crossroads uses is normally stored in the file -/etc/crossroads\&.conf\&. This location can be overruled using the +\f(CWcrossroads\&.conf\fP, either in an \&'etc\&' directory near the binary, or +in \f(CW/etc/\fP\&. See section ?? for details\&. +.PP +The name of the configuration file can be overruled using the command line flag \f(CW-c\fP\&. .PP This section explains the syntax of the configuration file, and what @@ -608,7 +619,7 @@ directives that are relevant: \f(CWallowfrom\fP, \f(CWallowfile\fP, .IP When using \f(CWallowfrom\fP and \f(CWdenyfrom\fP then the IP addresses to allow or deny connections are -stated in /etc/crossroads\&.conf\&. When using \f(CWallowfile\fP and +stated in the configuration\&. When using \f(CWallowfile\fP and \f(CWdenyfile\fP the allow or deny connections are stated in a separate file\&. .IP @@ -624,7 +635,7 @@ list of filter specifications\&. The statements \f(CWallowfile\fP and filter specifications from those external files\&. In both cases, Crossroads obtains filter specifications and places them in its lists of allowed or denied IP addresses\&. The difference between -specifying filters in /etc/crossroads\&.conf or in external +specifying filters in the configuration file or in external files, is that Crossroads will reload the external files when it receives signal 1 (\f(CWSIGHUP\fP), as in \f(CWkillall -1 crossroads\fP\&. .IP @@ -1338,4 +1349,4 @@ format, distributed with the sources\&. .SH "AUTHOR" Crossroads is written by Karel Kubat and is maintained by - Karel Kubat (karel@kubat\&.nl)\&. -\ No newline at end of file + Karel Kubat (karel@kubat\&.nl)\&. 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.78</title> +<title>Crossroads 1.79</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.78</h1> +<h1>Crossroads 1.79</h1> <h2>Karel Kubat <br> Maintained by Karel Kubat (karel@kubat.nl)</h2> @@ -36,148 +36,149 @@ <dt><a href="#l5">1.4: Terminology</a></dt> <dt><a href="#l6">1.5: Porting Issues</a></dt> <dl> -<dt><a href="#l7">1.5.1: Porting issues for pre-1.63 installations</a></dt> -<dt><a href="#l8">1.5.2: Porting issues for pre-1.50 installations</a></dt> -<dt><a href="#l9">1.5.3: Porting issues for pre-1.43 installations</a></dt> -<dt><a href="#l10">1.5.4: Porting issues for pre-1.21 installations</a></dt> -<dt><a href="#l11">1.5.5: Porting issues for pre-0.26 installations</a></dt> -<dt><a href="#l12">1.5.6: Porting issues for pre-1.08 installations</a></dt> +<dt><a href="#l7">1.5.1: Porting issues for pre-1.80 installations</a></dt> +<dt><a href="#l8">1.5.2: Porting issues for pre-1.63 installations</a></dt> +<dt><a href="#l9">1.5.3: Porting issues for pre-1.50 installations</a></dt> +<dt><a href="#l10">1.5.4: Porting issues for pre-1.43 installations</a></dt> +<dt><a href="#l11">1.5.5: Porting issues for pre-1.21 installations</a></dt> +<dt><a href="#l12">1.5.6: Porting issues for pre-0.26 installations</a></dt> +<dt><a href="#l13">1.5.7: Porting issues for pre-1.08 installations</a></dt> </dl> </dl> -<dt><h3><a href="#l13">2: Installation for the impatient</a></h3></dt> -<dt><h3><a href="#l14">3: Using Crossroads</a></h3></dt> +<dt><h3><a href="#l14">2: Installation for the impatient</a></h3></dt> +<dt><h3><a href="#l15">3: Using Crossroads</a></h3></dt> <dl> -<dt><a href="#l15">3.1: The Balancer: crossroads</a></dt> +<dt><a href="#l16">3.1: The Balancer: crossroads</a></dt> <dl> -<dt><a href="#l16">3.1.1: General Commandline Syntax</a></dt> -<dt><a href="#l17">3.1.2: Status Reporting from the Command Line</a></dt> -<dt><a href="#l18">3.1.3: Logging-related options</a></dt> -<dt><a href="#l19">3.1.4: Reloading Configurations</a></dt> +<dt><a href="#l17">3.1.1: General Commandline Syntax</a></dt> +<dt><a href="#l18">3.1.2: Status Reporting from the Command Line</a></dt> +<dt><a href="#l19">3.1.3: Logging-related options</a></dt> +<dt><a href="#l20">3.1.4: Reloading Configurations</a></dt> </dl> -<dt><a href="#l20">3.2: The Web Frontend: crossroads-mgr</a></dt> +<dt><a href="#l21">3.2: The Web Frontend: crossroads-mgr</a></dt> </dl> -<dt><h3><a href="#l21">4: The configuration</a></h3></dt> +<dt><h3><a href="#l22">4: The configuration</a></h3></dt> <dl> -<dt><a href="#l22">4.1: General language elements</a></dt> +<dt><a href="#l23">4.1: General language elements</a></dt> <dl> -<dt><a href="#l23">4.1.1: Empty lines, indentation and comments</a></dt> -<dt><a href="#l24">4.1.2: Preprocessor directives</a></dt> -<dt><a href="#l25">4.1.3: Keywords, numbers, identifiers, generic strings</a></dt> +<dt><a href="#l24">4.1.1: Empty lines, indentation and comments</a></dt> +<dt><a href="#l25">4.1.2: Preprocessor directives</a></dt> +<dt><a href="#l26">4.1.3: Keywords, numbers, identifiers, generic strings</a></dt> </dl> -<dt><a href="#l26">4.2: Daemon options</a></dt> -<dt><a href="#l27">4.3: Service definitions</a></dt> +<dt><a href="#l27">4.2: Daemon options</a></dt> +<dt><a href="#l28">4.3: Service definitions</a></dt> <dl> -<dt><a href="#l28">4.3.1: port - Specifying the listen port</a></dt> -<dt><a href="#l29">4.3.2: type - Defining the service type</a></dt> -<dt><a href="#l30">4.3.3: headerinspection - are all HTTP headers inspected</a></dt> -<dt><a href="#l31">4.3.4: bindto - Binding to a specific IP address</a></dt> -<dt><a href="#l32">4.3.5: verbosity - Controlling debug output</a></dt> -<dt><a href="#l33">4.3.6: dispatchmode - How are back ends selected</a></dt> -<dt><a href="#l34">4.3.7: revivinginterval - Back end wakeup calls</a></dt> -<dt><a href="#l35">4.3.8: checkinterval - Periodic back end checks</a></dt> -<dt><a href="#l36">4.3.9: maxconnections - Limiting concurrent clients at service level</a></dt> -<dt><a href="#l37">4.3.10: backlog - The TCP Back Log size</a></dt> -<dt><a href="#l38">4.3.11: shmkey - Shared Memory Access</a></dt> -<dt><a href="#l39">4.3.12: allow* and deny* - Allowing or denying connections</a></dt> -<dt><a href="#l40">4.3.13: useraccount - Limiting the effective ID of external processes</a></dt> +<dt><a href="#l29">4.3.1: port - Specifying the listen port</a></dt> +<dt><a href="#l30">4.3.2: type - Defining the service type</a></dt> +<dt><a href="#l31">4.3.3: headerinspection - are all HTTP headers inspected</a></dt> +<dt><a href="#l32">4.3.4: bindto - Binding to a specific IP address</a></dt> +<dt><a href="#l33">4.3.5: verbosity - Controlling debug output</a></dt> +<dt><a href="#l34">4.3.6: dispatchmode - How are back ends selected</a></dt> +<dt><a href="#l35">4.3.7: revivinginterval - Back end wakeup calls</a></dt> +<dt><a href="#l36">4.3.8: checkinterval - Periodic back end checks</a></dt> +<dt><a href="#l37">4.3.9: maxconnections - Limiting concurrent clients at service level</a></dt> +<dt><a href="#l38">4.3.10: backlog - The TCP Back Log size</a></dt> +<dt><a href="#l39">4.3.11: shmkey - Shared Memory Access</a></dt> +<dt><a href="#l40">4.3.12: allow* and deny* - Allowing or denying connections</a></dt> +<dt><a href="#l41">4.3.13: useraccount - Limiting the effective ID of external processes</a></dt> </dl> -<dt><a href="#l41">4.4: Backend definitions</a></dt> +<dt><a href="#l42">4.4: Backend definitions</a></dt> <dl> -<dt><a href="#l42">4.4.1: server - Specifying the back end address</a></dt> -<dt><a href="#l43">4.4.2: port - Specifying a back end port</a></dt> -<dt><a href="#l44">4.4.3: verbosity - Controlling verbosity at the back end level</a></dt> -<dt><a href="#l45">4.4.4: retries - Specifying allowed failures</a></dt> -<dt><a href="#l46">4.4.5: maxconnections - Limiting the connections to a back end</a></dt> -<dt><a href="#l47">4.4.6: weight - When a back end is more equal than others</a></dt> -<dt><a href="#l48">4.4.7: decay - Levelling out activity of a back end</a></dt> -<dt><a href="#l49">4.4.8: state - Setting an initial back end state</a></dt> -<dt><a href="#l50">4.4.9: onstart, onend, onfail - Action Hooks</a></dt> -<dt><a href="#l51">4.4.10: trafficlog and throughputlog - Debugging and Performance Aids</a></dt> -<dt><a href="#l52">4.4.11: httptiminglog - Timing debugging in HTTP mode</a></dt> -<dt><a href="#l53">4.4.12: stickycookie - Back end selection with an HTTP cookie</a></dt> -<dt><a href="#l54">4.4.13: HTTP Header Modification Directives</a></dt> +<dt><a href="#l43">4.4.1: server - Specifying the back end address</a></dt> +<dt><a href="#l44">4.4.2: port - Specifying a back end port</a></dt> +<dt><a href="#l45">4.4.3: verbosity - Controlling verbosity at the back end level</a></dt> +<dt><a href="#l46">4.4.4: retries - Specifying allowed failures</a></dt> +<dt><a href="#l47">4.4.5: maxconnections - Limiting the connections to a back end</a></dt> +<dt><a href="#l48">4.4.6: weight - When a back end is more equal than others</a></dt> +<dt><a href="#l49">4.4.7: decay - Levelling out activity of a back end</a></dt> +<dt><a href="#l50">4.4.8: state - Setting an initial back end state</a></dt> +<dt><a href="#l51">4.4.9: onstart, onend, onfail - Action Hooks</a></dt> +<dt><a href="#l52">4.4.10: trafficlog and throughputlog - Debugging and Performance Aids</a></dt> +<dt><a href="#l53">4.4.11: httptiminglog - Timing debugging in HTTP mode</a></dt> +<dt><a href="#l54">4.4.12: stickycookie - Back end selection with an HTTP cookie</a></dt> +<dt><a href="#l55">4.4.13: HTTP Header Modification Directives</a></dt> </dl> </dl> -<dt><h3><a href="#l55">5: Tips, Tricks and Random Remarks</a></h3></dt> +<dt><h3><a href="#l56">5: Tips, Tricks and Random Remarks</a></h3></dt> <dl> -<dt><a href="#l56">5.1: Configuration examples</a></dt> +<dt><a href="#l57">5.1: Configuration examples</a></dt> <dl> -<dt><a href="#l57">5.1.1: A load balancer for three webserver back ends</a></dt> -<dt><a href="#l58">5.1.2: An HTTP forwarder when travelling</a></dt> -<dt><a href="#l59">5.1.3: SSH login with enforced idle logout</a></dt> +<dt><a href="#l58">5.1.1: A load balancer for three webserver back ends</a></dt> +<dt><a href="#l59">5.1.2: An HTTP forwarder when travelling</a></dt> +<dt><a href="#l60">5.1.3: SSH login with enforced idle logout</a></dt> </dl> -<dt><a href="#l60">5.2: How back ends are selected in load balancing</a></dt> +<dt><a href="#l61">5.2: How back ends are selected in load balancing</a></dt> <dl> -<dt><a href="#l61">5.2.1: Bysize, byduration or byconnections?</a></dt> -<dt><a href="#l62">5.2.2: Averaging size and duration</a></dt> -<dt><a href="#l63">5.2.3: Specifying decays</a></dt> -<dt><a href="#l64">5.2.4: Adjusting the weights</a></dt> +<dt><a href="#l62">5.2.1: Bysize, byduration or byconnections?</a></dt> +<dt><a href="#l63">5.2.2: Averaging size and duration</a></dt> +<dt><a href="#l64">5.2.3: Specifying decays</a></dt> +<dt><a href="#l65">5.2.4: Adjusting the weights</a></dt> </dl> -<dt><a href="#l65">5.3: Periodic probes and wake up calls</a></dt> +<dt><a href="#l66">5.3: Periodic probes and wake up calls</a></dt> <dl> -<dt><a href="#l66">5.3.1: Syntax</a></dt> -<dt><a href="#l67">5.3.2: Security Considerations</a></dt> -<dt><a href="#l68">5.3.3: An example</a></dt> +<dt><a href="#l67">5.3.1: Syntax</a></dt> +<dt><a href="#l68">5.3.2: Security Considerations</a></dt> +<dt><a href="#l69">5.3.3: An example</a></dt> </dl> -<dt><a href="#l69">5.4: Throttling the number of concurrent connections</a></dt> -<dt><a href="#l70">5.5: TCP Session Stickiness</a></dt> -<dt><a href="#l71">5.6: HTTP Session Stickiness</a></dt> +<dt><a href="#l70">5.4: Throttling the number of concurrent connections</a></dt> +<dt><a href="#l71">5.5: TCP Session Stickiness</a></dt> +<dt><a href="#l72">5.6: HTTP Session Stickiness</a></dt> <dl> -<dt><a href="#l72">5.6.1: Don't use stickiness!</a></dt> -<dt><a href="#l73">5.6.2: But if you must..</a></dt> +<dt><a href="#l73">5.6.1: Don't use stickiness!</a></dt> +<dt><a href="#l74">5.6.2: But if you must..</a></dt> </dl> -<dt><a href="#l74">5.7: Passing the client's IP address</a></dt> +<dt><a href="#l75">5.7: Passing the client's IP address</a></dt> <dl> -<dt><a href="#l75">5.7.1: Sample Crossroads configuration</a></dt> -<dt><a href="#l76">5.7.2: Sample Apache configuration</a></dt> +<dt><a href="#l76">5.7.1: Sample Crossroads configuration</a></dt> +<dt><a href="#l77">5.7.2: Sample Apache configuration</a></dt> </dl> -<dt><a href="#l77">5.8: Deep or shallow HTTP header inspection</a></dt> -<dt><a href="#l78">5.9: Debugging network traffic</a></dt> -<dt><a href="#l79">5.10: IP filtering: Limiting Access by Client IP Address</a></dt> +<dt><a href="#l78">5.8: Deep or shallow HTTP header inspection</a></dt> +<dt><a href="#l79">5.9: Debugging network traffic</a></dt> +<dt><a href="#l80">5.10: IP filtering: Limiting Access by Client IP Address</a></dt> <dl> -<dt><a href="#l80">5.10.1: General Examples</a></dt> -<dt><a href="#l81">5.10.2: Using External Files</a></dt> -<dt><a href="#l82">5.10.3: Mixing Directives</a></dt> +<dt><a href="#l81">5.10.1: General Examples</a></dt> +<dt><a href="#l82">5.10.2: Using External Files</a></dt> +<dt><a href="#l83">5.10.3: Mixing Directives</a></dt> </dl> -<dt><a href="#l83">5.11: Using an external program to dispatch</a></dt> +<dt><a href="#l84">5.11: Using an external program to dispatch</a></dt> <dl> -<dt><a href="#l84">5.11.1: Configuring the external handler</a></dt> -<dt><a href="#l85">5.11.2: Writing the external handler</a></dt> -<dt><a href="#l86">5.11.3: Examples of external handlers</a></dt> +<dt><a href="#l85">5.11.1: Configuring the external handler</a></dt> +<dt><a href="#l86">5.11.2: Writing the external handler</a></dt> +<dt><a href="#l87">5.11.3: Examples of external handlers</a></dt> </dl> -<dt><a href="#l87">5.12: Linux and ip_conntrack_max</a></dt> -<dt><a href="#l88">5.13: Marking back ends as bad after more than one try</a></dt> -<dt><a href="#l89">5.14: Using the Web Interface crossroads-mgr</a></dt> +<dt><a href="#l88">5.12: Linux and ip_conntrack_max</a></dt> +<dt><a href="#l89">5.13: Marking back ends as bad after more than one try</a></dt> +<dt><a href="#l90">5.14: Using the Web Interface crossroads-mgr</a></dt> <dl> -<dt><a href="#l90">5.14.1: Starting crossroads-mgr</a></dt> +<dt><a href="#l91">5.14.1: Starting crossroads-mgr</a></dt> </dl> -<dt><a href="#l91">5.15: Rendering Crossroads' status in a web page</a></dt> -<dt><a href="#l92">5.16: Crossroads and DNS caching</a></dt> -<dt><a href="#l93">5.17: Managing a Pool of Virtual Back Ends</a></dt> +<dt><a href="#l92">5.15: Rendering Crossroads' status in a web page</a></dt> +<dt><a href="#l93">5.16: Crossroads and DNS caching</a></dt> +<dt><a href="#l94">5.17: Managing a Pool of Virtual Back Ends</a></dt> </dl> -<dt><h3><a href="#l94">6: Benchmarking</a></h3></dt> +<dt><h3><a href="#l95">6: Benchmarking</a></h3></dt> <dl> -<dt><a href="#l95">6.1: Benchmark 1: Accessing a proxy via crossroads or directly</a></dt> +<dt><a href="#l96">6.1: Benchmark 1: Accessing a proxy via crossroads or directly</a></dt> <dl> -<dt><a href="#l96">6.1.1: Results</a></dt> -<dt><a href="#l97">6.1.2: Discussion</a></dt> +<dt><a href="#l97">6.1.1: Results</a></dt> +<dt><a href="#l98">6.1.2: Discussion</a></dt> </dl> -<dt><a href="#l98">6.2: Benchmark 2: Crossroads versus Linux Virtual Server (LVS)</a></dt> +<dt><a href="#l99">6.2: Benchmark 2: Crossroads versus Linux Virtual Server (LVS)</a></dt> <dl> -<dt><a href="#l99">6.2.1: Environment</a></dt> -<dt><a href="#l100">6.2.2: Tests and results</a></dt> +<dt><a href="#l100">6.2.1: Environment</a></dt> +<dt><a href="#l101">6.2.2: Tests and results</a></dt> </dl> </dl> -<dt><h3><a href="#l101">7: Compiling and Installing</a></h3></dt> +<dt><h3><a href="#l102">7: Compiling and Installing</a></h3></dt> <dl> -<dt><a href="#l102">7.1: Prerequisites</a></dt> -<dt><a href="#l103">7.2: Compiling and installing</a></dt> -<dt><a href="#l104">7.3: Configuring crossroads</a></dt> -<dt><a href="#l105">7.4: A boot script</a></dt> +<dt><a href="#l103">7.1: Prerequisites</a></dt> +<dt><a href="#l104">7.2: Compiling and installing</a></dt> +<dt><a href="#l105">7.3: Configuring crossroads</a></dt> +<dt><a href="#l106">7.4: A boot script</a></dt> <dl> -<dt><a href="#l106">7.4.1: SysV Style Startup</a></dt> -<dt><a href="#l107">7.4.2: BSD Style Startup</a></dt> -<dt><a href="#l108">7.4.3: Linux-related</a></dt> +<dt><a href="#l107">7.4.1: SysV Style Startup</a></dt> +<dt><a href="#l108">7.4.2: BSD Style Startup</a></dt> +<dt><a href="#l109">7.4.3: Linux-related</a></dt> </dl> <p><hr><p> @@ -243,8 +244,7 @@ or bug reports, always include the following: the circumstances, what is the expected behavior, what is the observed behavior. <p> -<li> The Crossroads configuration (normally - /etc/crossroads.conf) +<li> The Crossroads configuration in the file <code>crossroads.conf</code> <p> <li> The version of Crossroads and all compile-time settings, obtained via <code>crossroads -C</code>.</ul> @@ -373,7 +373,20 @@ configuration file of Crossroads, existing configuration files may need to be made suitable for new versions. <p> <a name="l7"></a> -<strong>1.5.1: Porting issues for pre-1.63 installations</strong> +<strong>1.5.1: Porting issues for pre-1.80 installations</strong> +<p> +Please be aware that as of version 1.80, the Crossroads + configuration file may be located in an 'etc' directory along the + path where Crossroads was started. E.g., if the Crossroads binary + is <code>/usr/local/bin/crossroads</code>, then Crossroads will read the + configuration file <code>/usr/local/etc/crossroads.conf</code> before + defaulting to <code>/etc/crossroads.conf</code>. When installing + configurations to such 'etc' directories along the path, be sure + to remove stale configuration files. Crossroads will only parse + one primary configuration file. +<p> +<a name="l8"></a> +<strong>1.5.2: Porting issues for pre-1.63 installations</strong> <p> The parser of Crossroads 1.63 has become even stricter. HTTP-related commands, such as <code>addclientheader</code>, may @@ -382,8 +395,8 @@ The parser of Crossroads 1.63 has become even Previously such directives were allowed, albeit they would be ineffective. <p> -<a name="l8"></a> -<strong>1.5.2: Porting issues for pre-1.50 installations</strong> +<a name="l9"></a> +<strong>1.5.3: Porting issues for pre-1.50 installations</strong> <p> As of version 1.50, the command <code>crossroads tell</code> has been changed. To set a state, the command must be used as follows: @@ -397,8 +410,8 @@ The keyword <code>state</code> was added. This is because <code>crossroads the like that change the back end states, please modify the commands to suit this. <p> -<a name="l9"></a> -<strong>1.5.3: Porting issues for pre-1.43 installations</strong> +<a name="l10"></a> +<strong>1.5.4: Porting issues for pre-1.43 installations</strong> <p> As of version 1.43, the shared memory key calculations are based on a different algorithm. This key is e.g. necessary when starting @@ -419,8 +432,8 @@ Furthermore, shell-style comment is no longer supported as of your configuration files use shell-style comment, please convert this to <strong>C</strong> or <strong>C++</strong> style. <p> -<a name="l10"></a> -<strong>1.5.4: Porting issues for pre-1.21 installations</strong> +<a name="l11"></a> +<strong>1.5.5: Porting issues for pre-1.21 installations</strong> <p> As of version 1.21, the event-hook directives <code>onsuccess</code> and <code>onfailure</code> no longer exists. @@ -434,8 +447,8 @@ The commands that are run via <code>onstart</code>, <code>onend</code> or <code> are subject to format expansion; e.g., <code>%1w</code> is expanded to the weight of the first back end, etc.. See section <a href="crossroads.html#config">4</a> for details. <p> -<a name="l11"></a> -<strong>1.5.5: Porting issues for pre-0.26 installations</strong> +<a name="l12"></a> +<strong>1.5.6: Porting issues for pre-0.26 installations</strong> <p> As of version 0.26 the syntax of the configuration file has changed. In particular: @@ -453,8 +466,8 @@ Therefore when converting configuration files to the new syntax, <em>session</em> is used strictly in that sense -- and no longer for a TCP connection.) <p> -<a name="l12"></a> -<strong>1.5.6: Porting issues for pre-1.08 installations</strong> +<a name="l13"></a> +<strong>1.5.7: Porting issues for pre-1.08 installations</strong> <p> As of version 1.08, the following directives no longer are supported: @@ -474,7 +487,7 @@ As of version 1.08, the following directives no longer are This incidentally also makes it possible to change the header name (here: <code>XR-Real-IP</code>).</ul> <p> -<a name="l13"></a> +<a name="l14"></a> <h2>2: Installation for the impatient</h2> <a name="impatient"></a> For the impatient, here's the very-quick-but-very-superficial recipy @@ -515,8 +528,10 @@ for getting Crossroads up and running: binary into <code>/usr/local/bin/</code>. If the compilation doesn't work on your system, check <code>etc/Makefile.def</code> for hints. <p> -<li> Create a file /etc/crossroads.conf. In it state - something like: +<li> Create a configuration file as e.g. + <code>/etc/crossroads.conf</code>. (Other locations are permitted. See + section <a href="crossroads.html#configuring">7.3</a> for details.) In it state something + like: <p> <pre> service www { @@ -550,24 +565,24 @@ That's off course assuming that you want to balance HTTP on running, port 1000. </ul> <p> -<a name="l14"></a> +<a name="l15"></a> <h2>3: Using Crossroads</h2> -<a name="using"></a><a name="l15"></a> +<a name="using"></a><a name="l16"></a> <h3>3.1: The Balancer: crossroads</h3> <p> -The Crossroads balancer is started from the commandline, and highly depends on -/etc/crossroads.conf (the default configuration file). It -supports a number of flags (e.g., to overrule the location of the -configuration file). The actual usage information is always obtained -by typing <code>crossroads</code> without any arguments. Crossroads then -displays the allowed arguments. +The Crossroads balancer is started from the commandline, and highly +depends on the configuration file <code>crossroads.conf</code> (the default +configuration file). It supports a number of flags (e.g., to overrule +the location of the configuration file). The actual usage information +is always obtained by typing <code>crossroads</code> without any arguments. +Crossroads then displays the allowed arguments. <p> The installation (see section <a href="crossroads.html#installation">7</a>) installs also a second program called <code>crossroads-daemon</code>. This program is not meant to be started from the command line; it is administered through the front end <code>crossroads</code>. <p> -<a name="l16"></a> +<a name="l17"></a> <strong>3.1.1: General Commandline Syntax</strong> <p> This section shows the most basic usage. As said above, start @@ -580,7 +595,11 @@ This section shows the most basic usage. As said above, start <li> <code>crossroads restart</code> is a combination of the former two. Beware that a restart may cause discontinuity in service; it is just a shorthand for typing the 'stop' and - 'start' actions after one another. + 'start' actions after one another. The reason is that in + the split second where the listener is stopped and a new one + is not yet started, a new network connection won't be + accepted. Running connections are however not hindered by a + restart. <li> <code>crossroad status</code> reports on each running service. Per service, the state of each back end is reported. @@ -603,7 +622,7 @@ This section shows the most basic usage. As said above, start report on back end states. </ul> <p> -<a name="l17"></a> +<a name="l18"></a> <strong>3.1.2: Status Reporting from the Command Line</strong> <p> The command <code>crossroads status</code> shows a verbose human-readable @@ -644,7 +663,7 @@ 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="l18"></a> +<a name="l19"></a> <strong>3.1.3: Logging-related options</strong> <p> Two 'flags' of Crossroads are specifically logging-related. This @@ -687,7 +706,7 @@ That instructs <code>syslogd</code> to send <code>LOG_LOCAL7</code> requests to <li> Finally, monitor <code>/var/log/crossroads.log</code> for Crossroads' messages.</ul> <p> -<a name="l19"></a> +<a name="l20"></a> <strong>3.1.4: Reloading Configurations</strong> <p> Crossroads doesn't support the reloading of a configuration while @@ -698,7 +717,7 @@ However, external lists of allowed or denied IP addresses can be reloaded by sending a signal -1 (<code>SIGHUP</code>) to Crossroads. See section <a href="crossroads.html#servicedef">4.3</a> for the details. <p> -<a name="l20"></a> +<a name="l21"></a> <h3>3.2: The Web Frontend: crossroads-mgr</h3> <p> A web front end for Crossroads is <code>crossroads-mgr</code>. Type @@ -717,22 +736,25 @@ There are lots of other options that can be used with <p> -<a name="l21"></a> +<a name="l22"></a> <h2>4: The configuration</h2> <a name="config"></a>The configuration that crossroads uses is normally stored in the file -/etc/crossroads.conf. This location can be overruled using the +<code>crossroads.conf</code>, either in an 'etc' directory near the binary, or +in <code>/etc/</code>. See section <a href="crossroads.html#configuring">7.3</a> for details. +<p> +The name of the configuration file can be overruled using the command line flag <code>-c</code>. <p> This section explains the syntax of the configuration file, and what all settings do. <p> -<a name="l22"></a> +<a name="l23"></a> <h3>4.1: General language elements</h3> <p> This section describes the general elements of the crossroads configuration language. <p> -<a name="l23"></a> +<a name="l24"></a> <strong>4.1.1: Empty lines, indentation and comments</strong> <p> Empty lines are of course allowed in the configuration. Also, @@ -766,7 +788,7 @@ best'. (I favor C or C++ comment. My favorite editor <em>emacs</em> can be put in <code>cmode</code> and nicely highlight what's comment and what's not. And as a bonus it will auto-indent the configuration!) <p> -<a name="l24"></a> +<a name="l25"></a> <strong>4.1.2: Preprocessor directives</strong> <p> Similar to <strong>C</strong> or <strong>C++</strong>, the Crossroads grammar knows <code>#include</code> @@ -817,7 +839,7 @@ service web { </pre> <p> -<a name="l25"></a> +<a name="l26"></a> <strong>4.1.3: Keywords, numbers, identifiers, generic strings</strong> <p> In a configuration file, statements are identified by <em>keywords</em>, @@ -917,7 +939,7 @@ Finally, an argument can be a 'boolean' value. Crossroads knows <code>true</code>, <code>yes</code> and <code>on</code> all mean the same and can be used interchangeably; as can the keywords <code>false</code>, <code>no</code> and <code>off</code>. <p> -<a name="l26"></a> +<a name="l27"></a> <h3>4.2: Daemon options</h3><a name="daemonoptions"></a> <p> Crossroads supports an optional block that defines run options for the @@ -975,7 +997,7 @@ In the curly-brace block the following option statements can occur: <em>crossroads - Sevice web: listening</em> or <em>crossroads - Service web: serving</em>.</ul> <p> -<a name="l27"></a> +<a name="l28"></a> <h3>4.3: Service definitions</h3> <a name="servicedef"></a> <p> Service definitions are blocks in the configuration file that @@ -999,7 +1021,7 @@ identifying names differ. The following list shows possible statements. Each statement must end with a semicolon, except for the <code>backend</code> statement, which has is own block (more on this later). <p> -<a name="conf/port"></a><a name="l28"></a> +<a name="conf/port"></a><a name="l29"></a> <strong>4.3.1: port - Specifying the listen port</strong> <a name="confport - Specifying the listen port"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>port</code> statement defines to which TCP port a service @@ -1013,7 +1035,7 @@ Multiple services in one configuration cannot use the same port <p><dt><strong>Default:</strong><dd> There is no default. This is a required setting. </dl> <p> -<a name="conf/type"></a><a name="l29"></a> +<a name="conf/type"></a><a name="l30"></a> <strong>4.3.2: type - Defining the service type</strong> <a name="conftype - Defining the service type"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>type</code> statement defines how crossroads handles the stated @@ -1033,7 +1055,7 @@ Unless you really need such special features, use the type <code>any</code> (the <p><dt><strong>Default:</strong><dd> <code>any</code> </dl> <p> -<a name="conf/headerinspection"></a><a name="l30"></a> +<a name="conf/headerinspection"></a><a name="l31"></a> <strong>4.3.3: headerinspection - are all HTTP headers inspected</strong> <a name="confheaderinspection - are all HTTP headers inspected"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>headerinspection</code> directive defines whether Crossroads @@ -1050,7 +1072,7 @@ that forms the server's answer, are analyzed. <p><dt><strong>Default:</strong><dd> <code>deep</code> </dl> <p> -<a name="conf/bindto"></a><a name="l31"></a> +<a name="conf/bindto"></a><a name="l32"></a> <strong>4.3.4: bindto - Binding to a specific IP address</strong> <a name="confbindto - Binding to a specific IP address"></a> <dl> <p><dt><strong>Description:</strong><dd> The <code>bindto</code> statement is used in situations where crossroads @@ -1064,7 +1086,7 @@ that forms the server's answer, are analyzed. <p><dt><strong>Default:</strong><dd> <code>any</code> </dl> <p> -<a name="conf/verbose"></a><a name="l32"></a> +<a name="conf/verbose"></a><a name="l33"></a> <strong>4.3.5: verbosity - Controlling debug output</strong> <a name="confverbosity - Controlling debug output"></a> <dl> <p><dt><strong>Description:</strong><dd> Verbosity statements come in two forms: <code>verbosity on</code> or @@ -1081,7 +1103,7 @@ that forms the server's answer, are analyzed. <p><dt><strong>Default:</strong><dd> <code>off</code> </dl> <p> -<a name="conf/dispatchmode"></a><a name="l33"></a> +<a name="conf/dispatchmode"></a><a name="l34"></a> <strong>4.3.6: dispatchmode - How are back ends selected</strong> <a name="confdispatchmode - How are back ends selected"></a> <dl> <p><dt><strong>Description:</strong><dd> The dispatch mode controls how crossroads selects a back end from @@ -1168,7 +1190,7 @@ Your 'right' dispatch mode will depend on the type of service. Given <p><dt><strong>Default:</strong><dd> <code>roundrobin</code> </dl> <p> -<a name="conf/revivinginterval"></a><a name="l34"></a> +<a name="conf/revivinginterval"></a><a name="l35"></a> <strong>4.3.7: revivinginterval - Back end wakeup calls</strong> <a name="confrevivinginterval - Back end wakeup calls"></a> <dl> <p><dt><strong>Description:</strong><dd> A reviving interval definition is used when Crossroads @@ -1198,7 +1220,7 @@ An example of the definition is <code>revivinginterval 10</code>. When this <p><dt><strong>Default:</strong><dd> 0 (no wakeup calls) </dl> <p> -<a name="conf/checkinterval"></a><a name="l35"></a> +<a name="conf/checkinterval"></a><a name="l36"></a> <strong>4.3.8: checkinterval - Periodic back end checks</strong> <a name="confcheckinterval - Periodic back end checks"></a> <dl> <p><dt><strong>Description:</strong><dd> When a check interval is stated, Crossroads will periodically @@ -1223,7 +1245,7 @@ The second form activates an external program (see section <p><dt><strong>Default:</strong><dd> 0 (no periodic checks) </dl> <p> -<a name="conf/maxconnections"></a><a name="l36"></a> +<a name="conf/maxconnections"></a><a name="l37"></a> <strong>4.3.9: maxconnections - Limiting concurrent clients at service level</strong> <a name="confmaxconnections - Limiting concurrent clients at service level"></a> <dl> <p><dt><strong>Description:</strong><dd> The maximum number of connections is specified using @@ -1243,7 +1265,7 @@ Note that <code>maxconnections</code> is also allowed in a backend <p><dt><strong>Default:</strong><dd> 0, meaning that all connections will be accepted. </dl> <p> -<a name="conf/backlog"></a><a name="l37"></a> +<a name="conf/backlog"></a><a name="l38"></a> <strong>4.3.10: backlog - The TCP Back Log size</strong> <a name="confbacklog - The TCP Back Log size"></a> <dl> <p><dt><strong>Description:</strong><dd> The TCP back log size is a number that controls how many @@ -1259,7 +1281,7 @@ Note that <code>maxconnections</code> is also allowed in a backend value for socket back log size. </dl> <p> -<a name="conf/shmkey"></a><a name="l38"></a> +<a name="conf/shmkey"></a><a name="l39"></a> <strong>4.3.11: shmkey - Shared Memory Access</strong> <a name="confshmkey - Shared Memory Access"></a> <dl> <p><dt><strong>Description:</strong><dd> Different Crossroads @@ -1280,7 +1302,7 @@ The actual key value doesn't matter much, as long as it's unique own key, based on the service name. </dl> <p> -<a name="conf/allow"></a><a name="l39"></a> +<a name="conf/allow"></a><a name="l40"></a> <strong>4.3.12: allow* and deny* - Allowing or denying connections</strong> <a name="confallow* and deny* - Allowing or denying connections"></a> <dl> <p><dt><strong>Description:</strong><dd> Crossroads can allow or deny @@ -1290,7 +1312,7 @@ The actual key value doesn't matter much, as long as it's unique <p> When using <code>allowfrom</code> and <code>denyfrom</code> then the IP addresses to allow or deny connections are - stated in /etc/crossroads.conf. When using <code>allowfile</code> and + stated in the configuration. When using <code>allowfile</code> and <code>denyfile</code> the allow or deny connections are stated in a separate file. <p> @@ -1306,7 +1328,7 @@ The statements <code>allowfrom</code> and <code>denyfrom</code> are followed by filter specifications from those external files. In both cases, Crossroads obtains filter specifications and places them in its lists of allowed or denied IP addresses. The difference between - specifying filters in /etc/crossroads.conf or in external + specifying filters in the configuration file or in external files, is that Crossroads will reload the external files when it receives signal 1 (<code>SIGHUP</code>), as in <code>killall -1 crossroads</code>. <p> @@ -1370,7 +1392,7 @@ allowfrom 192.168.1.24; <p><dt><strong>Default:</strong><dd> In absence of these statements, all client IP's are accepted. </dl> <p> -<a name="conf/useraccount"></a><a name="l40"></a> +<a name="conf/useraccount"></a><a name="l41"></a> <strong>4.3.13: useraccount - Limiting the effective ID of external processes</strong> <a name="confuseraccount - Limiting the effective ID of external processes"></a> <dl> <p><dt><strong>Description:</strong><dd> Using the directive <code>useraccount</code>, the effective user and group @@ -1388,7 +1410,7 @@ allowfrom 192.168.1.24; ID that was in effect when Crossroads was started. </dl> <p> -<a name="l41"></a> +<a name="l42"></a> <h3>4.4: Backend definitions</h3> <p> Inside the service definitions as are described in the previous @@ -1424,7 +1446,7 @@ Crossroads treats the network traffic as a stream of HTTP messages; i.e., when the service is declared with <code>type http</code>. Incase of <code>type any</code>, the HTTP-specific directives have no effect. <p> -<a name="conf/server.yo"></a><a name="l42"></a> +<a name="conf/server.yo"></a><a name="l43"></a> <strong>4.4.1: server - Specifying the back end address</strong> <a name="confserver - Specifying the back end address"></a> <dl> <p><dt><strong>Description:</strong><dd> Each back end must be identified by the network name @@ -1442,7 +1464,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of <p><dt><strong>Default:</strong><dd> There is no default. This is a required setting. </dl> <p> -<a name="conf/backendport.yo"></a><a name="l43"></a> +<a name="conf/backendport.yo"></a><a name="l44"></a> <strong>4.4.2: port - Specifying a back end port</strong> <a name="confport - Specifying a back end port"></a> <dl> <p><dt><strong>Description:</strong><dd> Back ends must be known by their host name and a port. Both can @@ -1454,7 +1476,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of using <code>server</code> or using <code>port</code>. </dl> <p> -<a name="conf/verbose-backend.yo"></a><a name="l44"></a> +<a name="conf/verbose-backend.yo"></a><a name="l45"></a> <strong>4.4.3: verbosity - Controlling verbosity at the back end level</strong> <a name="confverbosity - Controlling verbosity at the back end level"></a> <dl> <p><dt><strong>Description:</strong><dd> Similar to <code>service</code> specifications, a @@ -1468,7 +1490,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of <p><dt><strong>Default:</strong><dd> <code>off</code> </dl> <p> -<a name="conf/retries.yo"></a><a name="l45"></a> +<a name="conf/retries.yo"></a><a name="l46"></a> <strong>4.4.4: retries - Specifying allowed failures</strong> <a name="confretries - Specifying allowed failures"></a> <dl> <p><dt><strong>Description:</strong><dd> Back ends that are 'flaky' or on a less reliable network can be @@ -1483,7 +1505,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of connection. </dl> <p> -<a name="conf/maxcon-client.yo"></a><a name="l46"></a> +<a name="conf/maxcon-client.yo"></a><a name="l47"></a> <strong>4.4.5: maxconnections - Limiting the connections to a back end</strong> <a name="confmaxconnections - Limiting the connections to a back end"></a> <dl> <p><dt><strong>Description:</strong><dd> The directive <code>maxconnections</code> limits the number of allowed @@ -1498,7 +1520,7 @@ i.e., when the service is declared with <code>type http</code>. Incase of <p><dt><strong>Default:</strong><dd> 0; meaning no limit </dl> <p> -<a name="conf/weight"></a><a name="l47"></a> +<a name="conf/weight"></a><a name="l48"></a> <strong>4.4.6: weight - When a back end is more equal than others</strong> <a name="confweight - When a back end is more equal than others"></a> <dl> <p><dt><strong>Description:</strong><dd> To influence how backends are selected, a backend can specify its @@ -1517,7 +1539,7 @@ The weighing mechanism only applies to the dispatch modes <p><dt><strong>Default:</strong><dd> 1; all back ends have equal weight. </dl> <p> -<a name="conf/decay"></a><a name="l48"></a> +<a name="conf/decay"></a><a name="l49"></a> <strong>4.4.7: decay - Levelling out activity of a back end</strong> <a name="confdecay - Levelling out activity of a back end"></a> <dl> <p><dt><strong>Description:</strong><dd> To make sure that a 'spike' of activity doesn't @@ -1539,7 +1561,7 @@ This means that when a given back end is hit, then its usage data <p><dt><strong>Default:</strong><dd> 0, meaning that no decay is applied to usage statistics. </dl> <p> -<a name="conf/state"></a><a name="l49"></a> +<a name="conf/state"></a><a name="l50"></a> <strong>4.4.8: 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 @@ -1556,7 +1578,7 @@ This means that when a given back end is hit, then its usage data initial dispatching. </dl> <p> -<a name="conf/onhooks"></a><a name="l50"></a> +<a name="conf/onhooks"></a><a name="l51"></a> <strong>4.4.9: 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 @@ -1643,7 +1665,7 @@ The format is always <code>on</code><em>type</em> <em>command</em>. The <em>comm connection, success or failure of a back end. </dl> <p> -<a name="conf/trafficlog"></a><a name="l51"></a> +<a name="conf/trafficlog"></a><a name="l52"></a> <strong>4.4.10: 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 @@ -1666,7 +1688,7 @@ The <code>throughputlog</code> statement writes shorthand transmissions to <p><dt><strong>Default:</strong><dd> none </dl> <p> -<a name="conf/httptiminglog"></a><a name="l52"></a> +<a name="conf/httptiminglog"></a><a name="l53"></a> <strong>4.4.11: httptiminglog - Timing debugging in HTTP mode</strong> <a name="confhttptiminglog - Timing debugging in HTTP mode"></a> <dl> <p><dt><strong>Description:</strong><dd> The directive <code>httptiminglog</code> turns on logging of HTTP mode @@ -1682,7 +1704,7 @@ The <code>throughputlog</code> statement writes shorthand transmissions to <p><dt><strong>Default:</strong><dd> none </dl> <p> -<a name="conf/stickycookie"></a><a name="l53"></a> +<a name="conf/stickycookie"></a><a name="l54"></a> <strong>4.4.12: 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> @@ -1722,7 +1744,7 @@ There are basically to provide such cookies to a browser. First, a <p><dt><strong>Default:</strong><dd> There is no default. </dl> <p> -<a name="conf/addclientheader"></a><a name="l54"></a> +<a name="conf/addclientheader"></a><a name="l55"></a> <strong>4.4.13: HTTP Header Modification Directives</strong> <a name="confHTTP Header Modification Directives"></a> <dl> <p><dt><strong>Description:</strong><dd> Crossroads understands the following @@ -1942,16 +1964,16 @@ service ... { <p><dt><strong>Default:</strong><dd> There is no default. </dl> <p> -<a name="l55"></a> +<a name="l56"></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="l56"></a> +<a name="l57"></a> <h3>5.1: Configuration examples</h3> <a name="tips/examples"></a> -<a name="l57"></a> +<a name="l58"></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 @@ -2080,13 +2102,13 @@ service www { </pre> <p> -<a name="l58"></a> +<a name="l59"></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 -Unix laptop. The problem that I face is that I need many HTTP proxy -configurations (at home, at customers' sites and so on) but I'm too -lazy to reconfigure browsers all the time. +As another example, here's my configuration <code>crossroads.conf</code> that I +use on my Unix laptop. The problem that I face is that I need many +HTTP proxy configurations (at home, at customers' sites and so on) but +I'm too lazy to reconfigure browsers all the time. <p> Here's how it used to be before crossroads: <p> @@ -2169,7 +2191,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="l59"></a> +<a name="l60"></a> <strong>5.1.3: SSH login with enforced idle logout</strong> <p> The following example shows how crossroads 'throttles' SSH @@ -2195,7 +2217,7 @@ service Ssh { </pre> <p> -<a name="l60"></a> +<a name="l61"></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 @@ -2203,7 +2225,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="l61"></a> +<a name="l62"></a> <strong>5.2.1: Bysize, byduration or byconnections?</strong> <p> As stated before, crossroads doesn't know 'what a service does' and @@ -2253,7 +2275,7 @@ E.g., consider a database connection. What's <p> </ul> <p> -<a name="l62"></a> +<a name="l63"></a> <strong>5.2.2: Averaging size and duration</strong> <p> The configuration statement <code>dispatchmode bysize</code> or <code>byduration</code> @@ -2274,7 +2296,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="l63"></a> +<a name="l64"></a> <strong>5.2.3: Specifying decays</strong> <p> Decays are also only relevant when crossroads computes the 'next best @@ -2328,7 +2350,7 @@ service soap { </pre> <p> -<a name="l64"></a> +<a name="l65"></a> <strong>5.2.4: Adjusting the weights</strong> <p> The back end modifier <code>weight</code> is useful in situations where your @@ -2382,7 +2404,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="l65"></a> +<a name="l66"></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> @@ -2406,7 +2428,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="l66"></a> +<a name="l67"></a> <strong>5.3.1: Syntax</strong> <p> The syntax of both verifications is: @@ -2485,7 +2507,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="l67"></a> +<a name="l68"></a> <strong>5.3.2: Security Considerations</strong> <p> When <code>externalhandler</code> is in effect, Crossroads spawns an external @@ -2494,7 +2516,7 @@ a restricted user account. <p> The directive <code>useraccount</code> can be used to accomplish this. <p> -<a name="l68"></a> +<a name="l69"></a> <strong>5.3.3: An example</strong> <p> The following configuration balances SMTP requests to two back @@ -2531,7 +2553,7 @@ service smtp { </pre> <p> -<a name="l69"></a> +<a name="l70"></a> <h3>5.4: Throttling the number of concurrent connections</h3> <a name="tips/throttling"></a>If you suspect that your service may occasionally receive 'spikes' of activity (which you should always assume), then it might be a @@ -2560,7 +2582,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="l70"></a> +<a name="l71"></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 @@ -2585,7 +2607,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="l71"></a> +<a name="l72"></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 @@ -2593,7 +2615,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="l72"></a> +<a name="l73"></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 @@ -2625,7 +2647,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="l73"></a> +<a name="l74"></a> <strong>5.6.2: But if you must..</strong> <p> If you really need stickiness, think first whether you might use TCP @@ -2710,7 +2732,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="l74"></a> +<a name="l75"></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, @@ -2740,7 +2762,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="l75"></a> +<a name="l76"></a> <strong>5.7.1: Sample Crossroads configuration</strong> <p> The below sample configuration shows two HTTP back ends that receive @@ -2767,7 +2789,7 @@ service www { </pre> <p> -<a name="l76"></a> +<a name="l77"></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> @@ -2799,7 +2821,7 @@ LogFormat "%{X-Real-IP}i %l %u %t %D \"%r\" %>s %b" common </pre> <p> -<a name="l77"></a> +<a name="l78"></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 @@ -2911,7 +2933,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="l78"></a> +<a name="l79"></a> <h3>5.9: Debugging network traffic</h3> <a name="tips/debugging"></a> Incase the traffic between client and backend must be debugged, the statement <code>trafficlog</code> <em>filename</em> can be issued. This @@ -3029,9 +3051,9 @@ Summarizing, the throughput times and buffer sizes of a to write up a script to analyze the output and to compute round trip times. Such scripts are not (yet) included in Crossroads. <p> -<a name="l79"></a> +<a name="l80"></a> <h3>5.10: IP filtering: Limiting Access by Client IP Address</h3> -<a name="tips/ipfiltering"></a><a name="l80"></a> +<a name="tips/ipfiltering"></a><a name="l81"></a> <strong>5.10.1: General Examples</strong> <p> The directives <code>allowfrom</code>, <code>denyfrom</code>, <code>allowfile</code> and @@ -3068,7 +3090,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="l81"></a> +<a name="l82"></a> <strong>5.10.2: Using External Files</strong> <p> The directives <code>allowfile</code> and <code>denyfile</code> allow you to specify IP @@ -3100,7 +3122,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="l82"></a> +<a name="l83"></a> <strong>5.10.3: Mixing Directives</strong> <p> Crossroads allows to mix all directives in one service @@ -3141,9 +3163,9 @@ This will first of all deny access to all IP addresses that won't ever be effective. The net result will be that access will be granted to 127.0.0.1. <p> -<li> Blacklisting or whitelisting can be left out. - A list is considered empty when no appropriate directives - occur in /etc/crossroads.conf, or when the directive +<li> Blacklisting or whitelisting can be left out. A list is + considered empty when no appropriate directives occur in the + configuration file <code>crossroads.conf</code>, or when the directive points to an empty or non-existent external file. <p> <li> Using <code>*from</code> and <code>*file</code> statements is allowed, but @@ -3167,14 +3189,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="l83"></a> +<a name="l84"></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="l84"></a> +<a name="l85"></a> <strong>5.11.1: Configuring the external handler</strong> <p> First, the <code>dispatchmode</code> statement needs to inform Crossroads that @@ -3247,16 +3269,16 @@ 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="l85"></a> +<a name="l86"></a> <strong>5.11.2: Writing the external handler</strong> <p> The external handler is activated using the arguments that are -specified in /etc/crossroads.conf. The external handler can do +specified in the configuration file. The external handler can do 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="l86"></a> +<a name="l87"></a> <strong>5.11.3: Examples of external handlers</strong> <p> This section shows some examples of Crossroads configurations @@ -3683,7 +3705,7 @@ if ($action eq 'dispatch') { </pre> <p> -<a name="l87"></a> +<a name="l88"></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 @@ -3719,7 +3741,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="l88"></a> +<a name="l89"></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 @@ -3764,7 +3786,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="l89"></a> +<a name="l90"></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 @@ -3815,7 +3837,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="l90"></a> +<a name="l91"></a> <strong>5.14.1: Starting crossroads-mgr</strong> <p> The basic command to start <code>crossroads-mgr</code> is @@ -3889,7 +3911,7 @@ echo -e 'viewer:showme\nmodifier:changeit' | </pre> <p> -<a name="l91"></a> +<a name="l92"></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 @@ -3960,7 +3982,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="l92"></a> +<a name="l93"></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 @@ -3984,7 +4006,7 @@ 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="l93"></a> +<a name="l94"></a> <h3>5.17: Managing a Pool of Virtual Back Ends</h3> <a name="tips/virtual"></a>Crossroads can be used as a central dispatcher for computing on demand. E.g., imagine a situation where a web service exists on one or @@ -4069,13 +4091,13 @@ end or to remove one, is left to the reader. The output of states of all back ends, their connections, the total number of available or down back ends, etc.. <p> -<a name="l94"></a> +<a name="l95"></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="l95"></a> +<a name="l96"></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: @@ -4103,7 +4125,7 @@ service HttpProxy { </pre> <p> -<a name="l96"></a> +<a name="l97"></a> <strong>6.1.1: Results</strong> <p> The results of this test are that crossroads causes a negligible @@ -4126,7 +4148,7 @@ sys 0m0.230s </pre> <p> -<a name="l97"></a> +<a name="l98"></a> <strong>6.1.2: Discussion</strong> <p> The above shown results are quite favorable to crossroads. However, @@ -4158,7 +4180,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="l98"></a> +<a name="l99"></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 @@ -4172,7 +4194,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="l99"></a> +<a name="l100"></a> <strong>6.2.1: Environment</strong> <p> On the balancer, LVS was run on port 80, its forwarding set up for two @@ -4203,7 +4225,7 @@ service http { </pre> <p> -<a name="l100"></a> +<a name="l101"></a> <strong>6.2.2: Tests and results</strong> <p> In the first test, ports 80 and 81 on the balancer were 'bombed' with @@ -4282,9 +4304,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="l101"></a> +<a name="l102"></a> <h2>7: Compiling and Installing</h2> <a name="installation"></a> -<a name="compiling"></a><a name="l102"></a> +<a name="compiling"></a><a name="l103"></a> <h3>7.1: Prerequisites</h3> <p> The creation of crossroads requires: @@ -4303,7 +4325,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="l103"></a> +<a name="l104"></a> <h3>7.2: Compiling and installing</h3> <p> <ul> @@ -4367,11 +4389,25 @@ crossroads, follow these steps. <p> </ul> <p> -<a name="l104"></a> -<h3>7.3: Configuring crossroads</h3> +<a name="l105"></a> +<h3>7.3: Configuring crossroads</h3><a name="configuring"></a> <p> Now that the binary is available on your system, you need to create a -suitable /etc/crossroads.conf. Use this manual to get started. +configuration <code>crossroads.conf</code>. Use this manual to get started. You +can locate the configuration file in any of the following locations on +your file system: +<p> +<ul> + <li> Along an 'etc' directory that matches the path where + Crossroads is installed. E.g, when the Crossroads binary is + <code>/usr/local/bin/crossroads</code>, then the configuration can be + put in <code>/usr/local/etc/crossroads.conf</code>. Alternatively, if + you install Crossroads in <code>/opt/crossroads/bin/</code>, then you + can install the configuration into <code>/opt/crossroads/etc/</code>. +<p> +<li> As the file <code>/etc/crossroads.conf</code>. When Crossroads + fails to locate a configuration file near its path, it tries + this name.</ul> <p> Once you have the configuration ready, start crossroads with <code>crossroads start</code>. Test the availability of your services and back @@ -4415,13 +4451,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="l105"></a> +<a name="l106"></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="l106"></a> +<a name="l107"></a> <strong>7.4.1: SysV Style Startup</strong> <p> On SysV style systems, there's a startup script directory @@ -4475,7 +4511,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="l107"></a> +<a name="l108"></a> <strong>7.4.2: BSD Style Startup</strong> <p> On BSD style systems, daemons are booted directly from <code>/etc/rc</code> and @@ -4491,7 +4527,7 @@ and add the statement: If your BSD system lacks <code>/etc/rc.local</code>, then you may need to start Crossroads from <code>/etc/rc</code>. Your mileage may vary. <p> -<a name="l108"></a> +<a name="l109"></a> <strong>7.4.3: Linux-related</strong> <p> When using Crossroads on Linux, the following may be relevant: diff --git a/doc/crossroads.pdf b/doc/crossroads.pdf Binary files differ. diff --git a/doc/main/compiling.yo b/doc/main/compiling.yo @@ -81,10 +81,24 @@ itemization( ) -subsect(Configuring crossroads) +subsect(Configuring crossroads)label(configuring) Now that the binary is available on your system, you need to create a -suitable DEFAULTCONF(). Use this manual to get started. +configuration tt(crossroads.conf). Use this manual to get started. You +can locate the configuration file in any of the following locations on +your file system: + +itemization( + it() Along an 'etc' directory that matches the path where + Crossroads is installed. E.g, when the Crossroads binary is + tt(/usr/local/bin/crossroads), then the configuration can be + put in tt(/usr/local/etc/crossroads.conf). Alternatively, if + you install Crossroads in tt(/opt/crossroads/bin/), then you + can install the configuration into tt(/opt/crossroads/etc/). + + it() As the file tt(/etc/crossroads.conf). When Crossroads + fails to locate a configuration file near its path, it tries + this name.) Once you have the configuration ready, start crossroads with tt(crossroads start). Test the availability of your services and back diff --git a/doc/main/conf/allow.yo b/doc/main/conf/allow.yo @@ -6,7 +6,7 @@ conf(allow* and deny* - Allowing or denying connections) When using tt(allowfrom) and tt(denyfrom) then the IP addresses to allow or deny connections are - stated in DEFAULTCONF(). When using tt(allowfile) and + stated in the configuration. When using tt(allowfile) and tt(denyfile) the allow or deny connections are stated in a separate file. @@ -22,7 +22,7 @@ conf(allow* and deny* - Allowing or denying connections) filter specifications from those external files. In both cases, Crossroads obtains filter specifications and places them in its lists of allowed or denied IP addresses. The difference between - specifying filters in DEFAULTCONF() or in external + specifying filters in the configuration file or in external files, is that Crossroads will reload the external files when it receives signal 1 (tt(SIGHUP)), as in tt(killall -1 crossroads). diff --git a/doc/main/config.yo b/doc/main/config.yo @@ -1,5 +1,8 @@ The configuration that crossroads uses is normally stored in the file -DEFAULTCONF(). This location can be overruled using the +tt(crossroads.conf), either in an 'etc' directory near the binary, or +in tt(/etc/). See section ref(configuring) for details. + +The name of the configuration file can be overruled using the command line flag tt(-c). This section explains the syntax of the configuration file, and what diff --git a/doc/main/impatient.yo b/doc/main/impatient.yo @@ -37,8 +37,10 @@ itemization( binary into tt(/usr/local/bin/). If the compilation doesn't work on your system, check tt(etc/Makefile.def) for hints. - it() Create a file DEFAULTCONF(). In it state - something like: + it() Create a configuration file as e.g. + tt(/etc/crossroads.conf). (Other locations are permitted. See + section ref(configuring) for details.) In it state something + like: verb(\ service www { diff --git a/doc/main/intro.yo b/doc/main/intro.yo @@ -58,8 +58,7 @@ itemization( the circumstances, what is the expected behavior, what is the observed behavior. - it() The Crossroads configuration (normally - DEFAULTCONF()) + it() The Crossroads configuration in the file tt(crossroads.conf) it() The version of Crossroads and all compile-time settings, obtained via tt(crossroads -C).) @@ -185,6 +184,18 @@ configurations to new versions. Given the changes of the syntax of the configuration file of Crossroads, existing configuration files may need to be made suitable for new versions. +subsubsect(Porting issues for pre-1.80 installations) + + Please be aware that as of version 1.80, the Crossroads + configuration file may be located in an 'etc' directory along the + path where Crossroads was started. E.g., if the Crossroads binary + is tt(/usr/local/bin/crossroads), then Crossroads will read the + configuration file tt(/usr/local/etc/crossroads.conf) before + defaulting to tt(/etc/crossroads.conf). When installing + configurations to such 'etc' directories along the path, be sure + to remove stale configuration files. Crossroads will only parse + one primary configuration file. + subsubsect(Porting issues for pre-1.63 installations) The parser of Crossroads 1.63 has become even diff --git a/doc/main/tips/examples.yo b/doc/main/tips/examples.yo @@ -127,10 +127,10 @@ service www { subsubsect(An HTTP forwarder when travelling) -As another example, here's my DEFAULTCONF() that I use on my -Unix laptop. The problem that I face is that I need many HTTP proxy -configurations (at home, at customers' sites and so on) but I'm too -lazy to reconfigure browsers all the time. +As another example, here's my configuration tt(crossroads.conf) that I +use on my Unix laptop. The problem that I face is that I need many +HTTP proxy configurations (at home, at customers' sites and so on) but +I'm too lazy to reconfigure browsers all the time. Here's how it used to be before crossroads: diff --git a/doc/main/tips/externalhandler.yo b/doc/main/tips/externalhandler.yo @@ -23,7 +23,7 @@ the time of calling, tt(%b) is undefined). subsubsect(Writing the external handler) The external handler is activated using the arguments that are -specified in DEFAULTCONF(). The external handler can do +specified in the configuration file. The external handler can do whatever it wants, but ultimately, it must write a back end name on its em(stdout). Crossroads reads this, and if the back end is available, uses that back end for the connection. diff --git a/doc/main/tips/ipfiltering.yo b/doc/main/tips/ipfiltering.yo @@ -97,9 +97,9 @@ denyfrom 192.168.1/24) won't ever be effective. The net result will be that access will be granted to 127.0.0.1. - it() Blacklisting or whitelisting can be left out. - A list is considered empty when no appropriate directives - occur in DEFAULTCONF(), or when the directive + it() Blacklisting or whitelisting can be left out. A list is + considered empty when no appropriate directives occur in the + configuration file tt(crossroads.conf), or when the directive points to an empty or non-existent external file. it() Using tt(*from) and tt(*file) statements is allowed, but diff --git a/doc/main/using.yo b/doc/main/using.yo @@ -1,11 +1,11 @@ subsect(The Balancer: crossroads) -The Crossroads balancer is started from the commandline, and highly depends on -DEFAULTCONF() (the default configuration file). It -supports a number of flags (e.g., to overrule the location of the -configuration file). The actual usage information is always obtained -by typing tt(crossroads) without any arguments. Crossroads then -displays the allowed arguments. +The Crossroads balancer is started from the commandline, and highly +depends on the configuration file tt(crossroads.conf) (the default +configuration file). It supports a number of flags (e.g., to overrule +the location of the configuration file). The actual usage information +is always obtained by typing tt(crossroads) without any arguments. +Crossroads then displays the allowed arguments. The installation (see section ref(installation)) installs also a second program called tt(crossroads-daemon). This program is not meant @@ -24,7 +24,11 @@ itemization( it() tt(crossroads restart) is a combination of the former two. Beware that a restart may cause discontinuity in service; it is just a shorthand for typing the 'stop' and - 'start' actions after one another. + 'start' actions after one another. The reason is that in + the split second where the listener is stopped and a new one + is not yet started, a new network connection won't be + accepted. Running connections are however not hindered by a + restart. it() tt(crossroad status) reports on each running service. Per service, the state of each back end is reported. diff --git a/doc/man/crossroads-mgr.yo b/doc/man/crossroads-mgr.yo @@ -21,9 +21,9 @@ manpagedescription() it() Set the states of back ends (e.g., to take a back end out of service).) - The web interface cannot be used to configure Crossroads (e.g., to + The web interface cannot be used to fully configure Crossroads (e.g., to add new back ends). This must be done via the configuration file - bf(DEFAULTCONF()). Note furthermore that bf(crossroads status) and + bf(crossroads.conf). Note furthermore that bf(crossroads status) and bf(crossroads tell) are commandline tools that achieve the same functionality as bf(crossroads-mgr). diff --git a/doc/man/crossroads.conf.yo b/doc/man/crossroads.conf.yo @@ -4,9 +4,14 @@ manpage(crossroads.conf)(7)(YEARS())(crossroads)() manpagename(crossroads.conf)(Crossroads configuration) manpagesynopsis() -This manpage describes the configuration of Crossroads, normally the -file bf(DEFAULTCONF()). Crossroads can however be started with a flag -bf(-c) to overrule this name. +This manpage describes the configuration of +Crossroads, usually the file bf(crossroads.conf). This file is often +located in an 'etc' directory near the path where Crossroads is +installed. E.g., when Crossroads is installed as +bf(/usr/local/bin/crossroads), then the configuration file can be +tt(/usr/local/etc/crossroads.conf). Alternatively the configuration +can always be put in bf(/etc/crossroads.conf). Crossroads can however +be started with a flag bf(-c) to specify an entirely different name.. manpagedescription() redef(confsect)(1)(manpagesection(ARG1)) @@ -21,4 +26,4 @@ manpageseealso() manpageauthor() Crossroads is written by AUTHORNAME() and is maintained by - MAINTAINERNAME() (MAINTAINEREMAIL()). -\ No newline at end of file + MAINTAINERNAME() (MAINTAINEREMAIL()). diff --git a/doc/man/crossroads.yo b/doc/man/crossroads.yo @@ -55,7 +55,12 @@ manpageoptions() em(stdout) and stops. Useful when submitting bug reports. it() bf(-c) em(config): Uses em(config) as the configuration - file. The default is bf(DEFAULTCONF()). + file. The default is bf(/some/path/etc/crossroads.conf) + or bf(/etc/crossroads.conf). The first alternative + applies when Crossroads is installed as + bf(/some/path/bin/crossroads); in that case, Crossroads + tries to find its configuration by trying an 'etc' + diretory 'near' its own path. it() bf(-d) em(sec): Sets the DNS cache time-to-live to em(sec) seconds. Value 0 suppresses DNS entry @@ -90,7 +95,7 @@ manpageoptions() it() bf(-?): Shows an overview of the usage.) manpagefiles() - bf(DEFAULTCONF()), the default configuration file + bf(crossroads.conf), the default configuration file manpageseealso() itemization( diff --git a/etc/Makefile.conf b/etc/Makefile.conf @@ -1,14 +1,13 @@ # The used C compiler. -CC := $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache c-compiler) +CC := $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache c-compiler) # Link time libraries. -LIBS := $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache lib \ +LIBS := $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache lib \ ucb nsl pthread socket m 2>/dev/null) # Compiletime defines. Remember to update show_config() when changing # this list! -DEFS := -DDEFAULT_CONF='"$(DEFAULT_CONF)"' \ - -DSLEEP_TIME=$(SLEEP_TIME) -DDNS_CACHESIZE=$(DNS_CACHESIZE) \ +DEFS := -DSLEEP_TIME=$(SLEEP_TIME) -DDNS_CACHESIZE=$(DNS_CACHESIZE) \ -DDNS_CACHETTL=$(DNS_CACHETTL) -DDEF_MAX=$(DEF_MAX) \ -DCONNECT_TIMEOUT=$(CONNECT_TIMEOUT) -DVER='"$(VER)/$(REVVER)"' \ -DSET_PROC_TITLE_BY_ARGV=$(SET_PROC_TITLE_BY_ARGV) \ @@ -19,27 +18,27 @@ DEFS := -DDEFAULT_CONF='"$(DEFAULT_CONF)"' \ -DAUTHORNAME='"$(AUTHORNAME)"' -DMAINTAINERNAME='"$(MAINTAINERNAME)"' \ -DMAINTAINEREMAIL='"$(MAINTAINEREMAIL)"' -DFQDN_LENGTH=$(FQDN_LENGTH) \ -DDEFAULT_SPT_BUFSIZE=$(DEFAULT_SPT_BUFSIZE) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ ifheader01 malloc.h HAVE_MALLOC_H) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ ifheader01 stdint.h HAVE_STDINT_H) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 flock HAVE_FLOCK) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 lockf HAVE_LOCKF) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 strlcat HAVE_STRLCAT) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 sranddev HAVE_SRANDDEV) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 vsyslog HAVE_VSYSLOG) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 strcasestr HAVE_STRCASESTR) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 setproctitle HAVE_SETPROCTITLE) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 strupr HAVE_STRUPR) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libfunction01 strnstr HAVE_STRNSTR) \ - $(shell $(BASE)/tools/c-conf -c $(BASE)/src/c-conf.cache \ + $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache \ libvariable01 __progname_full HAVE_PROGNAME_FULL) 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.78 +VER = 1.79 # Years that Crossroads has been 'round. YEARS = 2005-2007 @@ -19,9 +19,6 @@ MAINTAINEREMAIL = karel@kubat.nl # Revision version, auto-detected. REVVER = $(shell $(BASE)/etc/svnrev $(BASE)/ChangeLog $(BASE)/etc/svnrev.txt) -# Default config -DEFAULT_CONF = /etc/crossroads.conf - # The length of a fully qualified domain name. See RFC2181. FQDN_LENGTH = 256 diff --git a/etc/Makefile.help b/etc/Makefile.help @@ -30,4 +30,6 @@ Make what? Choose: /tmp/crossroads-VERSION.tar.gz, Yodl etc. required make commit Creates documentation, cleans up, commits into SVN. +(If your GNU make is called 'gmake', just type with 'gmake <whatever>'.) + ============================================================================ diff --git a/etc/svnrev.txt b/etc/svnrev.txt @@ -1 +1 @@ -229 +231 diff --git a/src/Makefile b/src/Makefile @@ -5,37 +5,37 @@ DIRS = lib crossroads crossroads-daemon crossroads-mgr all: prep for d in ${DIRS}; do \ echo "Making all in $$d"; \ - echo BASE=$(BASE) PG=$(PG) G=$(G) make -C $$d all; \ - BASE=$(BASE) PG=$(PG) G=$(G) make -C $$d all || exit 1; \ + echo BASE=$(BASE) PG=$(PG) G=$(G) $(MAKE) -C $$d all; \ + BASE=$(BASE) PG=$(PG) G=$(G) $(MAKE) -C $$d all || exit 1; \ done install: prep for d in ${DIRS}; do \ echo "Making install in $$d"; \ - echo BASE=$(BASE) PG=$(PG) G=$(G) make -C $$d install; \ - BASE=$(BASE) make -C $$d install || exit 1; \ + echo BASE=$(BASE) PG=$(PG) G=$(G) $(MAKE) -C $$d install; \ + BASE=$(BASE) $(MAKE) -C $$d install || exit 1; \ done dbginstall: prep for d in ${DIRS}; do \ echo "Making dbginstall in $$d"; \ - echo BASE=$(BASE) PG=$(PG) G=$(G) make -C $$d dbginstall; \ - BASE=$(BASE) make -C $$d dbginstall || exit 1; \ + echo BASE=$(BASE) PG=$(PG) G=$(G) $(MAKE) -C $$d dbginstall; \ + BASE=$(BASE) $(MAKE) -C $$d dbginstall || exit 1; \ done clean: for d in ${DIRS}; do \ echo "Making clean in $$d"; \ - echo BASE=$(BASE) make -C $$d clean; \ - BASE=$(BASE) make -C $$d clean || exit 1; \ + echo BASE=$(BASE) $(MAKE) -C $$d clean; \ + BASE=$(BASE) $(MAKE) -C $$d clean || exit 1; \ done rm -f c-conf.cache distclean: for d in ${DIRS}; do \ echo "Making distclean in $$d"; \ - echo BASE=$(BASE) make -C $$d distclean; \ - BASE=$(BASE) make -C $$d distclean || exit 1; \ + echo BASE=$(BASE) $(MAKE) -C $$d distclean; \ + BASE=$(BASE) $(MAKE) -C $$d distclean || exit 1; \ done rm -f c-conf.cache diff --git a/src/crossroads-daemon/Makefile b/src/crossroads-daemon/Makefile @@ -2,7 +2,8 @@ include $(BASE)/etc/Makefile.def include $(BASE)/etc/Makefile.conf BIN = crossroads-daemon -all: $(BIN) +all: + BASE=$(BASE) $(MAKE) $(BIN) dbginstall: all $(BINDIR)/$(BIN) 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.h b/src/crossroads.h @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -340,6 +340,7 @@ EXTERN char **org_argv; /* and original argv */ EXTERN int parser_debug; /* lexer/parser debugging */ EXTERN ParserState *parserstate; /* parser state */ EXTERN int nparserstate; /* size of array */ +EXTERN char *program_name; /* fully expanded argv[0] */ EXTERN Programstage program_stage; /* stage of the program */ EXTERN int relevant_sigs[]; /* relevant signals */ EXTERN int reload_allow_deny; /* flag to reload spec files */ @@ -388,6 +389,7 @@ extern void dealloc_reporter (Service *s); extern struct in_addr *dns (char const *hostname); extern void error (char const *fmt, ...) __attribute__ ((format (printf, 1, 2))); +extern void expand_program_name (char const *av0); extern char *gmtstamp (int offset); extern unsigned hashpjw (char const *s); extern void http_copy (HttpHeader *h, int src_sock, int dst_sock, diff --git a/src/crossroads/Makefile b/src/crossroads/Makefile @@ -2,7 +2,8 @@ include $(BASE)/etc/Makefile.def include $(BASE)/etc/Makefile.conf BIN = crossroads -all: $(BIN) +all: + BASE=$(BASE) $(MAKE) $(BIN) dbginstall: all $(BINDIR)/$(BIN) diff --git a/src/crossroads/main.c b/src/crossroads/main.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -17,6 +17,7 @@ int main (int argc, char **argv) { int o; unsigned i; int dumpconf = 0; + char *cp; static Handler handler[] = { /* Argument Nr.args Needconf Handler function */ /* -1=no check */ @@ -29,9 +30,33 @@ int main (int argc, char **argv) { { "configtest", 0, 1, cmd_configtest }, }; + /* Expand argv[0] to a full program path */ + expand_program_name (argv[0]); + /* Remember original ac/av/ep */ org_argc = argc; org_argv = argv; + org_argv[0] = program_name; + + /* Find the configuration file, relative to this program or as + * /etc/crossroads.conf. + */ + config_file = xstrdup (program_name); + if ( (cp = strstr (config_file, "/bin/")) ) { + *cp = 0; + config_file = xstrcat (config_file, "/etc/crossroads.conf"); + } else if ( (cp = strstr (config_file, "/sbin/")) ) { + *cp = 0; + config_file = xstrcat (config_file, "/etc/crossroads.conf"); + } else { + free (config_file); + config_file = xstrdup ("/etc/crossroads.conf"); + } + if (access (config_file, R_OK) && + strcmp (config_file, "/etc/crossroads.conf")) { + free (config_file); + config_file = xstrdup ("/etc/crossroads.conf"); + } /* Parse the command line. * NOTE: When changing the options list, remember to update: @@ -97,7 +122,7 @@ int main (int argc, char **argv) { /* Request to dump binary configuration? */ if (dumpconf) { - msg ("Parsing configuration %s", config_file); + msg ("Parsing configuration '%s'", config_file); parser_open (config_file); parser_run(); parser_close(); diff --git a/src/lib/Makefile b/src/lib/Makefile @@ -6,9 +6,9 @@ SRC := $(wildcard *.c) OBJ := $(patsubst %.c, %.o, $(SRC)) all: - BASE=$(BASE) make textconv - BASE=$(BASE) make grammar - BASE=$(BASE) make $(LIB) + BASE=$(BASE) $(MAKE) textconv + BASE=$(BASE) $(MAKE) grammar + BASE=$(BASE) $(MAKE) $(LIB) dbginstall: install install: all diff --git a/src/lib/allocreporter.c b/src/lib/allocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -16,12 +16,10 @@ int backend_available (int target) { (activeservice->backend[target].maxconnections == 0 || activeservice->backend[target].maxconnections > servicereport->backendstate[target].nclients)) { - msg ("Service %s: backend %s is available", - activeservice->name, activeservice->backend[target].name); + msg ("Backend %s is available", activeservice->backend[target].name); return (1); } - msg ("Service %s: backend %s is unavailable", - activeservice->name, activeservice->backend[target].name); + msg ("Bckend %s is unavailable", activeservice->backend[target].name); return (0); } diff --git a/src/lib/backendconnect.c b/src/lib/backendconnect.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -21,12 +21,10 @@ int backend_connect () { /* Create the socket. */ if ( (sock = socket (PF_INET, SOCK_STREAM, 0)) < 0 ) { if (program_stage != stage_retrying) { - error ("Service %s: failed to create socket " - "for backend communication: %s", - activeservice->name, strerror(errno)); + error ("failed to create socket for backend communication: %s", + strerror(errno)); } else { - warning ("Service %s: failed to create socket " - "for backend communication: %s", + warning ("failed to create socket for backend communication: %s", activeservice->name, strerror(errno)); return (-1); } @@ -36,8 +34,8 @@ int backend_connect () { /* Make sure we don't get SIGPIPE's on it. Not supported on all * platforms. */ if (setsockopt (sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val))) { - warning ("Service %s: cannot set backend socket options " - "(nosigpipe): %s", activeservice->name, strerror(errno)); + warning ("cannot set backend socket options (nosigpipe): %s", + activeservice->name, strerror(errno)); close (sock); return (-2); } @@ -49,24 +47,21 @@ int backend_connect () { servicereport->backendstate[current_backend].actual_server, servicereport->backendstate[current_backend].actual_port)) { /* The hostname is unusable.. */ - warning ("Service %s: unknown host %s", - activeservice->name, + warning ("unknown host %s", servicereport->backendstate[current_backend].actual_server); close (sock); mark_activity (0, 0, st_unavailable); return (-3); } if (program_stage != stage_retrying) - msg ("Service %s: Network socket to %s:%d created", - activeservice->name, + msg ("Network socket to %s:%d created", 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 && servicereport->backendstate[current_backend].fail > 0) { - msg ("Service %s: Seen %d retries, waiting a bit", - activeservice->name, + msg ("Seen %d retries, waiting a bit", servicereport->backendstate[current_backend].fail); sleep (RETRY_WAIT); } @@ -91,14 +86,12 @@ int backend_connect () { if (program_stage != stage_retrying) { if (timed_out) warning ( - "Service %s: server %s:%d not usable due to timeout", - activeservice->name, + "server %s:%d not usable due to timeout", servicereport->backendstate[current_backend].actual_server, servicereport->backendstate[current_backend].actual_port); else warning ( - "Service %s: server %s:%d: cannot connect: %s", - activeservice->name, + "server %s:%d: cannot connect: %s", servicereport->backendstate[current_backend].actual_server, servicereport->backendstate[current_backend].actual_port, strerror(errno)); diff --git a/src/lib/backendcount.c b/src/lib/backendcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,6 +11,6 @@ int backend_count () { for (i = 0; i < activeservice->nbackend; i++) if (backend_available(i)) n++; - msg ("Service %s: %d backend(s) available", activeservice->name, n); + msg ("%d backend(s) available", n); return (n); } diff --git a/src/lib/checkservice.c b/src/lib/checkservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -22,9 +22,7 @@ void choose_backend () { /* Check that we're allowed to accept at all. */ if (activeservice->maxconnections && servicereport->nclients >= activeservice->maxconnections) { - warning ("Service %s: max clients %d exceeded", - activeservice->name, - activeservice->maxconnections); + warning ("max clients %d exceeded", activeservice->maxconnections); current_backend = -1; return; } @@ -33,19 +31,16 @@ void choose_backend () { * is up. If it is, take that target. */ if (activeservice->dispatchtype == ds_byclientip) { h = hashpjw (client_ip) % activeservice->nbackend; - msg ("Service %s: Client IP %s hashed to back end index %d", - activeservice->name, client_ip, h); + msg ("Client IP %s hashed to back end index %d", client_ip, h); if (servicereport->backendstate[h].actual_avail == st_available && (activeservice->backend[h].maxconnections == 0 || activeservice->backend[h].maxconnections > servicereport->backendstate[h].nclients)) { - msg ("Service %s: Hashed back end %d is acceptable", - activeservice->name, h); + msg ("Hashed back end %d is acceptable", h); current_backend = h; return; } else - msg ("Service %s: Hashed back end %d is not available, " - "re-dispatching", activeservice->name, h); + msg ("Hashed back end %d is not available, redispatching", h); } /* Populate the array of selectable backends. */ @@ -59,10 +54,8 @@ void choose_backend () { (activeservice->backend[i].maxconnections == 0 || activeservice->backend[i].maxconnections > servicereport->backendstate[i].nclients)) { - msg ("Service %s: " - "candidate back end: %d (max clients %d, active %d, " + msg ("candidate back end: %d (max clients %d, active %d, " "state %s)", - activeservice->name, i, activeservice->backend[i].maxconnections, servicereport->backendstate[i].nclients, state_to_string(servicereport->backendstate[i].actual_avail)); @@ -78,8 +71,7 @@ void choose_backend () { sleep (RETRY_WAIT); if (activeservice->dispatchtype != ds_externalhandler) { current_backend = -1; - warning ("Service %s: No active backends to select!", - activeservice->name); + warning ("No active backends to select!"); return; } } @@ -91,8 +83,7 @@ void choose_backend () { if (nbackends == 1 && activeservice->dispatchtype != ds_externalhandler) { current_backend = backends[0]; servicereport->last_backend = current_backend; - msg ("Service %s: only 1 backend to select (%d)", - activeservice->name, current_backend); + msg ("only 1 backend to select (%d)", current_backend); free (backends); return; } @@ -103,25 +94,22 @@ void choose_backend () { case ds_roundrobin: /* Find the currently used backend, go one forward. */ - msg ("Service %s: last roundrobin back end was %d", - activeservice->name, servicereport->last_backend); + msg ("last roundrobin back end was %d", servicereport->last_backend); for (i = 0; i < nbackends; i++) if (backends[i] == servicereport->last_backend) { i++; i %= nbackends; current_backend = backends[i]; servicereport->last_backend = current_backend; - msg ("Service %s: next roundrobin back end is %d", - activeservice->name, current_backend); + msg ("next roundrobin back end is %d", current_backend); free (backends); return; } /* None found.. try the first one (run to momma). */ current_backend = backends[0]; servicereport->last_backend = current_backend; - msg ("Service %s: " - "chosen backend (roundrobin, without historical info): %d", - activeservice->name, current_backend); + msg ("chosen backend (roundrobin, without historical info): %d", + current_backend); free (backends); return; @@ -129,12 +117,11 @@ void choose_backend () { /* Re-randomize. */ # if HAVE_SRANDDEV == 1 sranddev(); - msg ("Service %s: randomier seeded with randdev", activeservice->name); + msg ("randomizer seeded with randdev"); # else gettimeofday (&tv, 0); srand ((unsigned) tv.tv_usec); - msg ("Service %s: randomizer seeded with %u", - activeservice->name, (unsigned) tv.tv_usec); + msg ("randomizer seeded with %u", (unsigned) tv.tv_usec); # endif /* First of all let's see if all the weights are the same. */ @@ -219,9 +206,8 @@ void choose_backend () { current_backend = backends[sel_weights[i]]; servicereport->last_backend = current_backend; free (sel_weights); - msg ("Service %s: " - "chosen backend (weighted random): %d at index %d", - activeservice->name, current_backend, i); + msg ("chosen backend (weighted random): %d at index %d", + current_backend, i); free (backends); free (values); free (weights); @@ -231,8 +217,7 @@ void choose_backend () { /* ELSE: Choose a random one of the availables. */ current_backend = backends[rand() % nbackends]; servicereport->last_backend = current_backend; - msg ("Service %s: chosen backend (flat-weight random): %d", - activeservice->name, current_backend); + msg ("chosen backend (flat-weight random): %d", current_backend); free (backends); free (values); return; @@ -252,10 +237,8 @@ void choose_backend () { else values[i] = servicereport->backendstate[backends[i]].nbytes * activeservice->backend[backends[i]].weight; - msg ("Service %s: " - "by size weighing backend %d has weight %d, value %u" + msg ("by size weighing backend %d has weight %d, value %u" " (bytes=%u, avgbytes=%u)", - activeservice->name, backends[i], activeservice->backend[backends[i]].weight, (unsigned) values[i], @@ -269,12 +252,10 @@ void choose_backend () { nbest = values[i]; current_backend = backends[i]; servicereport->last_backend = current_backend; - msg ("Service %s: " - "by size weighing: best so far is %d (value %g)", - activeservice->name, current_backend, nbest); + msg ("by size weighing: best so far is %d (value %g)", + current_backend, nbest); } - msg ("Service %s: chosen backend (by size): %d", - activeservice->name, current_backend); + msg ("chosen backend (by size): %d", current_backend); free (backends); free (values); return; @@ -296,9 +277,8 @@ void choose_backend () { values[i] = servicereport->backendstate[backends[i]].nsec * 1000000 * activeservice->backend[backends[i]].weight; - msg ("Service %s: By duration weighing: backend %d has value %g" + msg ("By duration weighing: backend %d has value %g" " (sec=%g, avgsec=%g, weight=%d)", - activeservice->name, backends[i], values[i], servicereport->backendstate[backends[i]].nsec, servicereport->backendstate[backends[i]].avg_nsec, @@ -310,12 +290,10 @@ void choose_backend () { nbest = values[i]; current_backend = backends[i]; servicereport->last_backend = current_backend; - msg ("Service %s: " - "by duration weighing: best so far is %d (value %g)", - activeservice->name, current_backend, nbest); + msg ("by duration weighing: best so far is %d (value %g)", + current_backend, nbest); } - msg ("Service %s: chosen backend (by duration): %d", - activeservice->name, current_backend); + msg ("chosen backend (by duration): %d", current_backend); free (backends); free (values); return; @@ -324,8 +302,7 @@ void choose_backend () { /* Get the first available back end in line. */ current_backend = backends[0]; servicereport->last_backend = current_backend; - msg ("Service %s: chosen backend (by order): %d", - activeservice->name, current_backend); + msg ("chosen backend (by order): %d", current_backend); free (backends); return; @@ -338,9 +315,8 @@ void choose_backend () { values[i] = servicereport->backendstate[backends[i]].nclients * activeservice->backend[backends[i]].weight; - msg ("Service %s: " - "by connections weighing: backend %d has value %g", - activeservice->name, backends[i], values[i]); + msg ("by connections weighing: backend %d has value %g", + backends[i], values[i]); } /* Find the minimum in the values array. */ for (i = 0; i < nbackends; i++) @@ -348,12 +324,10 @@ void choose_backend () { nclients = values[i]; current_backend = backends[i]; servicereport->last_backend = current_backend; - msg ("Service %s: " - "by connections weighing: best so far is %d (value %u)", - activeservice->name, current_backend, nclients); + msg ("by connections weighing: best so far is %d (value %u)", + current_backend, nclients); } - msg ("Service %s: chosen backend (by connections): %d", - activeservice->name, current_backend); + msg ("chosen backend (by connections): %d", current_backend); free (backends); free (values); return; @@ -362,13 +336,12 @@ void choose_backend () { /* External handler to be called. Assume selection will fail. */ current_backend = -1; exthandler = str_expand_format (activeservice->dispatchext); - msg ("Service %s: calling external handler '%s'", - activeservice->name, exthandler); + msg ("calling external handler '%s'", exthandler); signal (SIGCHLD, SIG_DFL); uid_assume(); if (! (f = popen (exthandler, "r")) ) { - warning ("Service %s: failed to start external handler '%s': %s", - activeservice->name, exthandler, strerror(errno)); + warning ("failed to start external handler '%s': %s", + exthandler, strerror(errno)); if (nbackends > 0) { current_backend = backends[0]; servicereport->last_backend = current_backend; @@ -382,19 +355,16 @@ void choose_backend () { } while (1) { if (fscanf (f, " %80s ", buf) < 1) { - msg ("Service %s: external handler signals end", - activeservice->name); + msg ("external handler signals end"); pclose (f); uid_restore(); signal (SIGCHLD, SIG_IGN); break; } - msg ("Service %s: external handler says '%s'", - activeservice->name, buf); + msg ("external handler says '%s'", buf); for (i = 0; i < activeservice->nbackend; i++) { if (!strcmp (buf, activeservice->backend[i].name)) { - msg ("Service %s: selecting back end %s due to " - "external handler", activeservice->name, buf); + msg ("selecting back end %s due to external handler", buf); current_backend = i; servicereport->last_backend = current_backend; pclose (f); @@ -406,8 +376,8 @@ void choose_backend () { } } } - warning ("Service %s: external handler '%s' didn't reply with " - "a selectable back end", activeservice->name, exthandler); + warning ("external handler '%s' didn't reply with a selectable back end", + exthandler); if (nbackends > 0) current_backend = backends[0]; servicereport->last_backend = current_backend; @@ -417,7 +387,7 @@ void choose_backend () { default: /* Internal fry.. */ - error ("Service %s: internal error: unhandled dispatch type %d", - activeservice->name, activeservice->dispatchtype); + error ("internal error: unhandled dispatch type %d", + activeservice->dispatchtype); } } diff --git a/src/lib/cmdconfigtest.c b/src/lib/cmdconfigtest.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/cmdrestart.c b/src/lib/cmdrestart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/cmdservices.c b/src/lib/cmdservices.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/cmdstart.c b/src/lib/cmdstart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/cmdstatus.c b/src/lib/cmdstatus.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/cmdstop.c b/src/lib/cmdstop.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/cmdtell.c b/src/lib/cmdtell.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/configmsg.c b/src/lib/configmsg.c @@ -1,16 +1,16 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" -#define MSGSTR(x,y) msg(x ": [%s]", y) +#define MSGSTR(x,y) msg(x ": [%s]", y ? y : "<none>") #define MSGUNS(x,y) msg(x ": [%u]", y) #define MSGINT(x,y) msg(x ": [%d]", y) -#define BMSGSTR(x,y,z) msg("Backend %d: " y " [%s]", x + 1, z) +#define BMSGSTR(x,y,z) msg("Backend %d: " y " [%s]", x + 1, z ? z : "<none>") #define BMSGINT(x,y,z) msg("Backend %d: " y " [%d]", x + 1, z) #define BMSGUNS(x,y,z) msg("Backend %d: " y " [%u]", x + 1, z) diff --git a/src/lib/configread.c b/src/lib/configread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,11 +1,14 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" +/* For debugging, uncomment: */ +#define DEBUG + static void wr (int fd, void const *buf, unsigned len) { int res; int towrite = (int)len; @@ -14,19 +17,32 @@ static void wr (int fd, void const *buf, unsigned len) { error ("Failed to transmit %d bytes (%d)", towrite, res); } -static void wr_int (int fd, int x) { +static void wr_int (int fd, int x, char const *desc) { + #ifdef DEBUG + msg ("Configwrite: int %d (%u bytes), %s", x, (unsigned)sizeof(int), desc); + #endif wr (fd, &x, sizeof(int)); } -static void wr_uns (int fd, unsigned x) { +static void wr_uns (int fd, unsigned x, char const *desc) { + #ifdef DEBUG + msg ("Configwrite: unsigned %u (%u bytes), %s", x, (unsigned)sizeof(int), + desc); + #endif wr (fd, &x, sizeof(unsigned)); } -static void wr_str (int fd, char const *s) { - if (!s || !*s) - wr_int (fd, 0); - else { - wr_int (fd, strlen(s)); +static void wr_str (int fd, char const *s, char const *desc) { + if (!s || !*s) { + #ifdef DEBUG + msg ("Configwrite: empty string, %s", desc); + #endif + wr_int (fd, 0, "zero string length"); + } else { + #ifdef DEBUG + msg ("Configwrite: string %s (%u bytes), %s", s, (unsigned)strlen(s), desc); + #endif + wr_int (fd, strlen(s), "nonzero string length"); wr (fd, s, strlen(s)); } } @@ -35,82 +51,102 @@ void config_write (int fd) { int i, j, k; msg ("Writing binary service definition to fd %d", fd); - wr_int (fd, nservice); + wr_int (fd, nservice, "number of services"); for (i = 0; i < nservice; i++) { /* Basic stuff */ - wr_str (fd, service[i].name); - wr_str (fd, service[i].bind); - wr_uns (fd, service[i].port); - wr_uns (fd, service[i].verbosity); - wr_int (fd, (int)service[i].dispatchtype); - wr_uns (fd, service[i].dispatchover); - wr_str (fd, service[i].dispatchext); - wr_uns (fd, service[i].rev_interval); - wr_uns (fd, service[i].check_interval); - wr_str (fd, service[i].check_cmd); - wr_uns (fd, service[i].backlog); - wr_uns (fd, service[i].shmkey); - wr_uns (fd, service[i].connectiontimeout); - wr_uns (fd, service[i].maxconnections); - wr_int (fd, (int)service[i].type); - wr_str (fd, service[i].allowfile); - wr_str (fd, service[i].denyfile); - wr_int (fd, service[i].uid); - wr_int (fd, service[i].gid); - wr_int (fd, service[i].inspection); + wr_str (fd, service[i].name, "servicename"); + wr_str (fd, service[i].bind, "servicebind"); + wr_uns (fd, service[i].port, "serviceport"); + wr_uns (fd, service[i].verbosity, "serviceverbosity"); + wr_int (fd, (int)service[i].dispatchtype, "dispatchtype"); + wr_uns (fd, service[i].dispatchover, "dispatchover"); + wr_str (fd, service[i].dispatchext, "dispatchext"); + wr_uns (fd, service[i].rev_interval, "revivinginterval"); + wr_uns (fd, service[i].check_interval, "checkinterval"); + wr_str (fd, service[i].check_cmd, "checkcommand"); + wr_uns (fd, service[i].backlog, "backlog"); + wr_uns (fd, service[i].shmkey, "shmkey"); + wr_uns (fd, service[i].connectiontimeout, "connectiontimeout"); + wr_uns (fd, service[i].maxconnections, "maxconnections"); + wr_int (fd, (int)service[i].type, "type"); + wr_str (fd, service[i].allowfile, "allowfile"); + wr_str (fd, service[i].denyfile, "denyfile"); + wr_int (fd, service[i].uid, "uid"); + wr_int (fd, service[i].gid, "gid"); + wr_int (fd, service[i].inspection, "inspectiontype"); /* Deny chain */ - wr_int (fd, service[i].ndenychain); + wr_int (fd, service[i].ndenychain, "sizeof denychain"); for (j = 0; j < service[i].ndenychain; j++) { - wr_uns (fd, service[i].denychain[j].ip); - wr_uns (fd, service[i].denychain[j].mask); + wr_uns (fd, service[i].denychain[j].ip, "denied ip"); + wr_uns (fd, service[i].denychain[j].mask, "denied mask"); } /* Allow chain */ - wr_int (fd, service[i].nallowchain); + wr_int (fd, service[i].nallowchain, "sizeof allowchain"); for (j = 0; j < service[i].nallowchain; j++) { - wr_uns (fd, service[i].allowchain[j].ip); - wr_uns (fd, service[i].allowchain[j].mask); + wr_uns (fd, service[i].allowchain[j].ip, "allowed ip"); + wr_uns (fd, service[i].allowchain[j].mask, "allowed mask"); } /* Back ends */ - wr_int (fd, service[i].nbackend); + wr_int (fd, service[i].nbackend, "nr of backends"); for (j = 0; j < service[i].nbackend; j++) { - wr_str (fd, service[i].backend[j].name); - 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); - wr_str (fd, service[i].backend[j].onstart); - wr_str (fd, service[i].backend[j].onend); - wr_str (fd, service[i].backend[j].dumpfile); - wr_str (fd, service[i].backend[j].thruputfile); - wr_str (fd, service[i].backend[j].timinglog); - 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_str (fd, service[i].backend[j].name, "backend name"); + wr_int (fd, service[i].backend[j].initial_port, "backend port"); + wr_str (fd, service[i].backend[j].initial_server, "backend server"); + wr_int (fd, service[i].backend[j].verbosity, "backend verbosity"); + wr_int (fd, service[i].backend[j].weight, "backend weight"); + wr_int (fd, service[i].backend[j].decay, "backend decay"); + wr_str (fd, service[i].backend[j].onstart, "backend onstart"); + wr_str (fd, service[i].backend[j].onend, "backend onend"); + wr_str (fd, service[i].backend[j].dumpfile, "backend dumpfile"); + wr_str (fd, service[i].backend[j].thruputfile, + "backend thruputfile"); + wr_str (fd, service[i].backend[j].timinglog, "backend timinglog"); + wr_uns (fd, service[i].backend[j].maxconnections, + "backend maxcconnections"); + wr_str (fd, service[i].backend[j].stickycookie, + "backend stickycookie"); + wr_int (fd, service[i].backend[j].retries, "backend retries"); + wr_int (fd, service[i].backend[j].initial_avail, + "backend availability"); - wr_int (fd, service[i].backend[j].naddclientheader); + wr_int (fd, service[i].backend[j].naddclientheader, + "nr of clientheaders to add"); for (k = 0; k < service[i].backend[j].naddclientheader; k++) - wr_str (fd, service[i].backend[j].addclientheader[k]); - wr_int (fd, service[i].backend[j].nsetclientheader); + wr_str (fd, service[i].backend[j].addclientheader[k], + "client header to add"); + + wr_int (fd, service[i].backend[j].nsetclientheader, + "nr of client headers to set"); for (k = 0; k < service[i].backend[j].nsetclientheader; k++) - wr_str (fd, service[i].backend[j].setclientheader[k]); - wr_int (fd, service[i].backend[j].nappendclientheader); + wr_str (fd, service[i].backend[j].setclientheader[k], + "client header to set"); + + wr_int (fd, service[i].backend[j].nappendclientheader, + "nr of client headers to append"); for (k = 0; k < service[i].backend[j].nappendclientheader; k++) - wr_str (fd, service[i].backend[j].appendclientheader[k]); + wr_str (fd, service[i].backend[j].appendclientheader[k], + "client header to append"); - wr_int (fd, service[i].backend[j].naddserverheader); + wr_int (fd, service[i].backend[j].naddserverheader, + "nr of server headers to add"); for (k = 0; k < service[i].backend[j].naddserverheader; k++) - wr_str (fd, service[i].backend[j].addserverheader[k]); - wr_int (fd, service[i].backend[j].nsetserverheader); + wr_str (fd, service[i].backend[j].addserverheader[k], + "server header to add"); + + wr_int (fd, service[i].backend[j].nsetserverheader, + "nr of server headers to set"); for (k = 0; k < service[i].backend[j].nsetserverheader; k++) - wr_str (fd, service[i].backend[j].setserverheader[k]); - wr_int (fd, service[i].backend[j].nappendserverheader); + wr_str (fd, service[i].backend[j].setserverheader[k], + "server header to set"); + + wr_int (fd, service[i].backend[j].nappendserverheader, + "nr of server headers to append"); for (k = 0; k < service[i].backend[j].nappendserverheader; k++) - wr_str (fd, service[i].backend[j].appendserverheader[k]); + wr_str (fd, service[i].backend[j].appendserverheader[k], + "server header to append"); } } } diff --git a/src/lib/copysockets.c b/src/lib/copysockets.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -17,11 +17,10 @@ Options opt = { 0644, /* shmperm */ 0, /* sloppyportbind */ - 0, /* leave_proctitle */ + 0, /* leave_proctitle */ + 0, /* log_http_activity */ }; -char *config_file = DEFAULT_CONF; - StateStringMap statestringmap[] = { { st_available, "available" }, { st_available, "up" }, diff --git a/src/lib/deallocreporter.c b/src/lib/deallocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,7 @@ void decr_client_count () { for (i = 0; i < activeservice->nbackend; i++) totclients += servicereport->backendstate[i].nclients; servicereport->nclients = totclients; - msg ("Service %s: total active clients now %u", - activeservice->name, totclients); + msg ("total active clients now %u", totclients); /* Warning: Use current_backend as index only if >= 0; it * may be -1 when still searching for an HTTP back end */ @@ -30,13 +29,14 @@ void decr_client_count () { unlock_reporter(); if (current_backend >= 0) { - msg ("Service %s: extcmd-onend: " - " current_backend = %d, clients = %d, " + msg ("extcmd-onend: " + "current_backend = %d, clients = %d, " "totclients = %d, cmd = %s", - activeservice->name, current_backend, + current_backend, servicereport->backendstate[current_backend].nclients, servicereport->nclients, - activeservice->backend[current_backend].onend); + activeservice->backend[current_backend].onend ? + activeservice->backend[current_backend].onend : "<none>"); sysrun (activeservice->backend[current_backend].onend); } diff --git a/src/lib/dns.c b/src/lib/dns.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -51,15 +51,14 @@ struct in_addr *dns (char const *hostname) { age = now - dnscache[i].stamp; if (age <= dns_cachettl) { if (program_stage != stage_retrying) - msg ("Service %s: host %s resolved from cache slot %d " - "(age: %d sec)", - activeservice->name, hostname, i, (int)age); + msg ("host %s resolved from cache slot %d (age: %d sec)", + hostname, i, (int)age); return (&(dnscache[i].hostaddr)); } else { if (program_stage != stage_retrying) - msg ("Service %s: host entry for %s is too old at slot %d " + msg ("host entry for %s is too old at slot %d " "(age: %d sec, ttl %d sec)", - activeservice->name, hostname, i, (int)age, + hostname, i, (int)age, dns_cachettl); target = i; break; @@ -72,8 +71,8 @@ struct in_addr *dns (char const *hostname) { if (i < DNS_CACHESIZE) { target = i; if (program_stage != stage_retrying) - msg ("Service %s: host entry '%s' at slot %d will be added", - activeservice->name, hostname, target); + msg ("host entry '%s' at slot %d will be added", + hostname, target); } else { for (i = 0; i < DNS_CACHESIZE; i++) if (i == 0 || dnscache[i].stamp < min) { @@ -82,9 +81,9 @@ struct in_addr *dns (char const *hostname) { } if (program_stage != stage_retrying) - msg ("Service %s: host entry '%s' at slot %d " + msg ("host entry '%s' at slot %d " "will be overwritten", - activeservice->name, hostname, target); + hostname, target); } } diff --git a/src/lib/error.c b/src/lib/error.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,10 +13,19 @@ void error (char const *fmt, ...) { if (fmt && *fmt) { va_start (args, fmt); str = str_vprintf (fmt, args); - if (!daemonized) - fprintf (stderr, "ERROR: %s\n", str); - else - writelog (LOG_ERR, "ERROR: %s", str); + if (!daemonized) { + if (activeservice) + fprintf (stderr, "ERROR, Service %s: %s\n", + activeservice->name, str); + else + fprintf (stderr, "ERROR: %s\n", str); + } else { + if (activeservice) + writelog (LOG_ERR, "ERROR, Service %s: %s", + activeservice->name, str); + else + writelog (LOG_ERR, "ERROR: %s", str); + } free (str); } exit (1); diff --git a/src/lib/expandprogamname.c b/src/lib/expandprogamname.c @@ -0,0 +1,30 @@ +/************************************************************************* + * This file is part of Crosroads 1.79, a load balancer and fail over + * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. + * Visit http://crossroads.e-tunity.com for information. + *************************************************************************/ + +#include "../crossroads.h" + +void expand_program_name (char const *av0) { + char *str, *cp, *last = (char*)expand_program_name; + + /* If we have path separators, then assume it's already expanded. */ + if (strchr (av0, '/')) { + program_name = xstrdup (av0); + return; + } + + /* Try to locate av0 along the PATH */ + str = xstrdup(getenv("PATH")); + for (cp = strtok_r (str, ":", &last); cp; cp = strtok_r (0, ":", &last)) { + free (program_name); + program_name = str_printf ("%s/crossroads", cp); + if (!access (program_name, R_OK | X_OK)) + return; + } + + /* All PATHs failed. Run back to av0. */ + free (program_name); + program_name = xstrdup(av0); +} diff --git a/src/lib/gmtstamp.c b/src/lib/gmtstamp.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -9,11 +9,9 @@ static void copy (int src, int dst, int dir, int tot) { int ncopied = 0, to_copy, bytes; unsigned char *buf; - msg ("Service %s: about to copy %d bytes from %s", - activeservice->name, tot, - dir == dir_client_to_server ? "client" : "server"); - msg ("Service %s: %d bytes in client buffer, %d in server buffer", - activeservice->name, + msg ("about to copy %d bytes from %s", + tot, dir == dir_client_to_server ? "client" : "server"); + msg ("%d bytes in client buffer, %d in server buffer", clbufmax ? clbufmax - clbufpos : 0, srbufmax ? srbufmax - srbufpos : 0); @@ -53,8 +51,7 @@ unsigned getchunk (int sock, int dest, CopyDirection dir) { if (*cp == '\n') { sscanf (hexbuf, "%x", &ret); free (hexbuf); - msg ("Service %s: Chunk size 0x%x (%d)", - activeservice->name, ret, ret); + msg ("Chunk size 0x%x (%d)", ret, ret); /* If the chunk size is zero, then match final [\r]\n */ if (ret == 0) { cp = net_bufread (sock, 1, 0, dir == dir_client_to_server); @@ -63,12 +60,11 @@ unsigned getchunk (int sock, int dest, CopyDirection dir) { cp = net_bufread (sock, 1, 0, dir == dir_client_to_server); net_write (dest, cp, 1, dir == dir_client_to_server); if (*cp != '\n') - warning ("Service %s: Chunks not terminated by \\r\\n " - "but by \\r <decimal>%d", - activeservice->name, *cp); + warning ("Chunks not terminated by \\r\\n " + "but by \\r <decimal>%d", *cp); } else if (*cp != '\n') - warning ("Service %s: Chunks not terminated by \r\n or \n " - "but by <decimal>%d", activeservice->name, *cp); + warning ("Chunks not terminated by \r\n or \n " + "but by <decimal>%d", *cp); } return (ret); } @@ -85,8 +81,7 @@ void http_copy (HttpHeader *h, int src, int dst, CopyDirection dir) { unsigned char const *mode, *cp; unsigned nbytes; - msg ("Service %s: copying HTTP body from %s", - activeservice->name, + msg ("copying HTTP body from %s", dir == dir_client_to_server ? "client to server" : "server to client"); @@ -99,16 +94,14 @@ void http_copy (HttpHeader *h, int src, int dst, CopyDirection dir) { if ( (mode = http_header_val (h, "transfer-encoding")) && *mode ) { if (strncasecmp ( (char const *) mode, "chunked", 7)) - error ("Service %s: can't handle transfer-encoding '%s'", - activeservice->name, mode); - msg ("Service %s: copying chunks from %s", - activeservice->name, dir == dir_client_to_server ? + error ("can't handle transfer-encoding '%s'", mode); + msg ("copying chunks from %s", + dir == dir_client_to_server ? "client to server" : "server to client"); while (1) { /* See how large the chunk will be. */ nbytes = getchunk (src, dst, dir); - msg ("Service %s: Next chunk is 0x%x (%d) bytes", - activeservice->name, nbytes, nbytes); + msg ("Next chunk is 0x%x (%d) bytes", nbytes, nbytes); /* Copy the chunk. Add 2 bytes for the \r\n that follows. */ copy (src, dst, dir, nbytes + 2); /* Last chunksize of 0 signals the end. */ @@ -118,22 +111,19 @@ void http_copy (HttpHeader *h, int src, int dst, CopyDirection dir) { } else if ( (mode = http_header_val (h, "content-length")) && mode ) { nbytes = atoi ( (char const *) mode ); - msg ("Service %s: copying %u bytes of content from %s", - activeservice->name, nbytes, + msg ("copying %u bytes of content from %s", + nbytes, dir == dir_client_to_server ? "client to server" : "server to client"); copy (src, dst, dir, nbytes); } else if (dir == dir_server_to_client) { - msg ("Service %s: Starting copy-thru on body sending towards client", - activeservice->name); + msg ("Starting copy-thru on body sending towards client"); if ( (cp = net_buffer (dir_server_to_client, &nbytes)) ) { - msg ("Service %s: Flushing server-side buffer to client, %u bytes", - activeservice->name, nbytes); + msg ("Flushing server-side buffer to client, %u bytes", nbytes); net_write (dst, cp, nbytes, 0); } copysockets (src, dst); } else { - msg ("Service %s: Not copying body (nothing to do)", - activeservice->name); + msg ("Not copying body (nothing to do)"); } } diff --git a/src/lib/httperror.c b/src/lib/httperror.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -26,7 +26,7 @@ void http_header_addheader (HttpHeader *m, char const *h) { char *exp; exp = str_expand_format (h); - msg ("Service %s: adding header '%s'", activeservice->name, exp); + msg ("adding header '%s'", exp); m->header = xrealloc (m->header, (m->nheader + 1) * sizeof(char*)); m->header[m->nheader++] = exp; SHOWHEADERS(m); diff --git a/src/lib/httpheaderappendheader.c b/src/lib/httpheaderappendheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -30,15 +30,14 @@ void http_header_appendheader (HttpHeader *m, char const *h) { if (!strncasecmp (m->header[i], hname, strlen(hname))) { m->header[i] = xstrcat (m->header[i], "; "); m->header[i] = xstrcat (m->header[i], exp); - /* msg ("Service %s: appending (after existing) header, now '%s'", - activeservice->name, m->header[i]); */ + /* msg ("appending (after existing) header, now '%s'", + m->header[i]); */ free (hname); return; } } - /* msg ("Service %s: appending (setting) header '%s'", - activeservice->name, h); */ + /* msg ("appending (setting) header '%s'", h); */ http_header_addheader (m, h); } diff --git a/src/lib/httpheaderconnectiontype.c b/src/lib/httpheaderconnectiontype.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,20 +12,16 @@ HttpConnectionType http_header_connectiontype (HttpHeader *h) { val = http_header_val (h, "connection"); if (!val) { - msg ("Service %s: Cannot determine connection type, " - "no such header", activeservice->name); + msg ("Cannot determine connection type, no such header"); return (con_unknown); } if (strcasestr ((char const *)val, "close")) { - msg ("Service %s: Connection-Type is CLOSE", - activeservice->name); + msg ("Connection-Type is CLOSE"); return (con_close); } else if (strcasestr ((char const *)val, "keep-alive")) { - msg ("Service %s: Connection-Type is KEEP-ALIVE", - activeservice->name); + msg ("Connection-Type is KEEP-ALIVE"); return (con_keepalive); } - warning ("Service %s: Unsupported Connection-Type '%s'", - activeservice->name, val); + warning ("Unsupported Connection-Type '%s'", val); return (con_unknown); } diff --git a/src/lib/httpheaderfree.c b/src/lib/httpheaderfree.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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 http_header_hascookie (HttpHeader *m, char const *cookie) { if (!cookie || !*cookie) return (0); if (! (val = http_header_val (m, "cookie")) ) { - msg ("Service %s: no cookies in HTTP message", activeservice->name); + msg ("no cookies in HTTP message"); return (0); } @@ -21,14 +21,12 @@ int http_header_hascookie (HttpHeader *m, char const *cookie) { while (*cp == ';' || *cp == ' ') cp++; if (!strncmp (cp, cookie, strlen (cookie))) { - msg ("Service %s: found cookie '%s' in '%s'", - activeservice->name, cookie, buf); + msg ("found cookie '%s' in '%s'", cookie, buf); free (buf); return (1); } } - msg ("Service %s: cookie '%s' not present in '%s'", - activeservice->name, cookie, buf); + msg ("cookie '%s' not present in '%s'", cookie, buf); free (buf); return (0); } diff --git a/src/lib/httpheaderhttpver.c b/src/lib/httpheaderhttpver.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,15 +10,13 @@ double http_header_httpver (HttpHeader *h) { /* We need at least a header line */ if (h->nheader < 1) { - warning ("Service %s: cannot get HTTP version, no headers", - activeservice->name); + warning ("cannot get HTTP version, no headers"); return (0.9); } /* We need HTTP/1.? length */ if (strlen (h->header[0]) < 8) { - warning ("Service %s: cannot get HTTP version, header line '%s'", - activeservice->name, h->header[0]); + warning ("cannot get HTTP version, header line '%s'", h->header[0]); return (0.9); } @@ -29,8 +27,7 @@ double http_header_httpver (HttpHeader *h) { else ret = atof (h->header[0] + strlen(h->header[0]) - 3); - msg ("Service %s: HTTP version is %g (headerline %s)", - activeservice->name, ret, h->header[0]); + msg ("HTTP version is %g (headerline %s)", ret, h->header[0]); return (ret); } diff --git a/src/lib/httpheadernew.c b/src/lib/httpheadernew.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,8 +34,7 @@ void http_header_read (HttpHeader *h, int sock, CopyDirection dir) { unsigned char *hdrbuf = 0, *start, *buf, *cp; int hdrbuflen = 0, usedlen, *bufpos, *bufmax, i; - msg ("Service %s: reading HTTP headers from %s", - activeservice->name, + msg ("reading HTTP headers from %s", dir == dir_client_to_server ? "client" : "server"); /* Read from network until we match [\r]\n[\r]\n */ diff --git a/src/lib/httpheaderremoveheader.c b/src/lib/httpheaderremoveheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,8 +13,7 @@ void http_header_removeheader (HttpHeader *h, char const *hdr) { if (h->header[i] && !strncasecmp (h->header[i], hdr, strlen(hdr))) { cp = h->header[i] + strlen(hdr); if (*cp == ':') { - msg ("Service %s: removing header '%s'", - activeservice->name, hdr); + msg ("removing header '%s'", hdr); free (h->header[i]); h->header[i] = 0; } diff --git a/src/lib/httpheadersetheader.c b/src/lib/httpheadersetheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -22,15 +22,14 @@ void http_header_setheader (HttpHeader *m, char const *h) { continue; if (!strncasecmp (m->header[i], hname, strlen(hname))) { free (m->header[i]); - msg ("Service %s: setting (replacing) header '%s'", - activeservice->name, exp); + msg ("setting (replacing) header '%s'", exp); m->header[i] = exp; free (hname); return; } } - msg ("Service %s: setting (adding) header '%s'", activeservice->name, exp); + msg ("setting (adding) header '%s'", exp); m->header = xrealloc (m->header, (m->nheader + 1) * sizeof(char*)); m->header[m->nheader++] = exp; free (hname); diff --git a/src/lib/httpheaderval.c b/src/lib/httpheaderval.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -8,16 +8,16 @@ void http_header_write (HttpHeader *m, int sock, CopyDirection dir) { int i; - msg ("Service %s: Sending %d HTTP headers to %s", - activeservice->name, m->nheader, + msg ("Sending %d HTTP headers to %s", + m->nheader, dir == dir_server_to_client ? "client" : "server"); for (i = 0; i < m->nheader; i++) { if (! m->header[i] || ! *m->header[i]) continue; /* - msg ("Service %s: sending header %d: '%s'", - activeservice->name, i, m->header[i]); + msg ("sending header %d: '%s'", + i, m->header[i]); */ http_write (sock, dir, (unsigned char const *) m->header[i], strlen(m->header[i])); diff --git a/src/lib/httpinsertheader.c b/src/lib/httpinsertheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/httplogactivity.c b/src/lib/httplogactivity.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -22,8 +22,7 @@ void http_log_activity (double start, double now, char const *fmt, ...) { "a")) && ! (f = fopen (activeservice->backend[current_backend].timinglog, "w")) ) { - warning ("Service %s: cannot write HTTP timings log %s: %s", - activeservice->name, + warning ("cannot write HTTP timings log %s: %s", activeservice->backend[current_backend].timinglog, strerror(errno)); return; diff --git a/src/lib/httpserve.c b/src/lib/httpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -93,14 +93,12 @@ void http_serve (int clientsock) { * HTTP/1.0 MUST be treated as single shot connection clients, even * when they specify Connection: Keep-Alive. */ if (http_header_httpver (clientreq) < 1.1) { - msg ("Service %s: Client talks HTTP < 1.1, forcing closing " - "connections", activeservice->name); + msg ("Client talks HTTP < 1.1, forcing closing connections"); http_header_setheader (clientreq, "Connection: close"); http_header_setheader (clientreq, "Proxy-Connection: close"); client_persisting = 0; } else if (http_header_connectiontype (clientreq) == con_close) { - msg ("Service %s: Client asks for connection closing", - activeservice->name); + msg ("Client asks for connection closing"); client_persisting = 0; } @@ -146,8 +144,7 @@ void http_serve (int clientsock) { * transfer. */ if (client_persisting && http_header_val (serverresp, "transfer-encoding")) { - msg ("Service %s: Server is sending chunks, forcing singleshot", - activeservice->name); + msg ("Server is sending chunks, forcing singleshot"); server_persisting = 0; client_persisting = 0; http_header_setheader (serverresp, "Connection: close"); @@ -158,14 +155,12 @@ void http_serve (int clientsock) { * inform the client. */ if (client_persisting) { if (http_header_httpver (serverresp) < 1.1) { - msg ("Service %s: Server talks HTTP < 1.1, forcing closing " - "connections", activeservice->name); + msg ("Server talks HTTP < 1.1, forcing closing connections"); http_header_setheader (serverresp, "Connection: close"); http_header_setheader (serverresp, "Proxy-Connection: close"); server_persisting = 0; } else if (http_header_connectiontype (serverresp) == con_close) { - msg ("Service %s: Server asks for connection closing", - activeservice->name); + msg ("Server asks for connection closing"); http_header_setheader (serverresp, "Connection: close"); http_header_setheader (serverresp, "Proxy-Connection: close"); server_persisting = 0; @@ -194,17 +189,15 @@ void http_serve (int clientsock) { /* Should we loop around? Go to copy-thru mode if either the * client or the server wants to stop. */ if (!client_persisting || !server_persisting) { - msg ("Service %s: non-persistent connection", - activeservice->name); + msg ("non-persistent connection"); break; } if (activeservice->inspection == ins_deep) - msg ("Service %s: Will analyze following requests over " - "the same TCP link", activeservice->name); + msg ("Will analyze following requests over the same TCP link"); else { - msg ("Service %s: Shallow analysis - won't analyze following " - "requests of the same TCP link", activeservice->name); + msg ("Shallow analysis - won't analyze following " + "requests of the same TCP link"); break; } } @@ -212,15 +205,15 @@ void http_serve (int clientsock) { /* We're done analyzing. If there's leftovers in the network buffers, * then we flush them first. */ if (clbufmax) { - msg ("Service %s: Flushing client-side buffer to server, %u bytes", - activeservice->name, clbufmax - clbufpos); + msg ("Flushing client-side buffer to server, %u bytes", + clbufmax - clbufpos); http_write (serversock, dir_client_to_server, clbuf + clbufpos, clbufmax - clbufpos); clbufmax = clbufpos = 0; } if (srbufmax) { - msg ("Service %s: Flushing server-side buffer to client, %u bytes", - activeservice->name, srbufmax - srbufpos); + msg ("Flushing server-side buffer to client, %u bytes", + srbufmax - srbufpos); http_write (clientsock, dir_server_to_client, srbuf + srbufpos, srbufmax - srbufpos); srbufmax = srbufpos = 0; @@ -228,8 +221,7 @@ void http_serve (int clientsock) { /* Copy through all that arrives on back end or client. * This doesn't return... */ - msg ("Service %s: HTTP service done analyzing, entering copy-thru mode", - activeservice->name); + msg ("HTTP service done analyzing, entering copy-thru mode"); /* This doesn't return */ copysockets (clientsock, serversock); diff --git a/src/lib/httpserversocket.c b/src/lib/httpserversocket.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -8,8 +8,7 @@ int http_serversocket (HttpHeader *m, int *is_continuation) { int i, sock; - msg ("Service %s: searching for back end for HTTP request.", - activeservice->name); + msg ("searching for back end for HTTP request"); /* Try to find a sticky cookie in the request. */ for (i = 0; i < activeservice->nbackend; i++) { @@ -21,8 +20,7 @@ int http_serversocket (HttpHeader *m, int *is_continuation) { continue; if (http_header_hascookie (m, activeservice->backend[i].stickycookie)) { - msg ("Service %s: HTTP backend %d selected due to cookie '%s'", - activeservice->name, + msg ("HTTP backend %d selected due to cookie '%s'", i, activeservice->backend[i].stickycookie); @@ -48,9 +46,7 @@ int http_serversocket (HttpHeader *m, int *is_continuation) { while (1) { /* No back end? Nogo. */ if (! backend_count()) { - msg ("Service %s: " - "out of back ends while scanning for HTTP back end", - activeservice->name); + msg ("out of back ends while scanning for HTTP back end"); return (-1); } @@ -61,8 +57,8 @@ int http_serversocket (HttpHeader *m, int *is_continuation) { return (-2); } - msg ("Service %s: trying back end %s for new HTTP connection", - activeservice->name, activeservice->backend[current_backend].name); + msg ("trying back end %s for new HTTP connection", + activeservice->backend[current_backend].name); if ( (sock = backend_connect ()) >= 0 ) { servicereport->backendstate[current_backend].sessions++; *is_continuation = 0; diff --git a/src/lib/httpwrite.c b/src/lib/httpwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -23,17 +23,18 @@ void incr_client_count () { servicereport->nclients = totclients; unlock_reporter(); - msg ("Service %s: extcmd-onstart: " + msg ("extcmd-onstart: " " current_backend = %d, clients = %d, totclients = %d, cmd = %s", - activeservice->name, current_backend, + current_backend, servicereport->backendstate[current_backend].nclients, servicereport->nclients, - activeservice->backend[current_backend].onstart); + activeservice->backend[current_backend].onstart ? + activeservice->backend[current_backend].onstart : "<none>"); sysrun (activeservice->backend[current_backend].onstart); - msg ("Service %s: Activity on back end %d now %d, total %d", - activeservice->name, current_backend, + msg ("Activity on back end %d now %d, total %d", + current_backend, servicereport->backendstate[current_backend].nclients, totclients); } diff --git a/src/lib/initsockaddr.c b/src/lib/initsockaddr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,8 +11,7 @@ int init_sockaddr (struct sockaddr_in *name, struct in_addr *hostaddr; if (program_stage != stage_retrying) - msg ("Service %s: trying to connect to backend %s:%d", - activeservice->name, hostname, port); + msg ("trying to connect to backend %s:%d", hostname, port); name->sin_family = AF_INET; name->sin_port = htons (port); if (! (hostaddr = dns (hostname)) ) diff --git a/src/lib/interrupt.c b/src/lib/interrupt.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -28,9 +28,8 @@ void interrupt (int sig) { switch (program_stage) { case stage_waiting: - warning ("Service %s: listener caught signal %d, " - "closing socket %d and exiting", - activeservice->name, sig, listen_sock); + warning ("listener caught signal %d, closing socket %d and exiting", + sig, listen_sock); shutdown (listen_sock, SHUT_RDWR); close (listen_sock); exit (0); @@ -41,9 +40,8 @@ void interrupt (int sig) { break; case stage_retrying: - warning ("Service %s: wakeup handler caught signal %d, " - "stopping wake ups and exiting", - activeservice->name, sig); + warning ("wakeup handler caught signal %d, " + "stopping wake ups and exiting", sig); exit (0); default: diff --git a/src/lib/ipfaddallow.c b/src/lib/ipfaddallow.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,23 +11,20 @@ int ipf_allowed () { /* Always allow a connection when we ddon't have an allow list. */ if (! activeservice->allowchain) { - msg ("Service %s: No allow chain (allowing client)", - activeservice->name); + msg ("No allow chain (allowing client)"); return (1); } /* Try all in the chain. */ for (i = 0; i < activeservice->nallowchain; i++) { - msg ("Service %s: Testing allow rule %d", activeservice->name, i); + msg ("Testing allow rule %d", i); if (ipf_match (activeservice->allowchain[i])) { - msg ("Service %s: Allowing client (rule %d)", - activeservice->name, i); + msg ("Allowing client (rule %d)", i); return (1); } } /* Allow chain doesn't match */ - msg ("Service %s: Not allowing client due to non-match of allow chain", - activeservice->name); + msg ("Not allowing client due to non-match of allow chain"); return (0); } diff --git a/src/lib/ipfdenied.c b/src/lib/ipfdenied.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,23 +11,20 @@ int ipf_denied () { /* Never deny a connection when we don't have a deny list. */ if (! activeservice->denychain) { - msg ("Service %s: No deny chain (not denying client)", - activeservice->name); + msg ("No deny chain (not denying client)"); return (0); } /* Try all in the chain. */ for (i = 0; i < activeservice->ndenychain; i++) { - msg ("Service %s: Testing deny rule %d", activeservice->name, i); + msg ("Testing deny rule %d", i); if (ipf_match (activeservice->denychain[i])) { - msg ("Service %s: Denying client (rule %d)", - activeservice->name, i); + msg ("Denying client (rule %d)", i); return (1); } } /* Deny chain doesn't match */ - msg ("Service %s: Not denying client, no deny rule matches", - activeservice->name); + msg ("Not denying client, no deny rule matches"); return (0); } diff --git a/src/lib/ipfloadfile.c b/src/lib/ipfloadfile.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -15,12 +15,10 @@ int ipf_loadfile (char const *fname, IpFilter **chain, int *nchain) { if (!fname || !*fname) return (0); - msg ("Service %s: loading IP filter file: '%s'", - activeservice->name, fname); + msg ("loading IP filter file: '%s'", fname); if (! (f = fopen (fname, "r")) ) { - warning ("Service %s: can't read filter file '%s': %s", - activeservice->name, fname, strerror(errno)); + warning ("can't read filter file '%s': %s", fname, strerror(errno)); return (0); } @@ -32,12 +30,10 @@ int ipf_loadfile (char const *fname, IpFilter **chain, int *nchain) { if (fscanf (f, " %79s ", buf) < 1) break; if (ipf_parse (buf, &filter)) { - warning ("Service %s: bad ip filter in file '%s'", - activeservice->name, fname); + warning ("bad ip filter in file '%s'", fname); ret++; } else { - msg ("Service %s: got ip filter specifier '%s'", - activeservice->name, buf); + msg ("got ip filter specifier '%s'", buf); *chain = xrealloc (*chain, (*nchain + 1) * sizeof(IpFilter)); (*chain)[*nchain] = filter; (*nchain)++; @@ -45,8 +41,8 @@ int ipf_loadfile (char const *fname, IpFilter **chain, int *nchain) { } } - msg ("Service %s: loaded IP filter file '%s': %d successfully loaded", - activeservice->name, fname, nloaded); + msg ("loaded IP filter file '%s': %d successfully loaded", + fname, nloaded); fclose (f); return (ret); diff --git a/src/lib/ipfmatch.c b/src/lib/ipfmatch.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,9 +11,8 @@ int ipf_match (IpFilter f) { unsigned c_ip_and_mask = client_ip_nr & f.mask; unsigned res = f_ip_and_mask == c_ip_and_mask; - msg ("Service %s: IP match: filter IP 0x%8.8x/0x%8.8x (0x%8.8x), " + msg ("IP match: filter IP 0x%8.8x/0x%8.8x (0x%8.8x), " "client IP 0x%8.8x/0x%8.8x (0x%8.8x), comparison %d", - activeservice->name, f.ip, f.mask, f_ip_and_mask, client_ip_nr, f.mask, c_ip_and_mask, res); diff --git a/src/lib/ipfparse.c b/src/lib/ipfparse.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/limitsmsg.c b/src/lib/limitsmsg.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -16,10 +16,16 @@ static Rlimits rlimits[] = { { RLIMIT_CPU, "max seconds CPU usage" }, { RLIMIT_DATA, "max bytes data segment usage" }, { RLIMIT_FSIZE, "max bytes in created files" }, + #ifdef RLIMIT_MEMLOCK { RLIMIT_MEMLOCK, "max bytes in locked memory" }, + #endif { RLIMIT_NOFILE, "max nr of open files" }, + #ifdef RLIMIT_NPROC { RLIMIT_NPROC, "max nr of processes of this id" }, + #endif + #ifdef RLIMIT_RSS { RLIMIT_RSS, "max bytes in resident memory" }, + #endif { RLIMIT_STACK, "max bytes in stack" }, }; @@ -30,13 +36,12 @@ void limits_msg () { if (!activeservice->verbosity) return; - msg ("*** Overview of run limits of service '%s' ***", activeservice->name); + msg ("*** Overview of run limits ***"); for (i = 0; i < sizeof(rlimits) / sizeof(Rlimits); i++) { if (getrlimit (rlimits[i].type, &lim)) - error ("Service %s: failed to get limits for '%s'", - activeservice->name, rlimits[i].desc); - msg ("%s: Limit for '%s': current %u, max %u", - activeservice->name, rlimits[i].desc, + error ("failed to get limits for '%s'", rlimits[i].desc); + msg ("Limit for '%s': current %u, max %u", + rlimits[i].desc, (unsigned) lim.rlim_cur, (unsigned)lim.rlim_max); } } diff --git a/src/lib/lockreporter.c b/src/lib/lockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivitycontinuation.c b/src/lib/logactivitycontinuation.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,20 +12,17 @@ int make_socket (int port, char const *ipaddr) { /* Create the socket. */ if ( (sock = socket (PF_INET, SOCK_STREAM, 0)) < 0) { - warning ("Service %s: cannot create network socket: %s", - activeservice->name, strerror(errno)); + warning ("cannot create network socket: %s", strerror(errno)); return (-1); } if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val))) { - warning ("Service %s: cannot set socket options (reuseaddr): %s", - activeservice->name, strerror(errno)); + warning ("cannot set socket options (reuseaddr): %s", strerror(errno)); close (sock); return (-2); } #ifdef SO_NOSIGPIPE if (setsockopt (sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val))) { - warning ("Service %s: cannot set socket options (nosigpipe): %s", - activeservice->name, strerror(errno)); + warning ("cannot set socket options (nosigpipe): %s", strerror(errno)); close (sock); return (-2); } @@ -37,16 +34,19 @@ int make_socket (int port, char const *ipaddr) { /* Propagate 'bindto' if given. */ if (ipaddr && *ipaddr && strcmp(ipaddr, "any")) { - msg ("Service %s: creating socket for IP address '%s'", - activeservice->name, ipaddr); + msg ("creating socket for IP address '%s'", ipaddr); if ( (name.sin_addr.s_addr = inet_addr (ipaddr)) == INADDR_NONE ) { close (sock); - error ("Service %s: cannot convert address '%s' to network bytes", - activeservice->name, ipaddr); + error ("cannot convert address '%s' to network bytes", ipaddr); } + /* + if (!inet_aton (ipaddr, &name.sin_addr.s_addr)) { + close (sock); + error ("Cannnot assign bindto address '%s'", ipaddr); + } + */ } else { - msg ("Service %s: creating socket for all interfaces", - activeservice->name); + msg ("creating socket for all interfaces"); name.sin_addr.s_addr = htonl (INADDR_ANY); } diff --git a/src/lib/markactivity.c b/src/lib/markactivity.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -28,8 +28,8 @@ void mark_activity (double nbytes, double nsec, st_unavailable && program_stage != stage_retrying) { servicereport->backendstate[current_backend].fail++; - msg ("Service %s: Back end %d's fail count increased to %d", - activeservice->name, current_backend, + msg ("Back end %d's fail count increased to %d", + current_backend, servicereport->backendstate[current_backend].fail); } else if (newstate == st_available) servicereport->backendstate[current_backend].fail = 0; @@ -95,8 +95,8 @@ void mark_activity (double nbytes, double nsec, if (newstate == st_unavailable) { if (servicereport->backendstate[current_backend].fail >= (unsigned) activeservice->backend[current_backend].retries) { - msg ("Service %s: backend %d: %d fails, %d retries, " - "going offline", activeservice->name, current_backend, + msg ("backend %d: %d fails, %d retries, going offline", + current_backend, servicereport->backendstate[current_backend].fail, activeservice->backend[current_backend].retries); servicereport->backendstate[current_backend].fail = 0; @@ -119,11 +119,10 @@ void mark_activity (double nbytes, double nsec, /* Give some feedback (though not during intermediate updates) */ if (newstate != st_intermediate && program_stage != stage_retrying) - msg ("Service %s: updated stats for backend %d (%s): " + msg ("updated stats for backend %d (%s): " "hits=%lu, " "totfails=%lu, secs=%g, avgsecs=%g, " "bytes=%g, avgbytes=%lu, state=%s", - activeservice->name, current_backend, activeservice->backend[current_backend].name, servicereport->backendstate[current_backend].totuses, servicereport->backendstate[current_backend].failures, @@ -136,9 +135,9 @@ void mark_activity (double nbytes, double nsec, /* Run the onfailure hook if one is specified. */ if (marked_unavailable && program_stage != stage_retrying) { - msg ("Service %s: extcmd-onfail: " + msg ("extcmd-onfail: " " current_backend = %d, clients = %d, totclients = %d, cmd = %s", - activeservice->name, current_backend, + current_backend, servicereport->backendstate[current_backend].nclients, servicereport->nclients, activeservice->backend[current_backend].onfail); diff --git a/src/lib/msg.c b/src/lib/msg.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -14,10 +14,18 @@ void msg (char const *fmt, ...) { return; va_start (args, fmt); str = str_vprintf (fmt, args); - if (!daemonized) - fprintf (stderr, "INFO: %s\n", str); - else - writelog (LOG_NOTICE, "INFO: %s", str); + if (!daemonized) { + if (activeservice) + fprintf (stderr, "INFO: Service %s: %s\n", activeservice->name, str); + else + fprintf (stderr, "INFO: Crossroads: %s\n", str); + } else { + if (activeservice) + writelog (LOG_NOTICE, "INFO: Service %s: %s", + activeservice->name, str); + else + writelog (LOG_NOTICE, "INFO: Crossroads: %s", str); + } free (str); va_end (args); } diff --git a/src/lib/msgdumpbuf.c b/src/lib/msgdumpbuf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/netallocbufs.c b/src/lib/netallocbufs.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,6 @@ void net_allocbufs () { srbuf = xmalloc (opt.tcp_bufsz + 1); srbuf[opt.tcp_bufsz] = 0; clbufmax = srbufmax = clbufpos = srbufpos = 0; - msg ("Service %s: Allocated client and server buffers", - activeservice->name); + msg ("Allocated client and server buffers"); } } diff --git a/src/lib/netbuffer.c b/src/lib/netbuffer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,25 +10,21 @@ unsigned char *net_buffer (CopyDirection dir, unsigned *sz) { if (dir == dir_server_to_client) { if (srbufmax) { *sz = srbufmax - srbufpos; - msg ("Service %s: %d bytes still in server buffer", - activeservice->name, *sz); + msg ("%d bytes still in server buffer", *sz); srbufmax = 0; return (srbuf + srbufpos); } else { - msg ("Service %s: server buffer is empty", - activeservice->name); + msg ("server buffer is empty"); return (0); } } else { if (clbufmax) { *sz = clbufmax - clbufpos; - msg ("Service %s: %d bytes still in client buffer", - activeservice->name, *sz); + msg ("%d bytes still in client buffer", *sz); clbufmax = 0; return (clbuf + clbufpos); } else { - msg ("Service %s: client buffer is empty", - activeservice->name); + msg ("client buffer is empty"); return (0); } } diff --git a/src/lib/netbufread.c b/src/lib/netbufread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -28,8 +28,7 @@ unsigned char *net_bufread (int sock, int max, int *nread, /* If buffer is empty, do an actual read */ if (! *bufmax) { *bufmax = net_read (sock, opt.tcp_bufsz, buf, is_client); - msg ("Service %s: Got %d bytes from %s", - activeservice->name, *bufmax, is_client ? "client" : "server"); + msg ("Got %d bytes from %s", *bufmax, is_client ? "client" : "server"); *bufpos = 0; } diff --git a/src/lib/netcopy.c b/src/lib/netcopy.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -37,21 +37,20 @@ int net_copy (int cl, int sr, int max, unsigned char *buf) { decr_client_count(); log_activity_end(); mark_activity (0, 0, st_available); - error ("Service %s: network copy stopped after timeout", - activeservice->name); + error ("network copy stopped after timeout"); } /* Check for exceptions. */ if (FD_ISSET (cl, &exset)) { decr_client_count(); log_activity_end(); - error ("Service %s: client exception", activeservice->name); + error ("client exception"); } if (FD_ISSET (sr, &exset)) { decr_client_count(); log_activity_end(); mark_activity (0, 0, st_unavailable); - error ("Service %s: server exception", activeservice->name); + error ("server exception"); } /* Do the read. */ @@ -70,16 +69,13 @@ int net_copy (int cl, int sr, int max, unsigned char *buf) { * If this is the client, then we'll just issue a verbose * message; clients are notorious for just dropping dead. */ if (dir == dir_server_to_client) - error ("Service %s: Read error from server", - activeservice->name); + error ("Read error from server"); else { - msg ("Service %s: Read error from client", - activeservice->name); + msg ("Read error from client"); exit (0); } } else { - msg ("Service %s: %s signals end of data", - activeservice->name, + msg ("%s signals end of data", dir == dir_client_to_server ? "client" : "server"); exit (0); } @@ -98,8 +94,7 @@ int net_copy (int cl, int sr, int max, unsigned char *buf) { if (nwritten < 1) { decr_client_count(); log_activity_end(); - warning ("Service %s: write error when sending data to %s", - activeservice->name, + warning ("write error when sending data to %s", dir == dir_client_to_server ? "server" : "client"); exit (0); } diff --git a/src/lib/netread.c b/src/lib/netread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -28,8 +28,7 @@ int net_read (int sock, int max, unsigned char *buf, int is_client) { desc = is_client ? "client" : "server"; dir = is_client ? dir_client_to_server : dir_server_to_client; - msg ("Service %s: fetching atmost %u bytes from %s", - activeservice->name, max, desc); + msg ("fetching atmost %u bytes from %s", max, desc); /* Prepare select() sets */ FD_ZERO (&readset); @@ -52,8 +51,7 @@ int net_read (int sock, int max, unsigned char *buf, int is_client) { decr_client_count(); log_activity_end(); mark_activity (0, 0, is_client ? st_available : st_unavailable); - error ("Service %s: read from %s timed out", - activeservice->name, desc); + error ("read from %s timed out", desc); } /* Check for exceptions. */ @@ -61,7 +59,7 @@ int net_read (int sock, int max, unsigned char *buf, int is_client) { decr_client_count(); log_activity_end(); mark_activity (0, 0, is_client ? st_available : st_unavailable); - error ("Service %s: %s exception", desc, activeservice->name); + error ("%s exception", desc); } /* Do the read. */ @@ -76,16 +74,13 @@ int net_read (int sock, int max, unsigned char *buf, int is_client) { * If this is the client, then we'll just issue a verbose * message; clients are notorious for just dropping dead. */ if (dir == dir_server_to_client) - error ("Service %s: Read error from server", - activeservice->name); + error ("Read error from server"); else { - msg ("Service %s: Read error from client", - activeservice->name); + msg ("Read error from client"); exit (0); } } else { - msg ("Service %s: %s signals end of data", - activeservice->name, desc); + msg ("%s signals end of data", desc); exit (0); } } diff --git a/src/lib/netwrite.c b/src/lib/netwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -56,23 +56,18 @@ int net_write (int sock, unsigned char const *buf, int buflen, if (!nfd) { /* Issue an appropriate warning for TIMEOUTS */ if (is_client) - warning ("Service %s: Timeout while writing client " - "on socket %d", activeservice->name, sock); + warning ("Timeout while writing client on socket %d", sock); else - warning ("Service %s: Timeout while writing backend %s " - "on socket %d", - activeservice->name, + warning ("Timeout while writing backend %s on socket %d", activeservice->backend[current_backend].name, sock); } else { /* Issue an appropriate warning for NETWORK ERRORS */ if (is_client) - warning ("Service %s: Select failed while writing client " - "on socket %d", activeservice->name, sock); + warning ("Select failed while writing client on socket %d", + sock); else - warning ("Service %s: Select failed while writing backend %s " - "on socket %d", - activeservice->name, + warning ("Select failed while writing backend %s on socket %d", activeservice->backend[current_backend].name, sock); } @@ -85,8 +80,7 @@ int net_write (int sock, unsigned char const *buf, int buflen, if (FD_ISSET (sock, &exset)) { decr_client_count(); log_activity_end(); - error ("Service %s: exception on %s network", - activeservice->name, is_client ? "client" : "server"); + error ("exception on %s network", is_client ? "client" : "server"); } /* We can write! */ @@ -94,8 +88,8 @@ int net_write (int sock, unsigned char const *buf, int buflen, /* Check for finished / errors */ if (ret < 1) { - msg ("Service %s: failed to send to %s: %s (%d)", - activeservice->name, is_client ? "client" : "server", + msg ("failed to send to %s: %s (%d)", + is_client ? "client" : "server", strerror(errno), ret); decr_client_count(); log_activity_end (); diff --git a/src/lib/optionsread.c b/src/lib/optionsread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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 @@ void options_read (int fd) { if ( (res = read (fd, &opt, sizeof(Options))) != sizeof(Options) ) error ("Received only %d bytes (out of %d) " "while reading options on fd %d", - res, sizeof(Options), fd); + res, (int)sizeof(Options), fd); # ifdef DEBUG printf ("Option log_activity: %d\n", opt.log_activity); diff --git a/src/lib/optionswrite.c b/src/lib/optionswrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,5 +12,5 @@ void options_write (int fd) { msg ("Writing binary program options to fd %d", fd); if ( (res = write (fd, &opt, sizeof(Options))) != sizeof(Options) ) error ("Failed to transmit options, sent %d bytes of %d", - res, sizeof(Options)); + res, (int)sizeof(Options)); } diff --git a/src/lib/parser.c b/src/lib/parser.c @@ -1,81 +1,216 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ +/* A Bison parser, made by GNU Bison 2.3. */ -/* A Bison parser, made from parser.y - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define IDENTIFIER 257 -#define NUMBER 258 -#define STRING 259 -#define SERVICE 260 -#define PORT 261 -#define VERBOSITY 262 -#define MAXCONNECTIONS 263 -#define TYPE 264 -#define ANY 265 -#define HTTP 266 -#define BACKEND 267 -#define SERVER 268 -#define BINDTO 269 -#define CONNECTIONTIMEOUT 270 -#define ON 271 -#define OFF 272 -#define DISPATCHMODE 273 -#define ROUNDROBIN 274 -#define RANDOM 275 -#define BYDURATION 276 -#define BYSIZE 277 -#define BYCONNECTIONS 278 -#define BYORDER 279 -#define BYCLIENTIP 280 -#define OVER 281 -#define DECAY 282 -#define REVIVINGINTERVAL 283 -#define CHECKINTERVAL 284 -#define RETRIES 285 -#define SHMKEY 286 -#define WEIGHT 287 -#define ONSTART 288 -#define ONFAIL 289 -#define BACKLOG 290 -#define THROUGHPUTLOG 291 -#define TRAFFICLOG 292 -#define HTTPTIMINGLOG 293 -#define STICKYCOOKIE 294 -#define ADDCLIENTHEADER 295 -#define SETCLIENTHEADER 296 -#define APPENDCLIENTHEADER 297 -#define ADDSERVERHEADER 298 -#define SETSERVERHEADER 299 -#define APPENDSERVERHEADER 300 -#define ALLOWFROM 301 -#define DENYFROM 302 -#define ALLOWFILE 303 -#define DENYFILE 304 -#define EXTERNALHANDLER 305 -#define USERACCOUNT 306 -#define ONEND 307 -#define HEADERINSPECTION 308 -#define DEEP 309 -#define SHALLOW 310 -#define STATE 311 -#define AVAILABLE 312 -#define UNAVAILABLE 313 -#define DOWN 314 -#define OPTIONS 315 -#define LOGACTIVITY 316 -#define TCPBUFFERSIZE 317 -#define DNSCACHETTL 318 -#define LOGFACILITY 319 -#define SHMPERMISSIONS 320 -#define SLOPPYPORTBIND 321 -#define LEAVEPROCESSTITLE 322 +/* Skeleton implementation for Bison's Yacc-like parsers in C + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + IDENTIFIER = 258, + NUMBER = 259, + STRING = 260, + SERVICE = 261, + PORT = 262, + VERBOSITY = 263, + MAXCONNECTIONS = 264, + TYPE = 265, + ANY = 266, + HTTP = 267, + BACKEND = 268, + SERVER = 269, + BINDTO = 270, + CONNECTIONTIMEOUT = 271, + ON = 272, + OFF = 273, + DISPATCHMODE = 274, + ROUNDROBIN = 275, + RANDOM = 276, + BYDURATION = 277, + BYSIZE = 278, + BYCONNECTIONS = 279, + BYORDER = 280, + BYCLIENTIP = 281, + OVER = 282, + DECAY = 283, + REVIVINGINTERVAL = 284, + CHECKINTERVAL = 285, + RETRIES = 286, + SHMKEY = 287, + WEIGHT = 288, + ONSTART = 289, + ONFAIL = 290, + BACKLOG = 291, + THROUGHPUTLOG = 292, + TRAFFICLOG = 293, + HTTPTIMINGLOG = 294, + STICKYCOOKIE = 295, + ADDCLIENTHEADER = 296, + SETCLIENTHEADER = 297, + APPENDCLIENTHEADER = 298, + ADDSERVERHEADER = 299, + SETSERVERHEADER = 300, + APPENDSERVERHEADER = 301, + ALLOWFROM = 302, + DENYFROM = 303, + ALLOWFILE = 304, + DENYFILE = 305, + EXTERNALHANDLER = 306, + USERACCOUNT = 307, + ONEND = 308, + HEADERINSPECTION = 309, + DEEP = 310, + SHALLOW = 311, + STATE = 312, + AVAILABLE = 313, + UNAVAILABLE = 314, + DOWN = 315, + OPTIONS = 316, + LOGACTIVITY = 317, + TCPBUFFERSIZE = 318, + DNSCACHETTL = 319, + LOGFACILITY = 320, + SHMPERMISSIONS = 321, + SLOPPYPORTBIND = 322, + LEAVEPROCESSTITLE = 323 + }; +#endif +/* Tokens. */ +#define IDENTIFIER 258 +#define NUMBER 259 +#define STRING 260 +#define SERVICE 261 +#define PORT 262 +#define VERBOSITY 263 +#define MAXCONNECTIONS 264 +#define TYPE 265 +#define ANY 266 +#define HTTP 267 +#define BACKEND 268 +#define SERVER 269 +#define BINDTO 270 +#define CONNECTIONTIMEOUT 271 +#define ON 272 +#define OFF 273 +#define DISPATCHMODE 274 +#define ROUNDROBIN 275 +#define RANDOM 276 +#define BYDURATION 277 +#define BYSIZE 278 +#define BYCONNECTIONS 279 +#define BYORDER 280 +#define BYCLIENTIP 281 +#define OVER 282 +#define DECAY 283 +#define REVIVINGINTERVAL 284 +#define CHECKINTERVAL 285 +#define RETRIES 286 +#define SHMKEY 287 +#define WEIGHT 288 +#define ONSTART 289 +#define ONFAIL 290 +#define BACKLOG 291 +#define THROUGHPUTLOG 292 +#define TRAFFICLOG 293 +#define HTTPTIMINGLOG 294 +#define STICKYCOOKIE 295 +#define ADDCLIENTHEADER 296 +#define SETCLIENTHEADER 297 +#define APPENDCLIENTHEADER 298 +#define ADDSERVERHEADER 299 +#define SETSERVERHEADER 300 +#define APPENDSERVERHEADER 301 +#define ALLOWFROM 302 +#define DENYFROM 303 +#define ALLOWFILE 304 +#define DENYFILE 305 +#define EXTERNALHANDLER 306 +#define USERACCOUNT 307 +#define ONEND 308 +#define HEADERINSPECTION 309 +#define DEEP 310 +#define SHALLOW 311 +#define STATE 312 +#define AVAILABLE 313 +#define UNAVAILABLE 314 +#define DOWN 315 +#define OPTIONS 316 +#define LOGACTIVITY 317 +#define TCPBUFFERSIZE 318 +#define DNSCACHETTL 319 +#define LOGFACILITY 320 +#define SHMPERMISSIONS 321 +#define SLOPPYPORTBIND 322 +#define LEAVEPROCESSTITLE 323 + + + + +/* Copy the first part of user declarations. */ #line 4 "parser.y" /* Prologue */ @@ -205,685 +340,1347 @@ static void setuseraccount (char *username) { cur_service.gid = pw->pw_gid; } -#ifndef YYSTYPE -#define YYSTYPE int + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 #endif -#include <stdio.h> -#ifndef __cplusplus -#ifndef __STDC__ -#define const +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif -#define YYFINAL 277 -#define YYFLAG -32768 -#define YYNTBASE 72 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 322 ? yytranslate[x] : 181) - -static const char yytranslate[] = { 0, - 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, 69, 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, 70, 2, 71, 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, 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, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 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, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68 -}; +/* Copy the second part of user declarations. */ -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 3, 5, 7, 9, 14, 17, 19, 22, 24, - 26, 28, 30, 32, 34, 36, 41, 45, 49, 53, - 57, 62, 67, 73, 76, 79, 82, 84, 87, 89, - 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, - 111, 113, 115, 117, 119, 121, 123, 127, 131, 134, - 137, 140, 145, 147, 149, 154, 156, 158, 159, 162, - 165, 167, 170, 172, 174, 176, 178, 180, 182, 184, - 186, 190, 193, 198, 203, 205, 206, 209, 213, 217, - 221, 225, 229, 232, 234, 236, 240, 243, 245, 247, - 251, 255, 259, 263, 266, 272, 275, 278, 280, 283, - 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, - 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, - 325, 330, 334, 338, 340, 344, 348, 351, 353, 355, - 357, 361, 365, 369, 373, 377, 381, 384, 387, 391, - 394, 398, 402, 406, 410, 414, 418, 421, 422, 423, - 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, - 434, 435, 436, 437, 438, 439, 440, 441, 444, 447, - 448, 449 -}; -static const short yyrhs[] = { 72, - 73, 0, 73, 0, 85, 0, 74, 0, 61, 176, - 75, 177, 0, 75, 76, 0, 76, 0, 180, 77, - 0, 78, 0, 79, 0, 80, 0, 81, 0, 82, - 0, 83, 0, 84, 0, 62, 164, 97, 95, 0, - 63, 94, 95, 0, 64, 94, 95, 0, 65, 94, - 95, 0, 66, 94, 95, 0, 67, 164, 97, 95, - 0, 68, 164, 97, 95, 0, 86, 87, 176, 88, - 177, 0, 160, 6, 0, 168, 3, 0, 88, 89, - 0, 89, 0, 162, 90, 0, 91, 0, 92, 0, - 96, 0, 98, 0, 107, 0, 108, 0, 111, 0, - 112, 0, 113, 0, 114, 0, 115, 0, 118, 0, - 121, 0, 123, 0, 122, 0, 124, 0, 105, 0, - 126, 0, 7, 94, 95, 0, 15, 93, 95, 0, - 170, 5, 0, 158, 4, 0, 163, 69, 0, 8, - 164, 97, 95, 0, 17, 0, 18, 0, 19, 103, - 99, 95, 0, 100, 0, 102, 0, 0, 27, 101, - 0, 158, 4, 0, 145, 0, 165, 104, 0, 20, - 0, 21, 0, 22, 0, 23, 0, 25, 0, 24, - 0, 51, 0, 26, 0, 52, 106, 95, 0, 174, - 5, 0, 29, 94, 109, 95, 0, 30, 94, 109, - 95, 0, 110, 0, 0, 51, 145, 0, 36, 94, - 95, 0, 32, 94, 95, 0, 16, 94, 95, 0, - 9, 94, 95, 0, 10, 116, 95, 0, 171, 117, - 0, 11, 0, 12, 0, 54, 119, 95, 0, 172, - 120, 0, 55, 0, 56, 0, 47, 125, 95, 0, - 48, 125, 95, 0, 49, 146, 95, 0, 50, 146, - 95, 0, 173, 5, 0, 13, 127, 176, 128, 177, - 0, 169, 3, 0, 128, 129, 0, 129, 0, 161, - 130, 0, 131, 0, 91, 0, 96, 0, 139, 0, - 141, 0, 140, 0, 142, 0, 143, 0, 144, 0, - 132, 0, 133, 0, 114, 0, 147, 0, 149, 0, - 150, 0, 151, 0, 152, 0, 153, 0, 154, 0, - 135, 0, 136, 0, 14, 159, 134, 95, 0, 33, - 94, 95, 0, 28, 94, 95, 0, 5, 0, 31, - 94, 95, 0, 57, 137, 95, 0, 175, 138, 0, - 58, 0, 59, 0, 60, 0, 34, 145, 95, 0, - 35, 145, 95, 0, 53, 145, 95, 0, 38, 146, - 95, 0, 37, 146, 95, 0, 39, 146, 95, 0, - 166, 5, 0, 167, 5, 0, 40, 148, 95, 0, - 157, 5, 0, 41, 155, 95, 0, 42, 155, 95, - 0, 43, 155, 95, 0, 44, 155, 95, 0, 45, - 155, 95, 0, 46, 155, 95, 0, 156, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 178, 70, 0, 179, 71, 0, 0, 0, 0 -}; +/* Line 216 of yacc.c. */ +#line 372 "parser.c" +#ifdef short +# undef short #endif -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 160, 163, 167, 169, 173, 180, 183, 187, 192, 194, - 196, 198, 200, 202, 204, 208, 217, 225, 233, 241, - 249, 258, 267, 291, 296, 307, 310, 314, 319, 325, - 331, 337, 347, 355, 362, 368, 374, 380, 386, 392, - 398, 404, 410, 416, 422, 429, 603, 615, 627, 636, - 643, 648, 661, 665, 671, 680, 682, 684, 690, 707, - 714, 724, 733, 737, 741, 745, 749, 753, 757, 761, - 767, 779, 788, 806, 824, 826, 832, 841, 853, 865, - 877, 889, 901, 906, 910, 916, 928, 933, 937, 943, - 955, 967, 979, 991, 1000, 1010, 1022, 1030, 1036, 1043, - 1048, 1053, 1058, 1063, 1068, 1073, 1078, 1083, 1088, 1093, - 1098, 1103, 1108, 1113, 1118, 1123, 1128, 1133, 1138, 1143, - 1150, 1163, 1175, 1187, 1193, 1205, 1217, 1222, 1226, 1230, - 1236, 1248, 1260, 1272, 1284, 1296, 1308, 1317, 1326, 1338, - 1347, 1359, 1371, 1383, 1395, 1407, 1419, 1428, 1433, 1438, - 1443, 1448, 1453, 1458, 1463, 1468, 1473, 1478, 1483, 1488, - 1493, 1498, 1503, 1508, 1513, 1518, 1523, 1528, 1533, 1538, - 1542, 1546 -}; +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; #endif +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","IDENTIFIER", -"NUMBER","STRING","SERVICE","PORT","VERBOSITY","MAXCONNECTIONS","TYPE","ANY", -"HTTP","BACKEND","SERVER","BINDTO","CONNECTIONTIMEOUT","ON","OFF","DISPATCHMODE", -"ROUNDROBIN","RANDOM","BYDURATION","BYSIZE","BYCONNECTIONS","BYORDER","BYCLIENTIP", -"OVER","DECAY","REVIVINGINTERVAL","CHECKINTERVAL","RETRIES","SHMKEY","WEIGHT", -"ONSTART","ONFAIL","BACKLOG","THROUGHPUTLOG","TRAFFICLOG","HTTPTIMINGLOG","STICKYCOOKIE", -"ADDCLIENTHEADER","SETCLIENTHEADER","APPENDCLIENTHEADER","ADDSERVERHEADER","SETSERVERHEADER", -"APPENDSERVERHEADER","ALLOWFROM","DENYFROM","ALLOWFILE","DENYFILE","EXTERNALHANDLER", -"USERACCOUNT","ONEND","HEADERINSPECTION","DEEP","SHALLOW","STATE","AVAILABLE", -"UNAVAILABLE","DOWN","OPTIONS","LOGACTIVITY","TCPBUFFERSIZE","DNSCACHETTL","LOGFACILITY", -"SHMPERMISSIONS","SLOPPYPORTBIND","LEAVEPROCESSTITLE","';'","'{'","'}'","input", -"element","option_element","option_statements","option_statement","optstat", -"logactivity_statement","tcpbuffersize_statement","dnscachettl_statement","logfacility_statement", -"shmpermissions_statement","sloppyportbind_statement","leaveprocesstitle_statement", -"service_element","service","servicename","servicestatements","servicestatement", -"servicebody","portstatement","bindstatement","ipaddress","number","semicol", -"verbositystatement","onoff","dispatchmodestatement","dispatchtail","dispatchover", -"overnumber","dispatchext","dispatchmethod","dispatchmethodspec","useraccountstatement", -"useraccount","revivingintervalstatement","checkintervalstatement","opt_externalhandler", -"externalhandler","backlogstatement","shmkeystatement","connectiontimeoutstatement", -"maxconnectionsstatement","typestatement","typespec","typespecifier","inspectionstatement", -"shallowdeepspec","shallowdeepspecifier","allowfromstatement","denyfromstatement", -"allowfilestatement","denyfilestatement","ipfilters","backendblock","backendname", -"backenddefinitions","backenddefinition","backendstatement","serverstatement", -"weightstatement","decaystatement","serveraddress","retriesstatement","initialstatestatement", -"statedef","somestate","onstartstatement","onfailstatement","onendstatement", -"dumptrafficstatement","throughputstatement","httptiminglogstatement","commandline", -"filename","stickycookiestatement","cookiespecifier","addclientheaderstatement", -"setclientheaderstatement","appendclientheaderstatement","addserverheaderstatement", -"setserverheaderstatement","appendserverheaderstatement","headerstring","headerstring_expected", -"cookie_expected","number_expected","serveraddress_expected","service_expected", -"backendstatement_expected","servicebody_expected","semicol_expected","onoff_expected", -"dispatchmethod_expected","commandline_expected","filename_expected","servicename_expected", -"backendname_expected","ipaddress_expected","type_expected","shallowdeep_expected", -"ipfilters_expected","useraccount_expected","statedef_expected","openbrace", -"closebrace","openbrace_expected","closebrace_expected","option_statement_expected", NULL -}; #endif -static const short yyr1[] = { 0, - 72, 72, 73, 73, 74, 75, 75, 76, 77, 77, - 77, 77, 77, 77, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 88, 89, 90, 90, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 90, 91, 92, 93, 94, - 95, 96, 97, 97, 98, 99, 99, 99, 100, 101, - 102, 103, 104, 104, 104, 104, 104, 104, 104, 104, - 105, 106, 107, 108, 109, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 117, 118, 119, 120, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 128, 129, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 138, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 10 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 254 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 72 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 110 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 173 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 277 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 323 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 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, 69, + 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, 70, 2, 71, 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, 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, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 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, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68 }; -static const short yyr2[] = { 0, - 2, 1, 1, 1, 4, 2, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 4, 3, 3, 3, 3, - 4, 4, 5, 2, 2, 2, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, - 2, 4, 1, 1, 4, 1, 1, 0, 2, 2, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 4, 4, 1, 0, 2, 3, 3, 3, - 3, 3, 2, 1, 1, 3, 2, 1, 1, 3, - 3, 3, 3, 2, 5, 2, 2, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 3, 3, 1, 3, 3, 2, 1, 1, 1, - 3, 3, 3, 3, 3, 3, 2, 2, 3, 2, - 3, 3, 3, 3, 3, 3, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, - 0, 0 +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 6, 8, 10, 12, 17, 20, 22, + 25, 27, 29, 31, 33, 35, 37, 39, 44, 48, + 52, 56, 60, 65, 70, 76, 79, 82, 85, 87, + 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, + 110, 112, 114, 116, 118, 120, 122, 124, 126, 130, + 134, 137, 140, 143, 148, 150, 152, 157, 159, 161, + 162, 165, 168, 170, 173, 175, 177, 179, 181, 183, + 185, 187, 189, 193, 196, 201, 206, 208, 209, 212, + 216, 220, 224, 228, 232, 235, 237, 239, 243, 246, + 248, 250, 254, 258, 262, 266, 269, 275, 278, 281, + 283, 286, 288, 290, 292, 294, 296, 298, 300, 302, + 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, + 324, 326, 328, 333, 337, 341, 343, 347, 351, 354, + 356, 358, 360, 364, 368, 372, 376, 380, 384, 387, + 390, 394, 397, 401, 405, 409, 413, 417, 421, 424, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, + 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, + 447, 450, 451, 452 }; -static const short yydefact[] = { 152, - 170, 152, 2, 4, 3, 160, 0, 172, 0, 1, - 170, 0, 24, 172, 7, 0, 168, 154, 25, 6, - 5, 0, 156, 150, 150, 150, 150, 156, 156, 8, - 9, 10, 11, 12, 13, 14, 15, 154, 27, 0, - 169, 0, 155, 0, 155, 155, 155, 0, 0, 26, - 23, 150, 156, 150, 163, 161, 162, 150, 157, 150, - 150, 150, 150, 165, 165, 159, 159, 166, 164, 28, - 29, 30, 31, 32, 45, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 43, 42, 44, 46, 53, 54, - 155, 17, 0, 50, 18, 19, 20, 155, 155, 155, - 0, 155, 155, 0, 170, 0, 155, 0, 155, 58, - 0, 76, 76, 155, 155, 155, 0, 155, 155, 0, - 155, 155, 0, 155, 0, 16, 51, 21, 22, 47, - 155, 81, 82, 84, 85, 83, 153, 96, 48, 49, - 80, 150, 155, 56, 57, 61, 0, 63, 64, 65, - 66, 68, 67, 70, 69, 62, 158, 155, 75, 155, - 79, 78, 90, 94, 91, 92, 138, 93, 71, 72, - 86, 88, 89, 87, 52, 153, 98, 0, 59, 0, - 55, 137, 77, 73, 74, 97, 95, 151, 150, 150, - 150, 158, 158, 159, 159, 159, 149, 148, 148, 148, - 148, 148, 148, 158, 167, 101, 102, 111, 99, 100, - 109, 110, 119, 120, 103, 105, 104, 106, 107, 108, - 112, 113, 114, 115, 116, 117, 118, 60, 0, 155, - 155, 155, 155, 155, 155, 155, 155, 155, 0, 155, - 0, 155, 155, 155, 155, 155, 155, 155, 0, 124, - 155, 123, 125, 122, 131, 132, 135, 134, 136, 139, - 140, 141, 147, 142, 143, 144, 145, 146, 133, 126, - 128, 129, 130, 127, 121, 0, 0 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 73, 0, -1, 73, 74, -1, 74, -1, 86, -1, + 75, -1, 61, 177, 76, 178, -1, 76, 77, -1, + 77, -1, 181, 78, -1, 79, -1, 80, -1, 81, + -1, 82, -1, 83, -1, 84, -1, 85, -1, 62, + 165, 98, 96, -1, 63, 95, 96, -1, 64, 95, + 96, -1, 65, 95, 96, -1, 66, 95, 96, -1, + 67, 165, 98, 96, -1, 68, 165, 98, 96, -1, + 87, 88, 177, 89, 178, -1, 161, 6, -1, 169, + 3, -1, 89, 90, -1, 90, -1, 163, 91, -1, + 92, -1, 93, -1, 97, -1, 99, -1, 108, -1, + 109, -1, 112, -1, 113, -1, 114, -1, 115, -1, + 116, -1, 119, -1, 122, -1, 124, -1, 123, -1, + 125, -1, 106, -1, 127, -1, 7, 95, 96, -1, + 15, 94, 96, -1, 171, 5, -1, 159, 4, -1, + 164, 69, -1, 8, 165, 98, 96, -1, 17, -1, + 18, -1, 19, 104, 100, 96, -1, 101, -1, 103, + -1, -1, 27, 102, -1, 159, 4, -1, 146, -1, + 166, 105, -1, 20, -1, 21, -1, 22, -1, 23, + -1, 25, -1, 24, -1, 51, -1, 26, -1, 52, + 107, 96, -1, 175, 5, -1, 29, 95, 110, 96, + -1, 30, 95, 110, 96, -1, 111, -1, -1, 51, + 146, -1, 36, 95, 96, -1, 32, 95, 96, -1, + 16, 95, 96, -1, 9, 95, 96, -1, 10, 117, + 96, -1, 172, 118, -1, 11, -1, 12, -1, 54, + 120, 96, -1, 173, 121, -1, 55, -1, 56, -1, + 47, 126, 96, -1, 48, 126, 96, -1, 49, 147, + 96, -1, 50, 147, 96, -1, 174, 5, -1, 13, + 128, 177, 129, 178, -1, 170, 3, -1, 129, 130, + -1, 130, -1, 162, 131, -1, 132, -1, 92, -1, + 97, -1, 140, -1, 142, -1, 141, -1, 143, -1, + 144, -1, 145, -1, 133, -1, 134, -1, 115, -1, + 148, -1, 150, -1, 151, -1, 152, -1, 153, -1, + 154, -1, 155, -1, 136, -1, 137, -1, 14, 160, + 135, 96, -1, 33, 95, 96, -1, 28, 95, 96, + -1, 5, -1, 31, 95, 96, -1, 57, 138, 96, + -1, 176, 139, -1, 58, -1, 59, -1, 60, -1, + 34, 146, 96, -1, 35, 146, 96, -1, 53, 146, + 96, -1, 38, 147, 96, -1, 37, 147, 96, -1, + 39, 147, 96, -1, 167, 5, -1, 168, 5, -1, + 40, 149, 96, -1, 158, 5, -1, 41, 156, 96, + -1, 42, 156, 96, -1, 43, 156, 96, -1, 44, + 156, 96, -1, 45, 156, 96, -1, 46, 156, 96, + -1, 157, 5, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 179, 70, -1, 180, 71, -1, + -1, -1, -1 }; -static const short yydefgoto[] = { 2, - 3, 4, 14, 15, 30, 31, 32, 33, 34, 35, - 36, 37, 5, 6, 11, 38, 39, 70, 71, 72, - 107, 43, 92, 73, 91, 74, 143, 144, 179, 145, - 110, 156, 75, 122, 76, 77, 158, 159, 78, 79, - 80, 81, 82, 103, 136, 83, 124, 174, 84, 85, - 86, 87, 116, 88, 105, 176, 177, 209, 210, 211, - 212, 251, 213, 214, 248, 274, 215, 216, 217, 218, - 219, 220, 146, 119, 221, 238, 222, 223, 224, 225, - 226, 227, 240, 241, 239, 44, 229, 7, 178, 40, - 93, 42, 111, 147, 120, 12, 106, 108, 104, 125, - 117, 123, 249, 8, 21, 9, 22, 16 +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 161, 161, 164, 168, 170, 174, 181, 184, 188, + 193, 195, 197, 199, 201, 203, 205, 209, 218, 226, + 234, 242, 250, 259, 268, 292, 297, 308, 311, 315, + 320, 326, 332, 338, 348, 356, 363, 369, 375, 381, + 387, 393, 399, 405, 411, 417, 423, 430, 604, 616, + 628, 637, 644, 649, 662, 666, 672, 681, 683, 685, + 691, 708, 715, 725, 734, 738, 742, 746, 750, 754, + 758, 762, 768, 780, 789, 807, 825, 827, 833, 842, + 854, 866, 878, 890, 902, 907, 911, 917, 929, 934, + 938, 944, 956, 968, 980, 992, 1001, 1011, 1023, 1031, + 1037, 1044, 1049, 1054, 1059, 1064, 1069, 1074, 1079, 1084, + 1089, 1094, 1099, 1104, 1109, 1114, 1119, 1124, 1129, 1134, + 1139, 1144, 1151, 1164, 1176, 1188, 1194, 1206, 1218, 1223, + 1227, 1231, 1237, 1249, 1261, 1273, 1285, 1297, 1309, 1318, + 1327, 1339, 1348, 1360, 1372, 1384, 1396, 1408, 1420, 1428, + 1433, 1438, 1443, 1448, 1453, 1458, 1463, 1468, 1473, 1478, + 1483, 1488, 1493, 1498, 1503, 1508, 1513, 1518, 1523, 1529, + 1534, 1538, 1542, 1546 }; +#endif -static const short yypact[] = { -51, --32768, 11,-32768,-32768,-32768,-32768, 8,-32768, -39,-32768, --32768, 48,-32768, -19,-32768, 41,-32768,-32768,-32768,-32768, --32768, -10,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768, -19,-32768, 200, --32768, 25,-32768, 59,-32768,-32768,-32768, 25, 25,-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, -2,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 25,-32768,-32768, 38,-32768, 63,-32768, 70,-32768, 10, - -4, 17, 17,-32768,-32768,-32768, 73,-32768,-32768, 75, --32768,-32768, 76,-32768, 4,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768, 77,-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, -19,-32768, 86,-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,-32768,-32768,-32768,-32768, 80,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 82,-32768, - 83,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -25,-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, 84,-32768 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "IDENTIFIER", "NUMBER", "STRING", + "SERVICE", "PORT", "VERBOSITY", "MAXCONNECTIONS", "TYPE", "ANY", "HTTP", + "BACKEND", "SERVER", "BINDTO", "CONNECTIONTIMEOUT", "ON", "OFF", + "DISPATCHMODE", "ROUNDROBIN", "RANDOM", "BYDURATION", "BYSIZE", + "BYCONNECTIONS", "BYORDER", "BYCLIENTIP", "OVER", "DECAY", + "REVIVINGINTERVAL", "CHECKINTERVAL", "RETRIES", "SHMKEY", "WEIGHT", + "ONSTART", "ONFAIL", "BACKLOG", "THROUGHPUTLOG", "TRAFFICLOG", + "HTTPTIMINGLOG", "STICKYCOOKIE", "ADDCLIENTHEADER", "SETCLIENTHEADER", + "APPENDCLIENTHEADER", "ADDSERVERHEADER", "SETSERVERHEADER", + "APPENDSERVERHEADER", "ALLOWFROM", "DENYFROM", "ALLOWFILE", "DENYFILE", + "EXTERNALHANDLER", "USERACCOUNT", "ONEND", "HEADERINSPECTION", "DEEP", + "SHALLOW", "STATE", "AVAILABLE", "UNAVAILABLE", "DOWN", "OPTIONS", + "LOGACTIVITY", "TCPBUFFERSIZE", "DNSCACHETTL", "LOGFACILITY", + "SHMPERMISSIONS", "SLOPPYPORTBIND", "LEAVEPROCESSTITLE", "';'", "'{'", + "'}'", "$accept", "input", "element", "option_element", + "option_statements", "option_statement", "optstat", + "logactivity_statement", "tcpbuffersize_statement", + "dnscachettl_statement", "logfacility_statement", + "shmpermissions_statement", "sloppyportbind_statement", + "leaveprocesstitle_statement", "service_element", "service", + "servicename", "servicestatements", "servicestatement", "servicebody", + "portstatement", "bindstatement", "ipaddress", "number", "semicol", + "verbositystatement", "onoff", "dispatchmodestatement", "dispatchtail", + "dispatchover", "overnumber", "dispatchext", "dispatchmethod", + "dispatchmethodspec", "useraccountstatement", "useraccount", + "revivingintervalstatement", "checkintervalstatement", + "opt_externalhandler", "externalhandler", "backlogstatement", + "shmkeystatement", "connectiontimeoutstatement", + "maxconnectionsstatement", "typestatement", "typespec", "typespecifier", + "inspectionstatement", "shallowdeepspec", "shallowdeepspecifier", + "allowfromstatement", "denyfromstatement", "allowfilestatement", + "denyfilestatement", "ipfilters", "backendblock", "backendname", + "backenddefinitions", "backenddefinition", "backendstatement", + "serverstatement", "weightstatement", "decaystatement", "serveraddress", + "retriesstatement", "initialstatestatement", "statedef", "somestate", + "onstartstatement", "onfailstatement", "onendstatement", + "dumptrafficstatement", "throughputstatement", "httptiminglogstatement", + "commandline", "filename", "stickycookiestatement", "cookiespecifier", + "addclientheaderstatement", "setclientheaderstatement", + "appendclientheaderstatement", "addserverheaderstatement", + "setserverheaderstatement", "appendserverheaderstatement", + "headerstring", "headerstring_expected", "cookie_expected", + "number_expected", "serveraddress_expected", "service_expected", + "backendstatement_expected", "servicebody_expected", "semicol_expected", + "onoff_expected", "dispatchmethod_expected", "commandline_expected", + "filename_expected", "servicename_expected", "backendname_expected", + "ipaddress_expected", "type_expected", "shallowdeep_expected", + "ipfilters_expected", "useraccount_expected", "statedef_expected", + "openbrace", "closebrace", "openbrace_expected", "closebrace_expected", + "option_statement_expected", 0 }; +#endif -static const short yypgoto[] = {-32768, - 87,-32768,-32768, 78,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768, 52,-32768, -87,-32768, --32768, -22, -45, -82, -36,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768, -16,-32768,-32768,-32768, --32768, -79,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 36,-32768,-32768,-32768, -66,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, -148, -60,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, -174,-32768,-32768, -31,-32768,-32768,-32768,-32768, --32768, -5,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768, -3, -32,-32768,-32768,-32768 +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 59, + 123, 125 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 72, 73, 73, 74, 74, 75, 76, 76, 77, + 78, 78, 78, 78, 78, 78, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 89, 90, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 92, 93, + 94, 95, 96, 97, 98, 98, 99, 100, 100, 100, + 101, 102, 103, 104, 105, 105, 105, 105, 105, 105, + 105, 105, 106, 107, 108, 109, 110, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 129, + 130, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 139, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181 }; +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 2, 1, 1, 1, 4, 2, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 4, 3, 3, + 3, 3, 4, 4, 5, 2, 2, 2, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, + 2, 2, 2, 4, 1, 1, 4, 1, 1, 0, + 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 2, 4, 4, 1, 0, 2, 3, + 3, 3, 3, 3, 2, 1, 1, 3, 2, 1, + 1, 3, 3, 3, 3, 2, 5, 2, 2, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 3, 3, 1, 3, 3, 2, 1, + 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, + 3, 2, 3, 3, 3, 3, 3, 3, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 2, 0, 0, 0 +}; -#define YYLAST 254 - - -static const short yytable[] = { 95, - 96, 97, 45, 46, 47, 51, 121, 18, 183, 1, - 276, 98, 99, 13, -158, 148, 149, 150, 151, 152, - 153, 154, 48, 49, 242, 243, 244, 245, 246, 100, - 17, 102, 271, 272, 273, 109, 142, 112, 113, 114, - 115, 89, 90, 233, 234, 126, 155, 101, 134, 135, - 19, -171, 128, 129, 130, 247, 132, 133, 172, 173, - 41, 139, 94, 141, 131, 138, 127, 157, 161, 162, - 163, 1, 165, 166, 140, 168, 169, 164, 171, 167, - 170, 182, 228, 277, 250, 175, 261, 263, 10, 50, - 206, 20, 52, 53, 54, 207, 160, 181, 208, 188, - 118, 137, 23, 24, 25, 26, 27, 28, 29, 186, - 180, 0, 184, 189, 185, 0, 190, 0, 191, 192, - 193, 0, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 0, 235, 236, 237, 0, 0, 204, 0, - 0, 0, 205, 187, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 230, 231, 232, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 0, 262, 0, 264, 265, 266, 267, - 268, 269, 270, 0, 0, 275, 52, 53, 54, 55, - 0, 0, 56, 0, 57, 58, 0, 0, 59, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 60, 61, - 0, 62, 0, 0, 0, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, - 0, 68, 0, 69 +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 153, 171, 153, 3, 5, 4, 161, 0, 173, 0, + 1, 2, 171, 0, 25, 173, 8, 0, 169, 155, + 26, 7, 6, 0, 157, 151, 151, 151, 151, 157, + 157, 9, 10, 11, 12, 13, 14, 15, 16, 155, + 28, 0, 170, 0, 156, 0, 156, 156, 156, 0, + 0, 27, 24, 151, 157, 151, 164, 162, 163, 151, + 158, 151, 151, 151, 151, 166, 166, 160, 160, 167, + 165, 29, 30, 31, 32, 33, 46, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 44, 43, 45, 47, + 54, 55, 156, 18, 0, 51, 19, 20, 21, 156, + 156, 156, 0, 156, 156, 0, 171, 0, 156, 0, + 156, 59, 0, 77, 77, 156, 156, 156, 0, 156, + 156, 0, 156, 156, 0, 156, 0, 17, 52, 22, + 23, 48, 156, 82, 83, 85, 86, 84, 154, 97, + 49, 50, 81, 151, 156, 57, 58, 62, 0, 64, + 65, 66, 67, 69, 68, 71, 70, 63, 159, 156, + 76, 156, 80, 79, 91, 95, 92, 93, 139, 94, + 72, 73, 87, 89, 90, 88, 53, 154, 99, 0, + 60, 0, 56, 138, 78, 74, 75, 98, 96, 152, + 151, 151, 151, 159, 159, 160, 160, 160, 150, 149, + 149, 149, 149, 149, 149, 159, 168, 102, 103, 112, + 100, 101, 110, 111, 120, 121, 104, 106, 105, 107, + 108, 109, 113, 114, 115, 116, 117, 118, 119, 61, + 0, 156, 156, 156, 156, 156, 156, 156, 156, 156, + 0, 156, 0, 156, 156, 156, 156, 156, 156, 156, + 0, 125, 156, 124, 126, 123, 132, 133, 136, 135, + 137, 140, 141, 142, 148, 143, 144, 145, 146, 147, + 134, 127, 129, 130, 131, 128, 122 }; -static const short yycheck[] = { 45, - 46, 47, 25, 26, 27, 38, 67, 11, 157, 61, - 0, 48, 49, 6, 5, 20, 21, 22, 23, 24, - 25, 26, 28, 29, 199, 200, 201, 202, 203, 52, - 70, 54, 58, 59, 60, 58, 27, 60, 61, 62, - 63, 17, 18, 192, 193, 91, 51, 53, 11, 12, - 3, 71, 98, 99, 100, 204, 102, 103, 55, 56, - 71, 107, 4, 109, 101, 3, 69, 51, 114, 115, - 116, 61, 118, 119, 5, 121, 122, 5, 124, 5, - 5, 5, 4, 0, 5, 131, 5, 5, 2, 38, - 178, 14, 7, 8, 9, 178, 113, 143, 178, 14, - 65, 105, 62, 63, 64, 65, 66, 67, 68, 176, - 142, -1, 158, 28, 160, -1, 31, -1, 33, 34, - 35, -1, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, -1, 194, 195, 196, -1, -1, 53, -1, - -1, -1, 57, 176, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 189, 190, 191, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 230, 231, 232, 233, 234, 235, - 236, 237, 238, -1, 240, -1, 242, 243, 244, 245, - 246, 247, 248, -1, -1, 251, 7, 8, 9, 10, - -1, -1, 13, -1, 15, 16, -1, -1, 19, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 29, 30, - -1, 32, -1, -1, -1, 36, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 47, 48, 49, 50, - -1, 52, -1, 54 +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 3, 4, 15, 16, 31, 32, 33, 34, + 35, 36, 37, 38, 5, 6, 12, 39, 40, 71, + 72, 73, 108, 44, 93, 74, 92, 75, 144, 145, + 180, 146, 111, 157, 76, 123, 77, 78, 159, 160, + 79, 80, 81, 82, 83, 104, 137, 84, 125, 175, + 85, 86, 87, 88, 117, 89, 106, 177, 178, 210, + 211, 212, 213, 252, 214, 215, 249, 275, 216, 217, + 218, 219, 220, 221, 147, 120, 222, 239, 223, 224, + 225, 226, 227, 228, 241, 242, 240, 45, 230, 7, + 179, 41, 94, 43, 112, 148, 121, 13, 107, 109, + 105, 126, 118, 124, 250, 8, 22, 9, 23, 17 }; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" -/* This file comes from bison-1.28. */ -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -150 +static const yytype_int16 yypact[] = +{ + -51, -150, 11, -150, -150, -150, -150, 8, -150, -54, + -150, -150, -150, 26, -150, -40, -150, 41, -150, -150, + -150, -150, -150, -36, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -40, + -150, 200, -150, 16, -150, 43, -150, -150, -150, 16, + 16, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -19, -150, -150, -150, -150, -150, + -150, -150, 16, -150, -150, 31, -150, 48, -150, 47, + -150, 10, -3, 12, 12, -150, -150, -150, 56, -150, + -150, 61, -150, -150, 62, -150, 4, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, 63, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -40, -150, 86, + -150, 71, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + 73, -150, -150, -150, -150, -150, -150, -150, -150, -150, + 80, -150, 82, -150, -150, -150, -150, -150, -150, -150, + -32, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150 +}; - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -150, -150, 87, -150, -150, 75, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, 49, -150, + -88, -150, -150, -23, -46, -87, -37, -150, -150, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -18, -150, + -150, -150, -150, -82, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, 33, -150, -150, -150, -76, -150, + -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -149, -61, -150, -150, -150, -150, + -150, -150, -150, -150, -120, -150, -150, -31, -150, -150, + -150, -150, -150, -5, -150, -150, -150, -150, -150, -150, + -150, -150, -150, -150, -150, -4, -33, -150, -150, -150 +}; - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -173 +static const yytype_int16 yytable[] = +{ + 96, 97, 98, 46, 47, 48, 52, 122, 19, 184, + 1, 10, 99, 100, 14, -159, 18, 149, 150, 151, + 152, 153, 154, 155, 49, 50, 272, 273, 274, 20, + 101, -172, 103, 90, 91, 42, 110, 143, 113, 114, + 115, 116, 135, 136, 234, 235, 127, 95, 156, 102, + 128, 139, 141, 129, 130, 131, 248, 133, 134, 173, + 174, 165, 140, 158, 142, 132, 168, 171, 183, 162, + 163, 164, 1, 166, 167, 229, 169, 170, 251, 172, + 243, 244, 245, 246, 247, 262, 176, 264, 51, 11, + 21, 207, 208, 53, 54, 55, 161, 209, 182, 119, + 189, 187, 138, 24, 25, 26, 27, 28, 29, 30, + 0, 0, 181, 185, 190, 186, 0, 191, 0, 192, + 193, 194, 0, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 0, 236, 237, 238, 0, 0, 205, + 0, 0, 0, 206, 188, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 231, 232, 233, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 0, 263, 0, 265, 266, 267, + 268, 269, 270, 271, 0, 0, 276, 53, 54, 55, + 56, 0, 0, 57, 0, 58, 59, 0, 0, 60, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, + 62, 0, 63, 0, 0, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 66, 67, + 68, 0, 69, 0, 70 +}; - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include <alloca.h> -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include <malloc.h> -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include <malloc.h> */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif +static const yytype_int16 yycheck[] = +{ + 46, 47, 48, 26, 27, 28, 39, 68, 12, 158, + 61, 0, 49, 50, 6, 5, 70, 20, 21, 22, + 23, 24, 25, 26, 29, 30, 58, 59, 60, 3, + 53, 71, 55, 17, 18, 71, 59, 27, 61, 62, + 63, 64, 11, 12, 193, 194, 92, 4, 51, 54, + 69, 3, 5, 99, 100, 101, 205, 103, 104, 55, + 56, 5, 108, 51, 110, 102, 5, 5, 5, 115, + 116, 117, 61, 119, 120, 4, 122, 123, 5, 125, + 200, 201, 202, 203, 204, 5, 132, 5, 39, 2, + 15, 179, 179, 7, 8, 9, 114, 179, 144, 66, + 14, 177, 106, 62, 63, 64, 65, 66, 67, 68, + -1, -1, 143, 159, 28, 161, -1, 31, -1, 33, + 34, 35, -1, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, -1, 195, 196, 197, -1, -1, 53, + -1, -1, -1, 57, 177, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 190, 191, 192, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 231, 232, 233, 234, 235, + 236, 237, 238, 239, -1, 241, -1, 243, 244, 245, + 246, 247, 248, 249, -1, -1, 252, 7, 8, 9, + 10, -1, -1, 13, -1, 15, 16, -1, -1, 19, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, + 30, -1, 32, -1, -1, -1, 36, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 47, 48, 49, + 50, -1, 52, -1, 54 +}; -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 61, 73, 74, 75, 86, 87, 161, 177, 179, + 0, 74, 88, 169, 6, 76, 77, 181, 70, 177, + 3, 77, 178, 180, 62, 63, 64, 65, 66, 67, + 68, 78, 79, 80, 81, 82, 83, 84, 85, 89, + 90, 163, 71, 165, 95, 159, 95, 95, 95, 165, + 165, 90, 178, 7, 8, 9, 10, 13, 15, 16, + 19, 29, 30, 32, 36, 47, 48, 49, 50, 52, + 54, 91, 92, 93, 97, 99, 106, 108, 109, 112, + 113, 114, 115, 116, 119, 122, 123, 124, 125, 127, + 17, 18, 98, 96, 164, 4, 96, 96, 96, 98, + 98, 95, 165, 95, 117, 172, 128, 170, 94, 171, + 95, 104, 166, 95, 95, 95, 95, 126, 174, 126, + 147, 168, 147, 107, 175, 120, 173, 96, 69, 96, + 96, 96, 98, 96, 96, 11, 12, 118, 177, 3, + 96, 5, 96, 27, 100, 101, 103, 146, 167, 20, + 21, 22, 23, 24, 25, 26, 51, 105, 51, 110, + 111, 110, 96, 96, 96, 5, 96, 96, 5, 96, + 96, 5, 96, 55, 56, 121, 96, 129, 130, 162, + 102, 159, 96, 5, 146, 96, 96, 130, 178, 14, + 28, 31, 33, 34, 35, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 53, 57, 92, 97, 115, + 131, 132, 133, 134, 136, 137, 140, 141, 142, 143, + 144, 145, 148, 150, 151, 152, 153, 154, 155, 4, + 160, 95, 95, 95, 146, 146, 147, 147, 147, 149, + 158, 156, 157, 156, 156, 156, 156, 156, 146, 138, + 176, 5, 135, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 5, 96, 5, 96, 96, 96, 96, 96, + 96, 96, 58, 59, 60, 139, 96 +}; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 +#define YYEMPTY (-2) #define YYEOF 0 + #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ + +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX yylex() + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) #endif -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif #endif -#else /* not YYLSP_NEEDED */ + + +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +# define YYLEX yylex (YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +# define YYLEX yylex () #endif -#endif /* not YYLSP_NEEDED */ + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; #endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + -/* If nonreentrant, generate the variables here */ +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); -#ifndef YYPURE + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; #endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; #endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) -/* YYINITDEPTH indicates the initial size of the parser's stacks */ +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + +/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif + -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif { - register char *f = from; - register char *t = to; - register int i = count; + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } - while (i-- > 0) - *t++ = *f++; + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } } +#endif /* YYERROR_VERBOSE */ + -#else /* __cplusplus */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else static void -__yy_memcpy (char *to, char *from, unsigned int count) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif { - register char *t = to; - register char *f = from; - register int i = count; + YYUSE (yyvaluep); - while (i-- > 0) - *t++ = *f++; -} + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); -#endif -#endif + switch (yytype) + { + + default: + break; + } +} -#line 217 "/usr/share/bison.simple" -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); #else -int yyparse (void); +int yyparse (); #endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); #endif +#endif /* ! YYPARSE_PARAM */ -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ +/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) #else -#define YYPOPSTACK (yyvsp--, yyssp--) +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; #endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; #endif #endif +{ + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. - int yylen; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -895,289 +1692,242 @@ yyparse(YYPARSE_PARAM_ARG) so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: + goto yysetstate; - *++yyssp = yystate; +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif + yysetstate: + *yyssp = yystate; + if (yyss + yystacksize - 1 <= yyssp) + { /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ +/*-----------. +| yybackup. | +`-----------*/ +yybackup: - /* First try to decide what to do without reference to lookahead token. */ + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ + /* Not known => get a look-ahead token if don't already have one. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) + if (yyn <= 0) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the token being shifted unless it is eof. */ + /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; + yystate = yyn; *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - yystate = yyn; goto yynewstate; -/* Do the default action for the current state. */ -yydefault: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; + -/* Do a reduction. yyn is the number of a rule to reduce with. */ +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; - switch (yyn) { - -case 16: + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 17: #line 212 "parser.y" -{ + { opt.log_activity = lastnr; - ; - break;} -case 17: + ;} + break; + + case 18: #line 220 "parser.y" -{ + { opt.tcp_bufsz = lastnr; - ; - break;} -case 18: + ;} + break; + + case 19: #line 228 "parser.y" -{ + { opt.dns_cachettl = lastnr; - ; - break;} -case 19: + ;} + break; + + case 20: #line 236 "parser.y" -{ + { opt.log_facility = lastnr; - ; - break;} -case 20: + ;} + break; + + case 21: #line 244 "parser.y" -{ + { opt.shmperm = lastnr; - ; - break;} -case 21: + ;} + break; + + case 22: #line 253 "parser.y" -{ + { opt.sloppyportbind = lastnr; - ; - break;} -case 22: + ;} + break; + + case 23: #line 262 "parser.y" -{ + { opt.leave_proctitle = lastnr; - ; - break;} -case 23: + ;} + break; + + case 24: #line 272 "parser.y" -{ + { /* Check integrity, supply defaults */ check_service (cur_service); @@ -1193,310 +1943,329 @@ case 23: service = xrealloc (service, ++nservice * sizeof(Service)); service[nservice - 1] = cur_service; memset (&cur_service, 0, sizeof(Service)); - ; - break;} -case 25: + ;} + break; + + case 26: #line 298 "parser.y" -{ + { pmsg ("service [%s]\n", SYMBOL); for (i = 0; i < nservice; i++) if (!strcmp (service[i].name, SYMBOL)) error ("Duplicate definition of service '%s'", SYMBOL); cur_service.name = xstrdup(SYMBOL); - ; - break;} -case 29: + ;} + break; + + case 30: #line 320 "parser.y" -{ - pmsg ("sevice port [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.port = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 30: + { + pmsg ("sevice port [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.port = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 31: #line 326 "parser.y" -{ - pmsg ("service binding [%s]\n", yyvsp[0].set[0].v.sval); - cur_service.bind = yyvsp[0].set[0].v.sval; - free (yyvsp[0].set); - ; - break;} -case 31: + { + pmsg ("service binding [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + cur_service.bind = (yyvsp[(1) - (1)]).set[0].v.sval; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 32: #line 332 "parser.y" -{ - pmsg ("service verbosity [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.verbosity = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 32: + { + pmsg ("service verbosity [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.verbosity = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 33: #line 338 "parser.y" -{ - pmsg ("service dispatch mode [%d]\n", yyvsp[0].set[0].v.ival); + { + pmsg ("service dispatch mode [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); pmsg ("service dispatch over [%d]\n", lastovernr); pmsg ("service dispatch exthandler [%s]\n", lastext); - cur_service.dispatchtype = yyvsp[0].set[0].v.ival; + cur_service.dispatchtype = (yyvsp[(1) - (1)]).set[0].v.ival; cur_service.dispatchover = lastovernr; cur_service.dispatchext = xstrdup(lastext); - free (yyvsp[0].set); - ; - break;} -case 33: + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 34: #line 348 "parser.y" -{ - pmsg ("service revival interval [%d]\n", yyvsp[0].set[0].v.ival); - pmsg ("service revival cmd [%s]\n", yyvsp[0].set[1].v.sval); - cur_service.rev_interval = yyvsp[0].set[0].v.ival; - cur_service.check_cmd = yyvsp[0].set[1].v.sval; - free (yyvsp[0].set); - ; - break;} -case 34: + { + pmsg ("service revival interval [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + pmsg ("service revival cmd [%s]\n", (yyvsp[(1) - (1)]).set[1].v.sval); + cur_service.rev_interval = (yyvsp[(1) - (1)]).set[0].v.ival; + cur_service.check_cmd = (yyvsp[(1) - (1)]).set[1].v.sval; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 35: #line 356 "parser.y" -{ - pmsg ("service check interval [%d]\n", yyvsp[0].set[0].v.ival); - pmsg ("service check cmd [%s]\n", yyvsp[0].set[1].v.sval); - cur_service.check_interval = yyvsp[0].set[0].v.ival; - cur_service.check_cmd = yyvsp[0].set[1].v.sval; - ; - break;} -case 35: + { + pmsg ("service check interval [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + pmsg ("service check cmd [%s]\n", (yyvsp[(1) - (1)]).set[1].v.sval); + cur_service.check_interval = (yyvsp[(1) - (1)]).set[0].v.ival; + cur_service.check_cmd = (yyvsp[(1) - (1)]).set[1].v.sval; + ;} + break; + + case 36: #line 363 "parser.y" -{ - pmsg ("service backlog [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.backlog = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 36: + { + pmsg ("service backlog [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.backlog = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 37: #line 369 "parser.y" -{ - pmsg ("service shmkey [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.shmkey = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 37: + { + pmsg ("service shmkey [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.shmkey = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 38: #line 375 "parser.y" -{ - pmsg ("connection timout [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.connectiontimeout = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 38: + { + pmsg ("connection timout [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.connectiontimeout = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 39: #line 381 "parser.y" -{ - pmsg ("max clients in service [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.maxconnections = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 39: + { + pmsg ("max clients in service [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.maxconnections = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 40: #line 387 "parser.y" -{ - pmsg ("service type [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.type = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 40: + { + pmsg ("service type [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.type = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 41: #line 393 "parser.y" -{ - pmsg ("service header inspection [%d]\n", yyvsp[0].set[0].v.ival); - cur_service.inspection = yyvsp[0].set[0].v.ival; - free (yyvsp[0].set); - ; - break;} -case 41: + { + pmsg ("service header inspection [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + cur_service.inspection = (yyvsp[(1) - (1)]).set[0].v.ival; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 42: #line 399 "parser.y" -{ - pmsg ("allow from [%s]\n", yyvsp[0].set[0].v.sval); - add_allowfrom (yyvsp[0].set[0].v.sval); - free (yyvsp[0].set); - ; - break;} -case 42: + { + pmsg ("allow from [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + add_allowfrom ((yyvsp[(1) - (1)]).set[0].v.sval); + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 43: #line 405 "parser.y" -{ - pmsg ("allow file [%s]\n", yyvsp[0].set[0].v.sval); - cur_service.allowfile = yyvsp[0].set[0].v.sval; - free (yyvsp[0].set); - ; - break;} -case 43: + { + pmsg ("allow file [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + cur_service.allowfile = (yyvsp[(1) - (1)]).set[0].v.sval; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 44: #line 411 "parser.y" -{ - pmsg ("deny from [%s]\n", yyvsp[0].set[0].v.sval); - add_denyfrom (yyvsp[0].set[0].v.sval); - free (yyvsp[0].set); - ; - break;} -case 44: + { + pmsg ("deny from [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + add_denyfrom ((yyvsp[(1) - (1)]).set[0].v.sval); + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 45: #line 417 "parser.y" -{ - pmsg ("deny file [%s]\n", yyvsp[0].set[0].v.sval); - cur_service.denyfile = yyvsp[0].set[0].v.sval; - free (yyvsp[0].set); - ; - break;} -case 45: + { + pmsg ("deny file [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + cur_service.denyfile = (yyvsp[(1) - (1)]).set[0].v.sval; + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 46: #line 423 "parser.y" -{ - pmsg ("user account [%s]\n", yyvsp[0].set[0].v.sval); - setuseraccount (yyvsp[0].set[0].v.sval); - free (yyvsp[0].set[0].v.sval); - free (yyvsp[0].set); - ; - break;} -case 46: + { + pmsg ("user account [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + setuseraccount ((yyvsp[(1) - (1)]).set[0].v.sval); + free ((yyvsp[(1) - (1)]).set[0].v.sval); + free ((yyvsp[(1) - (1)]).set); + ;} + break; + + case 47: #line 430 "parser.y" -{ - pmsg ("converting backend statements, count is [%d]\n", yyvsp[0].n); - for (i = 0; i < yyvsp[0].n; i++) - switch (yyvsp[0].set[i].cf) { + { + pmsg ("converting backend statements, count is [%d]\n", (yyvsp[(1) - (1)]).n); + for (i = 0; i < (yyvsp[(1) - (1)]).n; i++) + switch ((yyvsp[(1) - (1)]).set[i].cf) { case cf_portspec: - pmsg ("backend port [%d]\n", yyvsp[0].set[i].v.ival); - cur_backend.initial_port = yyvsp[0].set[i].v.ival; + pmsg ("backend port [%d]\n", (yyvsp[(1) - (1)]).set[i].v.ival); + cur_backend.initial_port = (yyvsp[(1) - (1)]).set[i].v.ival; break; case cf_serverspec: - pmsg ("backend server [%s]\n", 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); + pmsg ("backend server [%s]\n", (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.initial_server = serverpart ((yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.initial_port = portpart ((yyvsp[(1) - (1)]).set[i].v.sval); + free ((yyvsp[(1) - (1)]).set[i].v.sval); break; case cf_verbosityspec: - pmsg ("backend verbosity [%d]\n", yyvsp[0].set[i].v.ival); - cur_backend.verbosity = yyvsp[0].set[i].v.ival; + pmsg ("backend verbosity [%d]\n", (yyvsp[(1) - (1)]).set[i].v.ival); + cur_backend.verbosity = (yyvsp[(1) - (1)]).set[i].v.ival; break; case cf_onstartspec: - pmsg ("backend onstart [%s]\n", yyvsp[0].set[i].v.sval); - cur_backend.onstart = yyvsp[0].set[i].v.sval; + pmsg ("backend onstart [%s]\n", (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.onstart = (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_onfailspec: - pmsg ("backend onfail [%s]\n", yyvsp[0].set[i].v.sval); - cur_backend.onfail = yyvsp[0].set[i].v.sval; + pmsg ("backend onfail [%s]\n", (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.onfail = (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_onendspec: - pmsg ("backend onend [%s]\n", yyvsp[0].set[i].v.sval); - cur_backend.onend = yyvsp[0].set[i].v.sval; + pmsg ("backend onend [%s]\n", (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.onend = (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_dumpspec: - pmsg ("backend trafficlog [%s]\n", yyvsp[0].set[i].v.sval); - cur_backend.dumpfile = yyvsp[0].set[i].v.sval; + pmsg ("backend trafficlog [%s]\n", (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.dumpfile = (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_thruspec: - pmsg ("backend throughputlog [%s]\n", yyvsp[0].set[i].v.sval); - cur_backend.thruputfile = yyvsp[0].set[i].v.sval; + pmsg ("backend throughputlog [%s]\n", (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.thruputfile = (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_httptimingspec: if (cur_service.type != type_http) error ("'httptiminglog' only allowed in 'type http' " "service definitions"); - pmsg ("backend http timing log [%s]\n", yyvsp[0].set[i].v.sval); - cur_backend.timinglog = yyvsp[0].set[i].v.sval; + pmsg ("backend http timing log [%s]\n", (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.timinglog = (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_weightspec: - pmsg ("backend weight [%d]\n", yyvsp[0].set[i].v.ival); - cur_backend.weight = yyvsp[0].set[i].v.ival; + pmsg ("backend weight [%d]\n", (yyvsp[(1) - (1)]).set[i].v.ival); + cur_backend.weight = (yyvsp[(1) - (1)]).set[i].v.ival; break; case cf_decayspec: - pmsg ("backend decay [%d]\n", yyvsp[0].set[i].v.ival); - if (yyvsp[0].set[i].v.ival >= 100) + pmsg ("backend decay [%d]\n", (yyvsp[(1) - (1)]).set[i].v.ival); + if ((yyvsp[(1) - (1)]).set[i].v.ival >= 100) error ("Decay specifier %d must be a percentage, " "never more than 99", - yyvsp[0].set[i].v.ival); - cur_backend.decay = yyvsp[0].set[i].v.ival; + (yyvsp[(1) - (1)]).set[i].v.ival); + cur_backend.decay = (yyvsp[(1) - (1)]).set[i].v.ival; break; case cf_maxconnectionsspec: - pmsg ("backend max clients [%d]\n", yyvsp[0].set[i].v.ival); - cur_backend.maxconnections = yyvsp[0].set[i].v.ival; + pmsg ("backend max clients [%d]\n", (yyvsp[(1) - (1)]).set[i].v.ival); + cur_backend.maxconnections = (yyvsp[(1) - (1)]).set[i].v.ival; break; case cf_stickycookiespec: pmsg ("backend sticky cookie [%s]\n", - yyvsp[0].set[i].v.sval); - cur_backend.stickycookie = yyvsp[0].set[i].v.sval; + (yyvsp[(1) - (1)]).set[i].v.sval); + cur_backend.stickycookie = (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_addclientheaderspec: pmsg ("client header to add [%s]\n", - yyvsp[0].set[i].v.sval); + (yyvsp[(1) - (1)]).set[i].v.sval); cur_backend.addclientheader = xrealloc (cur_backend.addclientheader, (cur_backend.naddclientheader + 1) * sizeof(char*)); cur_backend.addclientheader [cur_backend.naddclientheader++] = - yyvsp[0].set[i].v.sval; + (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_setclientheaderspec: pmsg ("client header to set [%s]\n", - yyvsp[0].set[i].v.sval); + (yyvsp[(1) - (1)]).set[i].v.sval); cur_backend.setclientheader = xrealloc (cur_backend.setclientheader, (cur_backend.nsetclientheader + 1) * sizeof(char*)); cur_backend.setclientheader [cur_backend.nsetclientheader++] = - yyvsp[0].set[i].v.sval; + (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_appendclientheaderspec: pmsg ("client header to append [%s]\n", - yyvsp[0].set[i].v.sval); + (yyvsp[(1) - (1)]).set[i].v.sval); cur_backend.appendclientheader = xrealloc (cur_backend.appendclientheader, (cur_backend.nappendclientheader + 1) * sizeof(char*)); cur_backend.appendclientheader [cur_backend.nappendclientheader++] = - yyvsp[0].set[i].v.sval; + (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_addserverheaderspec: pmsg ("server header to add [%s]\n", - yyvsp[0].set[i].v.sval); + (yyvsp[(1) - (1)]).set[i].v.sval); cur_backend.addserverheader = xrealloc (cur_backend.addserverheader, (cur_backend.naddserverheader + 1) * sizeof(char*)); cur_backend.addserverheader [cur_backend.naddserverheader++] = - yyvsp[0].set[i].v.sval; + (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_setserverheaderspec: pmsg ("server header to set [%s]\n", - yyvsp[0].set[i].v.sval); + (yyvsp[(1) - (1)]).set[i].v.sval); cur_backend.setserverheader = xrealloc (cur_backend.setserverheader, (cur_backend.nsetserverheader + 1) * sizeof(char*)); cur_backend.setserverheader [cur_backend.nsetserverheader++] = - yyvsp[0].set[i].v.sval; + (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_appendserverheaderspec: pmsg ("server header to append:", - yyvsp[0].set[i].v.sval); + (yyvsp[(1) - (1)]).set[i].v.sval); cur_backend.appendserverheader = xrealloc (cur_backend.appendserverheader, (cur_backend.nappendserverheader + 1) * sizeof(char*)); cur_backend.appendserverheader [cur_backend.nappendserverheader++] = - yyvsp[0].set[i].v.sval; + (yyvsp[(1) - (1)]).set[i].v.sval; break; case cf_retriesspec: - pmsg ("backend retries [%d]\n", yyvsp[0].set[i].v.ival); - cur_backend.retries = yyvsp[0].set[i].v.ival; + pmsg ("backend retries [%d]\n", (yyvsp[(1) - (1)]).set[i].v.ival); + cur_backend.retries = (yyvsp[(1) - (1)]).set[i].v.ival; break; case cf_statespec: - pmsg ("backend initial state [%d]\n", yyvsp[0].set[i].v.ival); - cur_backend.initial_avail = yyvsp[0].set[i].v.ival; + pmsg ("backend initial state [%d]\n", (yyvsp[(1) - (1)]).set[i].v.ival); + cur_backend.initial_avail = (yyvsp[(1) - (1)]).set[i].v.ival; break; default: error ("Internal jam, unhandled type %d " "in backend specification", - yyvsp[0].set[i].cf); + (yyvsp[(1) - (1)]).set[i].cf); } - free (yyvsp[0].set); + free ((yyvsp[(1) - (1)]).set); /* Verify the backend block, supply defaults, * And so on. @@ -1521,1137 +2290,1249 @@ case 46: cur_backend; pmsg ("this was backend definition [%d]\n", cur_service.nbackend); memset (&cur_backend, 0, sizeof(cur_backend)); - ; - break;} -case 47: + ;} + break; + + case 48: #line 606 "parser.y" -{ + { pmsg ("port statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_portspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 48: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_portspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 49: #line 618 "parser.y" -{ + { pmsg ("bindto statement [%d]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_bindspec; - yyval.set[0].v.sval = xstrdup(laststr); - ; - break;} -case 49: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_bindspec; + (yyval).set[0].v.sval = xstrdup(laststr); + ;} + break; + + case 50: #line 629 "parser.y" -{ + { setlaststr (laststring); free (laststring); laststring = 0; - ; - break;} -case 50: + ;} + break; + + case 51: #line 638 "parser.y" -{ + { setlastnr (SYMBOL); - ; - break;} -case 52: + ;} + break; + + case 53: #line 652 "parser.y" -{ + { pmsg ("verbosity statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_verbosityspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 53: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_verbosityspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 54: #line 662 "parser.y" -{ + { lastnr = 1; - ; - break;} -case 54: + ;} + break; + + case 55: #line 666 "parser.y" -{ + { lastnr = 0; - ; - break;} -case 55: + ;} + break; + + case 56: #line 675 "parser.y" -{ - yyval = yyvsp[-2]; - ; - break;} -case 58: + { + (yyval) = (yyvsp[(2) - (4)]); + ;} + break; + + case 59: #line 685 "parser.y" -{ - yyval.n = 0; - ; - break;} -case 59: + { + (yyval).n = 0; + ;} + break; + + case 60: #line 692 "parser.y" -{ + { pmsg ("dispatch mode statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_dispatchspec; - yyval.set[0].v.ival = lastnr; + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_dispatchspec; + (yyval).set[0].v.ival = lastnr; if (lastovernr && (lastnr != ds_bysize && lastnr != ds_byduration)) error ("Service '%s': this dispatch mode " "doesn't support 'over <connections>'", cur_service.name); - ; - break;} -case 60: + ;} + break; + + case 61: #line 709 "parser.y" -{ + { setlastovernr (SYMBOL); - ; - break;} -case 61: + ;} + break; + + case 62: #line 715 "parser.y" -{ + { pmsg ("external handler [%s]\n", laststr); if (lastnr != ds_externalhandler) error ("Service %s: this dispatch mode doesn't support " "an external handler", cur_service.name); setlastext (laststr); - ; - break;} -case 62: + ;} + break; + + case 63: #line 726 "parser.y" -{ - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].v.ival = lastnr; - ; - break;} -case 63: + { + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 64: #line 734 "parser.y" -{ + { lastnr = ds_roundrobin; - ; - break;} -case 64: + ;} + break; + + case 65: #line 738 "parser.y" -{ + { lastnr = ds_random; - ; - break;} -case 65: + ;} + break; + + case 66: #line 742 "parser.y" -{ + { lastnr = ds_byduration; - ; - break;} -case 66: + ;} + break; + + case 67: #line 746 "parser.y" -{ + { lastnr = ds_bysize; - ; - break;} -case 67: + ;} + break; + + case 68: #line 750 "parser.y" -{ + { lastnr = ds_byorder; - ; - break;} -case 68: + ;} + break; + + case 69: #line 754 "parser.y" -{ + { lastnr = ds_byconnections; - ; - break;} -case 69: + ;} + break; + + case 70: #line 758 "parser.y" -{ + { lastnr = ds_externalhandler; - ; - break;} -case 70: + ;} + break; + + case 71: #line 762 "parser.y" -{ + { lastnr = ds_byclientip; - ; - break;} -case 71: + ;} + break; + + case 72: #line 770 "parser.y" -{ + { pmsg ("user account statement [%d]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_useraccountspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 72: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_useraccountspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 73: #line 781 "parser.y" -{ + { setlaststr (laststring); free (laststring); laststring = 0; - ; - break;} -case 73: + ;} + break; + + case 74: #line 792 "parser.y" -{ + { pmsg ("reviving interval statement [%d]\n", lastnr); - yyval.n = 2; - yyval.set = xmalloc (2 * sizeof(Confset)); - yyval.set[0].cf = cf_revivespec; - yyval.set[0].v.ival = lastnr; - if (yyvsp[-1].n) { - pmsg ("reviving externalhandler [%s]\n", yyvsp[-1].set[0].v.sval); - yyval.set[1].v.sval = yyvsp[-1].set[0].v.sval; + (yyval).n = 2; + (yyval).set = xmalloc (2 * sizeof(Confset)); + (yyval).set[0].cf = cf_revivespec; + (yyval).set[0].v.ival = lastnr; + if ((yyvsp[(3) - (4)]).n) { + pmsg ("reviving externalhandler [%s]\n", (yyvsp[(3) - (4)]).set[0].v.sval); + (yyval).set[1].v.sval = (yyvsp[(3) - (4)]).set[0].v.sval; } else - yyval.set[1].v.sval = 0; - ; - break;} -case 74: + (yyval).set[1].v.sval = 0; + ;} + break; + + case 75: #line 810 "parser.y" -{ + { pmsg ("check interval [%d]\n", lastnr); - yyval.n = 2; - yyval.set = xmalloc (2 * sizeof(Confset)); - yyval.set[0].cf = cf_checkspec; - yyval.set[0].v.ival = lastnr; - if (yyvsp[-1].n) { - pmsg ("check externalhandler [%s]\n", yyvsp[-1].set[0].v.sval); - yyval.set[1].v.sval = yyvsp[-1].set[0].v.sval; + (yyval).n = 2; + (yyval).set = xmalloc (2 * sizeof(Confset)); + (yyval).set[0].cf = cf_checkspec; + (yyval).set[0].v.ival = lastnr; + if ((yyvsp[(3) - (4)]).n) { + pmsg ("check externalhandler [%s]\n", (yyvsp[(3) - (4)]).set[0].v.sval); + (yyval).set[1].v.sval = (yyvsp[(3) - (4)]).set[0].v.sval; } else - yyval.set[1].v.sval = 0; - ; - break;} -case 76: + (yyval).set[1].v.sval = 0; + ;} + break; + + case 77: #line 827 "parser.y" -{ - yyval.n = 0; - ; - break;} -case 77: + { + (yyval).n = 0; + ;} + break; + + case 78: #line 834 "parser.y" -{ - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 78: + { + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 79: #line 844 "parser.y" -{ + { pmsg ("backlog statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_backlogspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 79: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_backlogspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 80: #line 856 "parser.y" -{ + { pmsg ("shmkey statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_shmkeyspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 80: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_shmkeyspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 81: #line 868 "parser.y" -{ + { pmsg ("connection timeout statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_connectiontimeoutspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 81: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_connectiontimeoutspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 82: #line 880 "parser.y" -{ + { pmsg ("max clients statement (service) [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_maxconnectionsspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 82: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_maxconnectionsspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 83: #line 892 "parser.y" -{ + { pmsg ("service type [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_typespec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 84: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_typespec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 85: #line 907 "parser.y" -{ + { lastnr = type_any; - ; - break;} -case 85: + ;} + break; + + case 86: #line 911 "parser.y" -{ + { lastnr = type_http; - ; - break;} -case 86: + ;} + break; + + case 87: #line 919 "parser.y" -{ + { pmsg ("service header inspection [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_inspectionspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 88: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_inspectionspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 89: #line 934 "parser.y" -{ + { lastnr = ins_deep; - ; - break;} -case 89: + ;} + break; + + case 90: #line 938 "parser.y" -{ + { lastnr = ins_shallow; - ; - break;} -case 90: + ;} + break; + + case 91: #line 946 "parser.y" -{ + { pmsg ("allow from [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_allowfromspec; - yyval.set[0].v.sval = xstrdup(laststr); - ; - break;} -case 91: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_allowfromspec; + (yyval).set[0].v.sval = xstrdup(laststr); + ;} + break; + + case 92: #line 958 "parser.y" -{ + { pmsg ("deny from [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_denyfromspec; - yyval.set[0].v.sval = xstrdup(laststr); - ; - break;} -case 92: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_denyfromspec; + (yyval).set[0].v.sval = xstrdup(laststr); + ;} + break; + + case 93: #line 970 "parser.y" -{ + { pmsg ("allow file [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_allowfilespec; - yyval.set[0].v.sval = xstrdup(laststr); - ; - break;} -case 93: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_allowfilespec; + (yyval).set[0].v.sval = xstrdup(laststr); + ;} + break; + + case 94: #line 982 "parser.y" -{ + { pmsg ("deny file [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_allowfilespec; - yyval.set[0].v.sval = xstrdup(laststr); - ; - break;} -case 94: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_allowfilespec; + (yyval).set[0].v.sval = xstrdup(laststr); + ;} + break; + + case 95: #line 993 "parser.y" -{ + { setlaststr (laststring); free (laststring); laststring = 0; - ; - break;} -case 95: + ;} + break; + + case 96: #line 1005 "parser.y" -{ - yyval = yyvsp[-1]; - ; - break;} -case 96: + { + (yyval) = (yyvsp[(4) - (5)]); + ;} + break; + + case 97: #line 1012 "parser.y" -{ + { pmsg ("backend name [%s]\n", SYMBOL); for (i = 0; i < cur_service.nbackend; i++) if (!strcmp (cur_service.backend[i].name, SYMBOL)) error ("Service %s: back end '%s' multiply defined", cur_service.name, SYMBOL); cur_backend.name = xstrdup (SYMBOL); - ; - break;} -case 97: + ;} + break; + + case 98: #line 1024 "parser.y" -{ - yyvsp[-1].n++; - yyvsp[-1].set = xrealloc (yyvsp[-1].set, yyvsp[-1].n * sizeof(Confset)); - yyvsp[-1].set[yyvsp[-1].n - 1] = yyvsp[0].set[0]; - yyval = yyvsp[-1]; - ; - break;} -case 98: + { + (yyvsp[(1) - (2)]).n++; + (yyvsp[(1) - (2)]).set = xrealloc ((yyvsp[(1) - (2)]).set, (yyvsp[(1) - (2)]).n * sizeof(Confset)); + (yyvsp[(1) - (2)]).set[(yyvsp[(1) - (2)]).n - 1] = (yyvsp[(2) - (2)]).set[0]; + (yyval) = (yyvsp[(1) - (2)]); + ;} + break; + + case 99: #line 1031 "parser.y" -{ - yyval = yyvsp[0]; - ; - break;} -case 99: + { + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 100: #line 1038 "parser.y" -{ - yyval = yyvsp[0]; - ; - break;} -case 100: + { + (yyval) = (yyvsp[(2) - (2)]); + ;} + break; + + case 101: #line 1044 "parser.y" -{ - pmsg ("backend server [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 101: + { + pmsg ("backend server [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 102: #line 1049 "parser.y" -{ - pmsg ("backend port [%d]\n", yyvsp[0].set[0].v.ival); - yyval = yyvsp[0]; - ; - break;} -case 102: + { + pmsg ("backend port [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 103: #line 1054 "parser.y" -{ - pmsg ("backend verbosity [%d]\n", yyvsp[0].set[0].v.ival); - yyval = yyvsp[0]; - ; - break;} -case 103: + { + pmsg ("backend verbosity [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 104: #line 1059 "parser.y" -{ - pmsg ("backend onstart [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 104: + { + pmsg ("backend onstart [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 105: #line 1064 "parser.y" -{ - pmsg ("backend onend [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 105: + { + pmsg ("backend onend [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 106: #line 1069 "parser.y" -{ - pmsg ("backend onfail [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 106: + { + pmsg ("backend onfail [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 107: #line 1074 "parser.y" -{ - pmsg ("backend trafficlog [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 107: + { + pmsg ("backend trafficlog [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 108: #line 1079 "parser.y" -{ - pmsg ("backend trafficlog [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 108: + { + pmsg ("backend trafficlog [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 109: #line 1084 "parser.y" -{ - pmsg ("backend HTTP timing log [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 109: + { + pmsg ("backend HTTP timing log [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 110: #line 1089 "parser.y" -{ - pmsg ("backend weight [%d]\n", yyvsp[0].set[0].v.ival); - yyval = yyvsp[0]; - ; - break;} -case 110: + { + pmsg ("backend weight [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 111: #line 1094 "parser.y" -{ - pmsg ("backend decay [%d]\n", yyvsp[0].set[0].v.ival); - yyval = yyvsp[0]; - ; - break;} -case 111: + { + pmsg ("backend decay [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 112: #line 1099 "parser.y" -{ - pmsg ("backend maxconnections [%d]\n", yyvsp[0].set[0].v.ival); - yyval = yyvsp[0]; - ; - break;} -case 112: + { + pmsg ("backend maxconnections [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 113: #line 1104 "parser.y" -{ - pmsg ("backend sticky cookie [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 113: + { + pmsg ("backend sticky cookie [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 114: #line 1109 "parser.y" -{ - pmsg ("addclientheader [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 114: + { + pmsg ("addclientheader [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 115: #line 1114 "parser.y" -{ - pmsg ("setclientheader [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 115: + { + pmsg ("setclientheader [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 116: #line 1119 "parser.y" -{ - pmsg ("appendclientheader [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 116: + { + pmsg ("appendclientheader [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 117: #line 1124 "parser.y" -{ - pmsg ("addserverheader [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 117: + { + pmsg ("addserverheader [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 118: #line 1129 "parser.y" -{ - pmsg ("setserverheader [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 118: + { + pmsg ("setserverheader [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 119: #line 1134 "parser.y" -{ - pmsg ("appendserverheader [%s]\n", yyvsp[0].set[0].v.sval); - yyval = yyvsp[0]; - ; - break;} -case 119: + { + pmsg ("appendserverheader [%s]\n", (yyvsp[(1) - (1)]).set[0].v.sval); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 120: #line 1139 "parser.y" -{ - pmsg ("backend retries [%d]\n", yyvsp[0].set[0].v.ival); - yyval = yyvsp[0]; - ; - break;} -case 120: + { + pmsg ("backend retries [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 121: #line 1144 "parser.y" -{ - pmsg ("backend state [%d]\n", yyvsp[0].set[0].v.ival); - yyval = yyvsp[0]; - ; - break;} -case 121: + { + pmsg ("backend state [%d]\n", (yyvsp[(1) - (1)]).set[0].v.ival); + (yyval) = (yyvsp[(1) - (1)]); + ;} + break; + + case 122: #line 1154 "parser.y" -{ + { pmsg ("server statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_serverspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 122: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_serverspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 123: #line 1166 "parser.y" -{ + { pmsg ("weight statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_weightspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 123: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_weightspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 124: #line 1178 "parser.y" -{ + { pmsg ("decay statement [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_decayspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 124: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_decayspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 125: #line 1188 "parser.y" -{ + { setlaststr (laststring); - ; - break;} -case 125: + ;} + break; + + case 126: #line 1196 "parser.y" -{ + { pmsg ("retries [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_retriesspec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 126: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_retriesspec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 127: #line 1208 "parser.y" -{ + { pmsg ("state [%d]\n", lastnr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_statespec; - yyval.set[0].v.ival = lastnr; - ; - break;} -case 128: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_statespec; + (yyval).set[0].v.ival = lastnr; + ;} + break; + + case 129: #line 1223 "parser.y" -{ + { lastnr = st_available; - ; - break;} -case 129: + ;} + break; + + case 130: #line 1227 "parser.y" -{ + { lastnr = st_unavailable; - ; - break;} -case 130: + ;} + break; + + case 131: #line 1231 "parser.y" -{ + { lastnr = st_down; - ; - break;} -case 131: + ;} + break; + + case 132: #line 1239 "parser.y" -{ + { pmsg ("onstart statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_onstartspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 132: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_onstartspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 133: #line 1251 "parser.y" -{ + { pmsg ("onfail statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_onfailspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 133: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_onfailspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 134: #line 1263 "parser.y" -{ + { pmsg ("onend statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_onendspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 134: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_onendspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 135: #line 1275 "parser.y" -{ + { pmsg ("trafficlog statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_dumpspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 135: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_dumpspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 136: #line 1287 "parser.y" -{ + { pmsg ("throughputlog statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_thruspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 136: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_thruspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 137: #line 1299 "parser.y" -{ + { pmsg ("httptiminglog statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_httptimingspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 137: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_httptimingspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 138: #line 1310 "parser.y" -{ + { setlaststr (laststring); free (laststring); laststring = 0; - ; - break;} -case 138: + ;} + break; + + case 139: #line 1319 "parser.y" -{ + { setlaststr (laststring); free (laststring); laststring = 0; - ; - break;} -case 139: + ;} + break; + + case 140: #line 1329 "parser.y" -{ + { pmsg ("insertcookie statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof (Confset)); - yyval.set[0].cf = cf_stickycookiespec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 140: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof (Confset)); + (yyval).set[0].cf = cf_stickycookiespec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 141: #line 1340 "parser.y" -{ + { setlaststr (laststring); free (laststring); laststring = 0; - ; - break;} -case 141: + ;} + break; + + case 142: #line 1350 "parser.y" -{ + { pmsg ("addclientheader statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_addclientheaderspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 142: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_addclientheaderspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 143: #line 1362 "parser.y" -{ + { pmsg ("setclientheader statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_setclientheaderspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 143: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_setclientheaderspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 144: #line 1374 "parser.y" -{ + { pmsg ("appendclientheader statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_appendclientheaderspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 144: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_appendclientheaderspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 145: #line 1386 "parser.y" -{ + { pmsg ("addserverheader statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_addserverheaderspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 145: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_addserverheaderspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 146: #line 1398 "parser.y" -{ + { pmsg ("setserverheader statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_setserverheaderspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 146: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_setserverheaderspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 147: #line 1410 "parser.y" -{ + { pmsg ("appendserverheader statement [%s]\n", laststr); - yyval.n = 1; - yyval.set = xmalloc (sizeof(Confset)); - yyval.set[0].cf = cf_appendserverheaderspec; - yyval.set[0].v.sval = xstrdup (laststr); - ; - break;} -case 147: + (yyval).n = 1; + (yyval).set = xmalloc (sizeof(Confset)); + (yyval).set[0].cf = cf_appendserverheaderspec; + (yyval).set[0].v.sval = xstrdup (laststr); + ;} + break; + + case 148: #line 1421 "parser.y" -{ + { setlaststr (laststring); free (laststring); laststring = 0; - ; - break;} -case 148: + ;} + break; + + case 149: #line 1428 "parser.y" -{ + { yyerrmsg = "HTTP header specifier expected"; -; - break;} -case 149: +;} + break; + + case 150: #line 1433 "parser.y" -{ + { yyerrmsg = "cookie specifier expected"; -; - break;} -case 150: +;} + break; + + case 151: #line 1438 "parser.y" -{ + { yyerrmsg = "number expected"; -; - break;} -case 151: +;} + break; + + case 152: #line 1443 "parser.y" -{ + { yyerrmsg = "hostname or IP address expected"; -; - break;} -case 152: +;} + break; + + case 153: #line 1448 "parser.y" -{ + { yyerrmsg = "'service' expected"; -; - break;} -case 153: +;} + break; + + case 154: #line 1453 "parser.y" -{ + { yyerrmsg = "backend definition statement expected"; -; - break;} -case 154: +;} + break; + + case 155: #line 1458 "parser.y" -{ + { yyerrmsg = "service body statement expected"; -; - break;} -case 155: +;} + break; + + case 156: #line 1463 "parser.y" -{ + { yyerrmsg = "semicolon (;) expected"; -; - break;} -case 156: +;} + break; + + case 157: #line 1468 "parser.y" -{ + { yyerrmsg = "'on' or 'off' expetcted"; -; - break;} -case 157: +;} + break; + + case 158: #line 1473 "parser.y" -{ + { yyerrmsg = "dispatch method expected"; -; - break;} -case 158: +;} + break; + + case 159: #line 1478 "parser.y" -{ + { yyerrmsg = "command line expected"; -; - break;} -case 159: +;} + break; + + case 160: #line 1483 "parser.y" -{ + { yyerrmsg = "file name expected"; -; - break;} -case 160: +;} + break; + + case 161: #line 1488 "parser.y" -{ + { yyerrmsg = "service name (identifier) expected"; -; - break;} -case 161: +;} + break; + + case 162: #line 1493 "parser.y" -{ + { yyerrmsg = "backend name (identifier) expected"; -; - break;} -case 162: +;} + break; + + case 163: #line 1498 "parser.y" -{ + { yyerrmsg = "IP address such as 1.2.3.4 or 'any' expected"; -; - break;} -case 163: +;} + break; + + case 164: #line 1503 "parser.y" -{ + { yyerrmsg = "Service type expected ('any', 'stickyhttp', ...)"; -; - break;} -case 164: +;} + break; + + case 165: #line 1508 "parser.y" -{ + { yyerrmsg = "Header inspection mode mode expected ('shallow' or 'deep')"; -; - break;} -case 165: +;} + break; + + case 166: #line 1513 "parser.y" -{ + { yyerrmsg = "IP filter(s) expected"; -; - break;} -case 166: +;} + break; + + case 167: #line 1518 "parser.y" -{ + { yyerrmsg = "username expected"; -; - break;} -case 167: +;} + break; + + case 168: #line 1523 "parser.y" -{ + { yyerrmsg = "state definition expected"; -; - break;} -case 170: +;} + break; + + case 171: #line 1538 "parser.y" -{ + { yyerrmsg = "'{' expected"; -; - break;} -case 171: +;} + break; + + case 172: #line 1542 "parser.y" -{ + { yyerrmsg = "'}' expected"; -; - break;} -case 172: +;} + break; + + case 173: #line 1546 "parser.y" -{ + { yyerrmsg = "option statement (logactivity, tcpbuffersize, ...) expected"; -; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/share/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif +;} + break; -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); + +/* Line 1267 of yacc.c. */ +#line 3320 "parser.c" + default: break; } -#endif + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif } - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token - after shifting the error token. */ + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; - yyerrstatus = 3; /* Each real token shifted decrements this */ - goto yyerrhandle; +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: -yyerrdefault: /* current state does not do anything special for the error token. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; -yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -#if YYDEBUG != 0 - if (yydebug) + for (;;) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - else if (yyn == 0) - goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ #endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); } - return 1; +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 1549 "parser.y" + + + diff --git a/src/lib/parser.h b/src/lib/parser.h @@ -1,72 +1,189 @@ -#ifndef YYSTYPE -#define YYSTYPE int +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + IDENTIFIER = 258, + NUMBER = 259, + STRING = 260, + SERVICE = 261, + PORT = 262, + VERBOSITY = 263, + MAXCONNECTIONS = 264, + TYPE = 265, + ANY = 266, + HTTP = 267, + BACKEND = 268, + SERVER = 269, + BINDTO = 270, + CONNECTIONTIMEOUT = 271, + ON = 272, + OFF = 273, + DISPATCHMODE = 274, + ROUNDROBIN = 275, + RANDOM = 276, + BYDURATION = 277, + BYSIZE = 278, + BYCONNECTIONS = 279, + BYORDER = 280, + BYCLIENTIP = 281, + OVER = 282, + DECAY = 283, + REVIVINGINTERVAL = 284, + CHECKINTERVAL = 285, + RETRIES = 286, + SHMKEY = 287, + WEIGHT = 288, + ONSTART = 289, + ONFAIL = 290, + BACKLOG = 291, + THROUGHPUTLOG = 292, + TRAFFICLOG = 293, + HTTPTIMINGLOG = 294, + STICKYCOOKIE = 295, + ADDCLIENTHEADER = 296, + SETCLIENTHEADER = 297, + APPENDCLIENTHEADER = 298, + ADDSERVERHEADER = 299, + SETSERVERHEADER = 300, + APPENDSERVERHEADER = 301, + ALLOWFROM = 302, + DENYFROM = 303, + ALLOWFILE = 304, + DENYFILE = 305, + EXTERNALHANDLER = 306, + USERACCOUNT = 307, + ONEND = 308, + HEADERINSPECTION = 309, + DEEP = 310, + SHALLOW = 311, + STATE = 312, + AVAILABLE = 313, + UNAVAILABLE = 314, + DOWN = 315, + OPTIONS = 316, + LOGACTIVITY = 317, + TCPBUFFERSIZE = 318, + DNSCACHETTL = 319, + LOGFACILITY = 320, + SHMPERMISSIONS = 321, + SLOPPYPORTBIND = 322, + LEAVEPROCESSTITLE = 323 + }; #endif -#define IDENTIFIER 257 -#define NUMBER 258 -#define STRING 259 -#define SERVICE 260 -#define PORT 261 -#define VERBOSITY 262 -#define MAXCONNECTIONS 263 -#define TYPE 264 -#define ANY 265 -#define HTTP 266 -#define BACKEND 267 -#define SERVER 268 -#define BINDTO 269 -#define CONNECTIONTIMEOUT 270 -#define ON 271 -#define OFF 272 -#define DISPATCHMODE 273 -#define ROUNDROBIN 274 -#define RANDOM 275 -#define BYDURATION 276 -#define BYSIZE 277 -#define BYCONNECTIONS 278 -#define BYORDER 279 -#define BYCLIENTIP 280 -#define OVER 281 -#define DECAY 282 -#define REVIVINGINTERVAL 283 -#define CHECKINTERVAL 284 -#define RETRIES 285 -#define SHMKEY 286 -#define WEIGHT 287 -#define ONSTART 288 -#define ONFAIL 289 -#define BACKLOG 290 -#define THROUGHPUTLOG 291 -#define TRAFFICLOG 292 -#define HTTPTIMINGLOG 293 -#define STICKYCOOKIE 294 -#define ADDCLIENTHEADER 295 -#define SETCLIENTHEADER 296 -#define APPENDCLIENTHEADER 297 -#define ADDSERVERHEADER 298 -#define SETSERVERHEADER 299 -#define APPENDSERVERHEADER 300 -#define ALLOWFROM 301 -#define DENYFROM 302 -#define ALLOWFILE 303 -#define DENYFILE 304 -#define EXTERNALHANDLER 305 -#define USERACCOUNT 306 -#define ONEND 307 -#define HEADERINSPECTION 308 -#define DEEP 309 -#define SHALLOW 310 -#define STATE 311 -#define AVAILABLE 312 -#define UNAVAILABLE 313 -#define DOWN 314 -#define OPTIONS 315 -#define LOGACTIVITY 316 -#define TCPBUFFERSIZE 317 -#define DNSCACHETTL 318 -#define LOGFACILITY 319 -#define SHMPERMISSIONS 320 -#define SLOPPYPORTBIND 321 -#define LEAVEPROCESSTITLE 322 +/* Tokens. */ +#define IDENTIFIER 258 +#define NUMBER 259 +#define STRING 260 +#define SERVICE 261 +#define PORT 262 +#define VERBOSITY 263 +#define MAXCONNECTIONS 264 +#define TYPE 265 +#define ANY 266 +#define HTTP 267 +#define BACKEND 268 +#define SERVER 269 +#define BINDTO 270 +#define CONNECTIONTIMEOUT 271 +#define ON 272 +#define OFF 273 +#define DISPATCHMODE 274 +#define ROUNDROBIN 275 +#define RANDOM 276 +#define BYDURATION 277 +#define BYSIZE 278 +#define BYCONNECTIONS 279 +#define BYORDER 280 +#define BYCLIENTIP 281 +#define OVER 282 +#define DECAY 283 +#define REVIVINGINTERVAL 284 +#define CHECKINTERVAL 285 +#define RETRIES 286 +#define SHMKEY 287 +#define WEIGHT 288 +#define ONSTART 289 +#define ONFAIL 290 +#define BACKLOG 291 +#define THROUGHPUTLOG 292 +#define TRAFFICLOG 293 +#define HTTPTIMINGLOG 294 +#define STICKYCOOKIE 295 +#define ADDCLIENTHEADER 296 +#define SETCLIENTHEADER 297 +#define APPENDCLIENTHEADER 298 +#define ADDSERVERHEADER 299 +#define SETSERVERHEADER 300 +#define APPENDSERVERHEADER 301 +#define ALLOWFROM 302 +#define DENYFROM 303 +#define ALLOWFILE 304 +#define DENYFILE 305 +#define EXTERNALHANDLER 306 +#define USERACCOUNT 307 +#define ONEND 308 +#define HEADERINSPECTION 309 +#define DEEP 310 +#define SHALLOW 311 +#define STATE 312 +#define AVAILABLE 313 +#define UNAVAILABLE 314 +#define DOWN 315 +#define OPTIONS 316 +#define LOGACTIVITY 317 +#define TCPBUFFERSIZE 318 +#define DNSCACHETTL 319 +#define LOGFACILITY 320 +#define SHMPERMISSIONS 321 +#define SLOPPYPORTBIND 322 +#define LEAVEPROCESSTITLE 323 + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + extern YYSTYPE yylval; + diff --git a/src/lib/parserclose.c b/src/lib/parserclose.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,12 +24,10 @@ void runservice () { /* Go into the background. */ if ( (pid = fork()) < 0 ) { /* Fork failed */ - error ("Service %s: fork failure: %s", - activeservice->name, strerror(errno)); + error ("fork failure: %s", strerror(errno)); } else if (pid) { /* Parent branch */ - msg ("Service %s: detached as PID %d", - activeservice->name, pid); + msg ("detached as PID %d", pid); return; } @@ -46,8 +44,7 @@ void runservice () { config_msg(); limits_msg(); - msg ("Service %s (on port %d): STARTING", - activeservice->name, activeservice->port); + msg ("STARTING on port %d", activeservice->port); set_program_title ("crossroads - Service %s: listening", activeservice->name); @@ -57,12 +54,9 @@ void runservice () { if ( (open ("/dev/null", O_RDONLY) < 0) || (open ("/dev/null", O_WRONLY) < 0) || (open ("/dev/null", O_WRONLY) < 0) ) - error ("Service %s: " - "failed to reopen stdin/out/err on /dev/null", - activeservice->name); + error ("failed to reopen stdin/out/err on /dev/null"); if (setsid() < 0) - error ("Service %s: failed to become session leader", - activeservice->name); + error ("failed to become session leader"); /* In 'forever' mode, we create a server-side socket and ask tcpserve() * to service it. tcpserve() will return to us if there are no back @@ -73,7 +67,7 @@ void runservice () { while (1) { /* We need at least one working back end to operate. */ if (!backend_count()) { - msg ("Service %s: taking a nap...", activeservice->name); + msg ("taking a nap..."); sleep (SLEEP_TIME); continue; } @@ -83,12 +77,10 @@ void runservice () { if ( (listen_sock = make_socket (activeservice->port, activeservice->bind)) < 0 ) { if (!opt.sloppyportbind) - error ("Service %s: failed to listen to port %d: %s", - activeservice->name, activeservice->port, + error ("failed to listen to port %d: %s", + activeservice->port, strerror(errno)); - warning ("Service %s: " - "listening socket creation failed.. will retry", - activeservice->name); + warning ("listening socket creation failed.. will retry"); /* We wait here for some time, to let the system regain * equilibrium. Something's really afoot, so let's not retry @@ -98,8 +90,7 @@ void runservice () { continue; } - msg ("Service %s: server-side network socket: %d", - activeservice->name, listen_sock); + msg ("server-side network socket: %d", listen_sock); /* Zero out the stats for first usage. */ if (first_serving) { @@ -117,12 +108,10 @@ void runservice () { /* tcpserve() returned -- must be because this service is out * of back ends */ if (shutdown (listen_sock, SHUT_RDWR)) - warning ("Service %s: " - "failed to shut down server-side socket %d: %s", - activeservice->name, listen_sock, strerror(errno)); + warning ("failed to shut down server-side socket %d: %s", + listen_sock, strerror(errno)); if (close (listen_sock)) - warning ("Service %s: " - "failed to close server-side socket %d: %s", - activeservice->name, listen_sock, strerror(errno)); + warning ("failed to close server-side socket %d: %s", + listen_sock, strerror(errno)); } } diff --git a/src/lib/setproctitle.c b/src/lib/setproctitle.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/setprogramtitle.c b/src/lib/setprogramtitle.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -16,7 +16,6 @@ void show_config () { "AUTHORNAME author: %s\n" "MAINTAINERNAME maintainer: %s\n" "MAINTAINEREMAIL e-mail of maintainer: %s\n" - "DEFAULT_CONF default configuration file: %s\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" @@ -35,7 +34,7 @@ void show_config () { , VER, REVVER, YEARS, AUTHORNAME, MAINTAINERNAME, MAINTAINEREMAIL, - DEFAULT_CONF, FQDN_LENGTH, SLEEP_TIME, DEF_MAX, + 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/stagetostring.c b/src/lib/stagetostring.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,14 +10,14 @@ char *strcasestr (char const *big, char const *little) { char *bcopy, *lcopy, *res; if (!little || !*little) - return (big); + return ( (char*) big); if (!big || !*big) return (0); bcopy = strupr (xstrdup (big)); lcopy = strupr (xstrdup (little)); - if ( (res = strstr (big, little)) ) - res = big + (res - bcopy); + if ( (res = strstr (bcopy, lcopy)) ) + res = (char*) big + (res - bcopy); free (bcopy); free (lcopy); return (res); diff --git a/src/lib/strexpandformat.c b/src/lib/strexpandformat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -31,8 +31,8 @@ char *fmt_expand (char const *s, int *skip, int fmt_number) { (*skip)++; /* - msg ("Service %s: Fmt expand [%s], skip=%d, nr=%d", - activeservice->name, s, *skip, fmt_number); + msg ("Fmt expand [%s], skip=%d, nr=%d", + s, *skip, fmt_number); */ switch (*s) { @@ -179,8 +179,8 @@ char *str_expand_format (char const *h) { } /* - msg ("Service %s: String [%s] expanded to [%s]", - activeservice->name, h, ret); + msg ("String [%s] expanded to [%s]", + h, ret); */ return (ret); } diff --git a/src/lib/stringtostate.c b/src/lib/stringtostate.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/strnstr.c b/src/lib/strnstr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -19,11 +19,10 @@ int sysrun (char const *cmd) { expanded = str_expand_format (cmd); # ifdef DEBUG - msg ("Service %s: running command '%s'", activeservice->name, expanded); + msg ("running command '%s'", expanded); # else if (program_stage != stage_retrying) - msg ("Service %s: running command: '%s'", - activeservice->name, expanded); + msg ("running command: '%s'", expanded); # endif /* Child signals are handled in system now. Also assume the right UID. */ @@ -36,16 +35,13 @@ int sysrun (char const *cmd) { signal (SIGCHLD, SIG_IGN); if (ret > 0) - warning ("Service %s: command '%s' returned %d", - activeservice->name, expanded, ret); + warning ("command '%s' returned %d", expanded, ret); else if (ret < 0) - warning ("Service %s: failed to run command '%s': %s", - activeservice->name, expanded, strerror(errno)); + warning ("failed to run command '%s': %s", expanded, strerror(errno)); # ifdef DEBUG if (!ret) - msg ("Service %s: command '%s' returned %d", - activeservice->name, expanded, ret); + msg ("command '%s' returned %d", expanded, ret); # endif free (expanded); diff --git a/src/lib/tcpserve.c b/src/lib/tcpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -23,7 +23,7 @@ void tcpserve (int server_sock) { signal (SIGCHLD, SIG_IGN); /* Set wakeup handler for the wakeup calls. */ if (activeservice->rev_interval || activeservice->check_interval) { - msg ("Service %s: Starting wakeup handler", activeservice->name); + msg ("Starting wakeup handler"); if ( (pid = fork()) < 0 ) error ("Fork failed: %s", strerror(errno)); else if (!pid) { @@ -31,23 +31,21 @@ void tcpserve (int server_sock) { activeservice->name); wakeup_handler(); } else { - msg ("Service %s: started wakeup handler at pid %d", - activeservice->name, pid); + msg ("started wakeup handler at pid %d", pid); servicereport->rev_pid = pid; } } else { - msg ("Service %s: Wakeup hander not started (reviving interval " - "%d, check %d)", - activeservice->name, activeservice->rev_interval, + msg ("Wakeup hander not started (reviving interval %d, check %d)", + activeservice->rev_interval, 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, " + msg ("Initial availability of back end %s: %s, " "initial server:port: %s:%d", - activeservice->name, activeservice->backend[i].name, + activeservice->backend[i].name, state_to_string(activeservice->backend[i].initial_avail), activeservice->backend[i].initial_server, activeservice->backend[i].initial_port); @@ -61,11 +59,10 @@ void tcpserve (int server_sock) { } /* Start the listener. */ - msg ("Service %s: awaiting activity on port %d (socket fd %d)", - activeservice->name, activeservice->port, server_sock); + msg ("awaiting activity on port %d (socket fd %d)", + 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)); + error ("failed to listen to server_socket: %s", strerror(errno)); /* We're a service now. Never return, never exit * (unless something is REALLY wrong). @@ -82,8 +79,8 @@ void tcpserve (int server_sock) { &(activeservice->denychain), &(activeservice->ndenychain))) warning ("Bad syntax in deny file"); - msg ("Service %s: allow chain has %d entries, " - "deny chain has %d entries", activeservice->name, + msg ("allow chain has %d entries, " + "deny chain has %d entries", activeservice->nallowchain, activeservice->ndenychain); } @@ -91,8 +88,8 @@ void tcpserve (int server_sock) { FD_ZERO (&set); FD_SET (server_sock, &set); if (select (FD_SETSIZE, &set, 0, 0, 0) < 0) { - msg ("Service %s: interrupt while waiting for activity: %d (%s)", - activeservice->name, errno, strerror(errno)); + msg ("interrupt while waiting for activity: %d (%s)", + errno, strerror(errno)); continue; } @@ -100,16 +97,14 @@ void tcpserve (int server_sock) { size = sizeof(clientname); if ( (new = accept (server_sock, (struct sockaddr *) &clientname, (socklen_t *) &size)) < 0 ) { - warning ("Service %s: failure while accepting on " - "server socket: %s", activeservice->name, + warning ("failure while accepting on server socket: %s", strerror(errno)); continue; } /* Store client IP, it's used for lots of logging. */ client_ip = inet_ntoa (clientname.sin_addr); - msg ("Service %s: connection from %s, socket %d", - activeservice->name, client_ip, new); + msg ("connection from %s, socket %d", client_ip, new); /* Leave it alone if there are no back ends or if we exceed * the max allowed clients. IN THAT CASE WE RETURN so that @@ -120,8 +115,7 @@ void tcpserve (int server_sock) { */ if (activeservice->dispatchtype != ds_externalhandler && backend_count() == 0) { - warning ("Service %s: no back ends available", - activeservice->name); + warning ("no back ends available"); close (new); return; } @@ -140,9 +134,9 @@ void tcpserve (int server_sock) { if (sscanf (cp, "%u", &octet) > 0) { client_ip_nr |= (octet << counter); /* - msg ("Service %s: Client IP part 0x%2.2x (%d), " + msg ("Client IP part 0x%2.2x (%d), " "hex client so far: 0x%8.8x", - activeservice->name, octet, octet, client_ip_nr); + octet, octet, client_ip_nr); */ } } @@ -150,14 +144,13 @@ void tcpserve (int server_sock) { /* Check allow/deny lists. */ if (ipf_denied ()) { - warning ("Service %s: %s matches deny list, " - "terminating connection", activeservice->name, client_ip); + warning ("%s matches deny list, terminating connection", client_ip); close (new); continue; } if (!ipf_allowed ()) { - warning ("Service %s: %s failes to match allow list, " - "terminating connection", activeservice->name, client_ip); + warning ("%s failes to match allow list, terminating connection", + client_ip); close (new); continue; } @@ -167,11 +160,9 @@ void tcpserve (int server_sock) { * hinder the listener. */ if ( (pid = fork()) < 0) - error ("Service %s: Fork failed: %s", - activeservice->name, strerror(errno)); + error ("Fork failed: %s", strerror(errno)); else if (pid) { - msg ("Service %s: Dispatching phase started as pid %d", - activeservice->name, pid); + msg ("Dispatching phase started as pid %d", pid); close (new); continue; } @@ -189,25 +180,21 @@ void tcpserve (int server_sock) { /* Retry back ends until we succeed. */ while (1) { - msg ("Service %s: About to choose a back end", - activeservice->name); + msg ("About to choose a back end"); choose_backend(); if (current_backend < 0) { - error ("Service %s: Could not select a back end", - activeservice->name); + error ("Could not select a back end"); close (new); } /* Connect to the backend. If this fails then we'll sleep * and re-enter the backend selection loop instead of returning. * In the loop we may need to decide to quit after all. */ - msg ("Service %s: trying back end %s, port %d", - activeservice->name, + msg ("trying back end %s, port %d", 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, + warning ("failed to connect to server %s:%d (ret %d)", servicereport->backendstate[current_backend].actual_server, servicereport->backendstate[current_backend].actual_port, backend_sock); diff --git a/src/lib/thruputlog.c b/src/lib/thruputlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/timeofday.c b/src/lib/timeofday.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -14,15 +14,15 @@ void uid_assume() { if (activeservice->gid) { gid_org = getgid(); if (setegid (activeservice->gid)) - error ("Service %s: cannot set effective gid to %d: %s", - activeservice->name, activeservice->gid, + error ("cannot set effective gid to %d: %s", + activeservice->gid, strerror(errno)); gid_set++; } uid_org = getuid(); if (seteuid (activeservice->uid)) - error ("Service %s: cannot set effective uid to %d: %s", - activeservice->name, activeservice->uid, strerror(errno)); + error ("cannot set effective uid to %d: %s", + activeservice->uid, strerror(errno)); uid_set++; } } diff --git a/src/lib/uidrestore.c b/src/lib/uidrestore.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,7 +11,6 @@ void usage () { fprintf (stderr, "\n" USAGETEXT "\n", VER, AUTHORNAME, YEARS, MAINTAINERNAME, MAINTAINEREMAIL, - DEFAULT_TCP_BUFSZ, - DEFAULT_CONF, DNS_CACHETTL); + DEFAULT_TCP_BUFSZ, DNS_CACHETTL); exit (1); } diff --git a/src/lib/usage.txt b/src/lib/usage.txt @@ -6,7 +6,7 @@ For distributions and updates, visit http://crossroads.e-tunity.com. Usage: ** Controlling the daemon: ** crossroads [flags] start: start all services - crossroads [flags] status [service [backend]]: show the services + crossroads [flags] status [SERVICE [BACKEND]]: show the services and their status, optionally of stated service and/or back end crossroads [flags] stop: stop all services crossroads [flags] restart: stop and then start @@ -26,16 +26,15 @@ Supported flags: -b: Writes binary options and configuration to stdout (debugging only) -B BUFSZ Defines the network buffer size, default %d bytes -C: Shows compile-time configuration and stops - -c CONFIG: Uses the named configuration, instead of the default - %s + -c CONFIG: Uses the named configuration -d TTL: Specifies the time to live of cached DNS entries, - default %d (sec) + default %d (seconds, 0 is no caching) -h: Logs timings of HTTP processing to syslog - -l FAC: Specifies the openlog(3) facility to use when - logging. Default is LOG_DAEMON. Allowed values are 0..7 - for LOG_LOCAL0 to LOG_LOCAL7. + -l FAC: Specifies the openlog(3) facility to use when logging. Default + is LOG_DAEMON. Allowed values are 0..7 for LOG_LOCAL0 to + LOG_LOCAL7. -m PERM: Sets permissions for shm access to PERM, which is an - octal number. Defaults to 0644. + octal number. Defaults to 0644. -P: Parser and lexer actions will be verbose (debugging only) -p: Process title will not be altered; 'ps' will show 'crossroads-daemon' instead of custom title diff --git a/src/lib/vsyslog.c b/src/lib/vsyslog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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,8 +43,7 @@ void wakeup_handler () { continue; # ifdef DEBUG - msg ("Service %s: verifying back end %s, old state %s", - activeservice->name, + msg ("verifying back end %s, old state %s", activeservice->backend[current_backend].name, state_to_string(prev)); # endif diff --git a/src/lib/warning.c b/src/lib/warning.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -15,9 +15,18 @@ void warning (char const *fmt, ...) { va_start (args, fmt); str = str_vprintf (fmt, args); - if (!daemonized) - fprintf (stderr, "WARNING: %s\n", str); - else - writelog (LOG_ERR, "WARNING: %s", str); + if (!daemonized) { + if (activeservice) + fprintf (stderr, "WARNING, Service %s: %s", + activeservice->name, str); + else + fprintf (stderr, "WARNING: %s\n", str); + } else { + if (activeservice) + writelog (LOG_ERR, "WARNING, Service %s: %s", + activeservice->name, str); + else + writelog (LOG_ERR, "WARNING: %s", str); + } free (str); } diff --git a/src/lib/writelog.c b/src/lib/writelog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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.78, a load balancer and fail over + * This file is part of Crosroads 1.79, 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/tools/c-conf b/tools/c-conf @@ -4,7 +4,8 @@ use strict; use Getopt::Std; # Globals -my $VER = "1.11"; +my $VER = "1.12"; +# 1.12 [KK 2008-04-15] Messaging improved upon -v flag # 1.11 [KK 2008-01-14] Added /opt/local/{lib,include} to the standard libs. # Also added /sw # 1.10 [KK 2007-08-29] Added libvariable01 and flag -l. Flags -l/L get @@ -143,21 +144,19 @@ sub dirname ($) { sub uname() { my $ret = `uname`; chomp ($ret); - msg ("uname: $ret\n"); return ($ret); } # Find a binary along the path. sub findbin($) { my $bin = shift; - msg ("Looking for executable '$bin'\n"); foreach my $d (split (/:/, $ENV{PATH})) { if (-x "$d/$bin" or -f "$d/bin.exe") { - msg ("Found as '$d/$bin'\n"); + msg ("Found executable '$bin' as '$d/$bin'\n"); return ("$d/$bin"); } } - msg ("Not found!\n"); + msg ("Failed to locate executable '$bin'!\n"); } # Recursively determine the files under a given dir. @@ -169,29 +168,16 @@ sub subfiles ($$$) { my ($dev, $ino) = stat($dir) or return (undef); my $tag = sprintf ("%d-%d", $dev, $ino); - if ($_dir_visited{$tag}) { - msg ("Path '$dir' was already visited (as $_dir_visited{$tag})\n"); - return (undef); - } + return (undef) if ($_dir_visited{$tag}); $_dir_visited{$tag} = $dir; - - msg ("Scanning for '$mask' under '$dir'\n"); - if (! -d $dir) { - msg ("Scan path ends, '$dir' is not an accessible directory\n"); - return (undef); - } + return (undef) unless (-d $dir); my @ret = (); foreach my $f (glob ("$dir/$mask")) { - if (-f $f) { - push (@ret, $f); - msg ("Found a hit as '$f'\n"); - } - msg ("Hits so far: ", $#ret + 1, "\n") if ($#ret > -1); + push (@ret, $f) if (-f $f); } foreach my $d (glob ("$dir/*")) { next unless (-d $d); - msg ("Recursing from '$dir' into '$d'\n"); my @subret = subfiles ("$d", $mask, 1); my $added = 0; foreach my $f (@subret) { @@ -200,13 +186,10 @@ sub subfiles ($$$) { $added++; } } - msg ("Added ", $added, " hits from '$d'\n") if ($added); } if ($#ret > -1) { - msg ("Found ", $#ret + 1, " entries matching '$mask' under '$dir'\n"); return (@ret); } else { - # msg ("No entries matching '$mask' under '$dir' found\n"); return (undef); } } @@ -240,10 +223,10 @@ ENDHELP usage() if ($#_ != 1); my ($h, $def) = @_; - msg ("Looking for '$h'\n"); foreach my $d (@headerdirs) { if (-f "$d/$h") { + msg ("Header '$h' found as '$d/$h'\n"); output ("-D$def"); return; } @@ -265,7 +248,6 @@ ENDHELP usage() if ($#_ != 1); my ($h, $def) = @_; - msg ("Looking for '$h'\n"); foreach my $d (@headerdirs) { if (-f "$d/$h") { output ("-D$def=1"); @@ -289,13 +271,11 @@ ENDHELP usage() if ($#_ == -1); foreach my $h (@_) { - msg ("Looking for '$h'\n"); my $found = 0; foreach my $d (@headerdirs) { - msg ("Trying '$d/$h'\n"); if (-f "$d/$h") { $found++; - msg ("Found\n"); + msg ("Header '$h' found as '$d/$h\n"); output ("-I$d"); last; } @@ -318,12 +298,11 @@ ENDHELP usage() if ($#_ == -1); foreach my $headerdir (@_) { - msg ("Looking for header dir '$headerdir'\n"); my $found = 0; foreach my $d (@headerdirs) { - msg ("Trying as '$d/$headerdir'\n"); my $target = "$d/$headerdir"; if (subfiles ($target, '*.h', 0)) { + msg ("Header directory '$headerdir' found as '$target'\n"); output ("-I$target"); $found++; } @@ -347,13 +326,11 @@ ENDHELP my %dirshown; foreach my $lib (@_) { - msg ("Looking for lib '$lib'\n"); my $found = 0; foreach my $d (@libdirs) { - msg ("Trying under '$d'\n"); my $hit = (subfiles ($d, "lib$lib.*", 0))[0]; if ($hit) { - msg ("Found as '$hit'\n"); + msg ("Library '$lib' found as '$hit'\n"); $found++; $hit =~ s{/[^/]*$}{}; if (! $dirshown{$hit}) { @@ -379,11 +356,14 @@ CFLAGS = -c -g -Wall \$(shell c-conf so-cflags) ENDHELP usage() if ($#_ > -1); + my $flags; if (uname() eq 'Darwin') { - output ('-fPIC'); + $flags = '-fPIC'; } elsif (uname() eq 'Linux') { - output ('-fpic'); + $flags = '-fpic'; } + msg ("Shared object compilation flags: '$flags'\n"); + output ($flags); } # Linkage flags to make an so. @@ -401,11 +381,14 @@ ENDHELP usage() if ($#_ > -1); my $lib = shift; + my $flags; if (uname() eq 'Darwin') { - output ("-dynamiclib -Wl,-single_module"); + $flags = "-dynamiclib -Wl,-single_module"; } else { - output ("-shared"); + $flags = "-shared"; } + msg ("Shared library linkage flags: '$flags'\n"); + output ($flags); } # Find the C compiler and return it, or die trying. @@ -430,6 +413,7 @@ ENDHELP if ($@) { warn ($@); } else { + msg ("C compiler: '$cc'\n"); output ($cc); } } @@ -445,6 +429,7 @@ ENDHELP usage() if ($#_ > -1); foreach my $c (@cpp_compilers) { if (findbin ($c)) { + msg ("C++ compiler: '$c'\n"); output ($c); return; } @@ -475,8 +460,10 @@ ENDHELP } if ($dir ne '') { + msg ("Shared library name for '$name': '$dir/$dest'\n"); output ("$dir/$dest"); } else { + msg ("Shared library name for '$name': '$dest'\n"); output ("$dest"); } } @@ -492,8 +479,13 @@ E.g.: $base libfunction printf HAVE_PRINTF $base libfunction foo_bar HAVE_FOOBAR -> (nothing) ENDHELP - - output ("-D$_[1]=1") if (test_libfunction (@_)); + + if (test_libfunction (@_)) { + msg ("Library function '$_[1]' present\n"); + output ("-D$_[1]=1"); + } else { + msg ("Library function '$_[1]' absent\n"); + } } # Check that a lib variable is present, 01 version @@ -506,8 +498,10 @@ E.g.: $base libvariable01 errno HAVE_ERRNO ENDHELP if (test_libvariable(@_)) { + msg ("Library variable '$_[1]' present\n"); output ("-D$_[1]=1"); } else { + msg ("Library variable '$_[1]' absent\n"); output ("-D$_[1]=0"); } } @@ -526,8 +520,10 @@ E.g.: $base libfunction01 printf HAVE_PRINTF ENDHELP if (test_libfunction (@_)) { + msg ("Library function '$_[1]' present\n"); output ("-D$_[1]=1"); } else { + msg ("Library function '$_[1]' absent\n"); output ("-D$_[1]=0"); } } @@ -557,6 +553,7 @@ sub cc_inc_flags() { for my $h (@headerdirs) { $ret .= " -I$h"; } + msg ("C compilation include flags: '$ret'\n"); return ($ret); } @@ -566,6 +563,7 @@ sub cc_libdir_flags() { for my $l (@libdirs) { $ret .= " -L$l" if (-d $l); } + msg ("C library directory flags: '$ret'\n"); return ($ret); } @@ -575,6 +573,7 @@ sub cc_lib_flags() { for my $l (@libs) { $ret .= " -l$l"; } + msg ("C library flags: '$ret'\n"); return ($ret); }