Changes of Revision 3
[-] [+] | Changed | crossroads.spec |
[-] [+] | Changed | crossroads-stable.ChangeLog ^ |
@@ -2,6 +2,40 @@ ChangeLog for Crossroads ------------------------------------------------------------------------------ +1.81 [KK 2008-06-26] + - Memory leaks debugging + +1.80 [KK 2008-05-19] + - "Read from <client/server> timed out" is now only an error when + it concerns the server. When it concerns the client, it's only a + verbose message. + - In http_copy(): Copy-thru mode from server to client is NOT + entered when the server sent a HTTP/1.x 3xx response. HTTP 300 + responses are not assumed to have a body. + +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 + under Linux. The signal handler for SIGCHLD must apparently be + off (see src/lib/sysrun.c). Also fixed for popen() calls (see + src/lib/choosebackend.c). + +1.77 [KK 2008-03-07] + - Next development version. Introduced %l for last-connect timing. + 1.76 [KK 2008-01-31] - Parser again made stricter: a backend's maxconnections is not allowed when the service's dispatch type is an external handler. | ||
[-] [+] | Changed | crossroads-stable.tar.gz/ChangeLog ^ |
@@ -2,6 +2,40 @@ ChangeLog for Crossroads ------------------------------------------------------------------------------ +1.81 [KK 2008-06-26] + - Memory leaks debugging + +1.80 [KK 2008-05-19] + - "Read from <client/server> timed out" is now only an error when + it concerns the server. When it concerns the client, it's only a + verbose message. + - In http_copy(): Copy-thru mode from server to client is NOT + entered when the server sent a HTTP/1.x 3xx response. HTTP 300 + responses are not assumed to have a body. + +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 + under Linux. The signal handler for SIGCHLD must apparently be + off (see src/lib/sysrun.c). Also fixed for popen() calls (see + src/lib/choosebackend.c). + +1.77 [KK 2008-03-07] + - Next development version. Introduced %l for last-connect timing. + 1.76 [KK 2008-01-31] - Parser again made stricter: a backend's maxconnections is not allowed when the service's dispatch type is an external handler. | ||
[-] [+] | Changed | crossroads-stable.tar.gz/Makefile ^ |
@@ -21,6 +21,9 @@ BASE=$(BASE) G=-g $(MAKE) -C src BASE=$(BASE) $(MAKE) -C test +local-alf: + BASE=$(BASE) G=-g ALF=-DALF $(MAKE) -C src + install: local BASE=$(BASE) $(MAKE) -C src install BASE=$(BASE) $(MAKE) -C doc install @@ -53,7 +56,7 @@ $(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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/Makefile ^ |
@@ -22,7 +22,6 @@ 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))' \ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/crossroads-mgr.1 ^ |
@@ -1,5 +1,5 @@ .SH "e-tunity" -.TH "crossroads-mgr" "1" "2005-2007" "crossroads" "" +.TH "crossroads-mgr" "1" "2005-2008" "crossroads" "" .SH "NAME" crossroads-mgr \- Web interface for Crossroads .PP @@ -26,9 +26,9 @@ 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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/crossroads.1 ^ |
@@ -1,5 +1,5 @@ .SH "e-tunity" -.TH "crossroads" "1" "2005-2007" "crossroads" "" +.TH "crossroads" "1" "2005-2008" "crossroads" "" .SH "NAME" crossroads \- Load balancer and fail over utility .PP @@ -71,7 +71,12 @@ .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 @@ \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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/crossroads.conf.7 ^ |
@@ -1,16 +1,27 @@ .SH "e-tunity" -.TH "crossroads\&.conf" "7" "2005-2007" "crossroads" "" +.TH "crossroads\&.conf" "7" "2005-2008" "crossroads" "" .SH "NAME" 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 @@ .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 @@ 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 @@ -946,11 +957,23 @@ back end, and so on\&. .IP .IP o +\f(CW%l\fP is the duration of the last successful connection +in seconds, concerning the current back end\&. \f(CW%1l\fP is the +duration of the connection to back end one, and so on\&. Note +that \f(CW%l\fP refers only to the last successful connections\&. +Unsuccessful connection attempts to back ends do not change +the value\&. +.IP +.IP o \f(CW%p\fP is the TCP port of the current back end\&. \f(CW%1p\fP is the TCP port of the first back end, \f(CW%2p\fP of the second back end, and so on\&. .IP .IP o +\f(CW%P\fP is the process ID of the Crossroads handler that +handled this request\&. For debugging only\&. +.IP +.IP o \f(CW%r\fP is the IP address of the connecting client\&. .IP .IP o @@ -1156,11 +1179,23 @@ back end, and so on\&. .IP .IP o +\f(CW%l\fP is the duration of the last successful connection +in seconds, concerning the current back end\&. \f(CW%1l\fP is the +duration of the connection to back end one, and so on\&. Note +that \f(CW%l\fP refers only to the last successful connections\&. +Unsuccessful connection attempts to back ends do not change +the value\&. +.IP +.IP o \f(CW%p\fP is the TCP port of the current back end\&. \f(CW%1p\fP is the TCP port of the first back end, \f(CW%2p\fP of the second back end, and so on\&. .IP .IP o +\f(CW%P\fP is the process ID of the Crossroads handler that +handled this request\&. For debugging only\&. +.IP +.IP o \f(CW%r\fP is the IP address of the connecting client\&. .IP .IP o @@ -1322,4 +1357,4 @@ .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)\&. | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/crossroads.html ^ |
@@ -1,16 +1,16 @@ <a name="../crossroads-defs"></a><a name="defs"></a><html><head> -<title>Crossroads 1.76</title> +<title>Crossroads 1.81</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.76</h1> +<h1>Crossroads 1.81</h1> <h2>Karel Kubat <br> Maintained by Karel Kubat (karel@kubat.nl)</h2> -<h2>e-tunity</h2><h2>2005-2007, ff.</h2> +<h2>e-tunity</h2><h2>2005-2008, ff.</h2> <blockquote><em>Crossroads is a load balance and fail over utility for TCP based services. It is a daemon program running in user @@ -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 @@ 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 @@ 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 @@ 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 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 @@ 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 @@ 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 @@ <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 @@ 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 @@ 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 @@ 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 @@ <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 @@ 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 @@ 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 @@ <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 @@ 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 @@ <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 @@ 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 @@ </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 @@ <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 @@ <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 @@ 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 @@ <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 @@ <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 @@ <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 @@ <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 @@ <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 @@ <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 @@ <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 @@ <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 @@ <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 @@ 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 @@ 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 @@ <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 @@ 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 @@ <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 @@ 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 @@ 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 @@ <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 @@ 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 @@ <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 @@ 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 @@ <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 @@ <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 @@ <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 @@ 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 @@ -1601,10 +1623,20 @@ is the host name of the first back end, <code>%2h</code> of the second back end, and so on. <p> +<li> <code>%l</code> is the duration of the last successful connection + in seconds, concerning the current back end. <code>%1l</code> is the + duration of the connection to back end one, and so on. Note + that <code>%l</code> refers only to the last successful connections. + Unsuccessful connection attempts to back ends do not change + the value. +<p> <li> <code>%p</code> is the TCP port of the current back end. <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of the second back end, and so on. <p> +<li> <code>%P</code> is the process ID of the Crossroads handler that + handled this request. For debugging only. +<p> <li> <code>%r</code> is the IP address of the connecting client. <p> <li> <code>%s</code> is the name of the current service that the client @@ -1636,7 +1668,7 @@ 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 @@ -1659,7 +1691,7 @@ <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 @@ -1675,7 +1707,7 @@ <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> @@ -1715,7 +1747,7 @@ <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 @@ -1788,10 +1820,20 @@ is the host name of the first back end, <code>%2h</code> of the second back end, and so on. <p> +<li> <code>%l</code> is the duration of the last successful connection + in seconds, concerning the current back end. <code>%1l</code> is the + duration of the connection to back end one, and so on. Note + that <code>%l</code> refers only to the last successful connections. + Unsuccessful connection attempts to back ends do not change + the value. +<p> <li> <code>%p</code> is the TCP port of the current back end. <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of the second back end, and so on. <p> +<li> <code>%P</code> is the process ID of the Crossroads handler that + handled this request. For debugging only. +<p> <li> <code>%r</code> is the IP address of the connecting client. <p> <li> <code>%s</code> is the name of the current service that the client @@ -1928,16 +1970,16 @@ <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 @@ -2066,13 +2108,13 @@ </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> @@ -2155,7 +2197,7 @@ 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 @@ -2181,7 +2223,7 @@ </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 @@ -2189,7 +2231,7 @@ 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 @@ -2239,7 +2281,7 @@ <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> @@ -2260,7 +2302,7 @@ 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 @@ -2314,7 +2356,7 @@ </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 @@ -2368,7 +2410,7 @@ 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> @@ -2392,7 +2434,7 @@ <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: @@ -2440,10 +2482,20 @@ is the host name of the first back end, <code>%2h</code> of the second back end, and so on. <p> +<li> <code>%l</code> is the duration of the last successful connection + in seconds, concerning the current back end. <code>%1l</code> is the + duration of the connection to back end one, and so on. Note + that <code>%l</code> refers only to the last successful connections. + Unsuccessful connection attempts to back ends do not change + the value. +<p> <li> <code>%p</code> is the TCP port of the current back end. <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of the second back end, and so on. <p> +<li> <code>%P</code> is the process ID of the Crossroads handler that + handled this request. For debugging only. +<p> <li> <code>%r</code> is the IP address of the connecting client. <p> <li> <code>%s</code> is the name of the current service that the client @@ -2464,7 +2516,7 @@ <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 @@ -2473,7 +2525,7 @@ <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 @@ -2510,7 +2562,7 @@ </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 @@ -2539,7 +2591,7 @@ 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 @@ -2564,7 +2616,7 @@ 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 @@ -2572,7 +2624,7 @@ 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 @@ -2604,7 +2656,7 @@ 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 @@ -2689,7 +2741,7 @@ <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, @@ -2719,7 +2771,7 @@ 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 @@ -2746,7 +2798,7 @@ </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> @@ -2778,7 +2830,7 @@ </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 @@ -2890,7 +2942,7 @@ 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 @@ -3008,9 +3060,9 @@ 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 @@ -3047,7 +3099,7 @@ 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 @@ -3079,7 +3131,7 @@ -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 @@ -3120,9 +3172,9 @@ 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 @@ -3146,14 +3198,14 @@ 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 @@ -3190,10 +3242,20 @@ is the host name of the first back end, <code>%2h</code> of the second back end, and so on. <p> +<li> <code>%l</code> is the duration of the last successful connection + in seconds, concerning the current back end. <code>%1l</code> is the + duration of the connection to back end one, and so on. Note + that <code>%l</code> refers only to the last successful connections. + Unsuccessful connection attempts to back ends do not change + the value. +<p> <li> <code>%p</code> is the TCP port of the current back end. <code>%1p</code> is the TCP port of the first back end, <code>%2p</code> of the second back end, and so on. <p> +<li> <code>%P</code> is the process ID of the Crossroads handler that + handled this request. For debugging only. +<p> <li> <code>%r</code> is the IP address of the connecting client. <p> <li> <code>%s</code> is the name of the current service that the client @@ -3219,16 +3281,16 @@ 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 @@ -3655,7 +3717,7 @@ </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 @@ -3691,7 +3753,7 @@ 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 @@ -3736,7 +3798,7 @@ <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 @@ -3787,7 +3849,7 @@ 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 @@ -3861,7 +3923,7 @@ </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 @@ -3932,7 +3994,7 @@ 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 @@ -3956,7 +4018,7 @@ 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 @@ -4041,13 +4103,13 @@ 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: @@ -4075,7 +4137,7 @@ </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 @@ -4098,7 +4160,7 @@ </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, @@ -4130,7 +4192,7 @@ 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 @@ -4144,7 +4206,7 @@ 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 @@ -4175,7 +4237,7 @@ </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 @@ -4254,9 +4316,9 @@ 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: @@ -4275,7 +4337,7 @@ 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> @@ -4339,11 +4401,25 @@ <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 @@ -4387,13 +4463,13 @@ <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 @@ -4447,7 +4523,7 @@ <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 @@ -4463,7 +4539,7 @@ 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: | ||
Changed | crossroads-stable.tar.gz/doc/crossroads.pdf ^ | |
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/compiling.yo ^ |
@@ -81,10 +81,24 @@ ) -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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/conf/allow.yo ^ |
@@ -6,7 +6,7 @@ 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 @@ 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). | ||
[-] [+] | Changed | crossroads-stable.tar.gz/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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/formattable.yo ^ |
@@ -23,10 +23,20 @@ it() tt(%h) is the host name of the current back end. tt(%1h) is the host name of the first back end, tt(%2h) of the second back end, and so on. + + it() tt(%l) is the duration of the last successful connection + in seconds, concerning the current back end. tt(%1l) is the + duration of the connection to back end one, and so on. Note + that tt(%l) refers only to the last successful connections. + Unsuccessful connection attempts to back ends do not change + the value. it() tt(%p) is the TCP port of the current back end. tt(%1p) is the TCP port of the first back end, tt(%2p) of the second back end, and so on. + + it() tt(%P) is the process ID of the Crossroads handler that + handled this request. For debugging only. it() tt(%r) is the IP address of the connecting client. | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/impatient.yo ^ |
@@ -37,8 +37,10 @@ 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 { | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/intro.yo ^ |
@@ -58,8 +58,7 @@ 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 @@ 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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/tips/examples.yo ^ |
@@ -127,10 +127,10 @@ 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: | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/tips/externalhandler.yo ^ |
@@ -23,7 +23,7 @@ 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. | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/main/tips/ipfiltering.yo ^ |
@@ -97,9 +97,9 @@ 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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/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 @@ 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. | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/man/crossroads-mgr.yo ^ |
@@ -21,9 +21,9 @@ 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). | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/man/crossroads.conf.yo ^ |
@@ -4,9 +4,14 @@ 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 @@ manpageauthor() Crossroads is written by AUTHORNAME() and is maintained by - MAINTAINERNAME() (MAINTAINEREMAIL()). \ No newline at end of file + MAINTAINERNAME() (MAINTAINEREMAIL()). | ||
[-] [+] | Changed | crossroads-stable.tar.gz/doc/man/crossroads.yo ^ |
@@ -55,7 +55,12 @@ 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 @@ it() bf(-?): Shows an overview of the usage.) manpagefiles() - bf(DEFAULTCONF()), the default configuration file + bf(crossroads.conf), the default configuration file manpageseealso() itemization( | ||
[-] [+] | Changed | crossroads-stable.tar.gz/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 \ - ucb nsl pthread socket m 2>/dev/null) +LIBS := $(shell $(BASE)/tools/c-conf -vc $(BASE)/src/c-conf.cache lib \ + ucb nsl pthread socket m alf 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 @@ -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) | ||
[-] [+] | Changed | crossroads-stable.tar.gz/etc/Makefile.def ^ |
@@ -6,10 +6,10 @@ # Versioning. This defines the overall version ID and must match the topmost # entry in the ChangeLog. -VER = 1.76 +VER = 1.81 # Years that Crossroads has been 'round. -YEARS = 2005-2007 +YEARS = 2005-2008 # Author and maintainer AUTHORNAME = Karel Kubat @@ -19,9 +19,6 @@ # 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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/etc/Makefile.help ^ |
@@ -10,6 +10,8 @@ make local Local program construction and unit tests make local-g Like 'make local' but wigh 'gdb' symbols make local-pg Like 'make local-g' but with 'gprof' profiling + make local-alf Like 'make local' but with allocation leak finder + (requires 'alf', for debugging only) make documentation Creates documentation under doc/. Requires Yodl and pdflatex. @@ -30,4 +32,6 @@ /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>'.) + ============================================================================ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/etc/svnrev.txt ^ |
@@ -1 +1 @@ -225 +233 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/Makefile ^ |
@@ -5,37 +5,38 @@ 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) ALF=$(ALF) \ + $(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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/crossroads-daemon/Makefile ^ |
@@ -2,7 +2,8 @@ include $(BASE)/etc/Makefile.conf BIN = crossroads-daemon -all: $(BIN) +all: + BASE=$(BASE) $(MAKE) $(BIN) dbginstall: all $(BINDIR)/$(BIN) @@ -23,6 +24,5 @@ $(CC) $(PG) -o $(BIN) main.o -L$(BASE)/src/lib -lcrossroads \ $(LIBS) $(EXTRALIBS) - # Extra deps: -main.o: main.c $(BASE)/src/crossroads.h $(BASE)/etc/Makefile.def \ No newline at end of file +main.o: main.c $(BASE)/src/crossroads.h $(BASE)/etc/Makefile.def | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/crossroads-daemon/main.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/crossroads.h ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,6 +34,7 @@ #include <netinet/in.h> #include <sys/file.h> #include <sys/ipc.h> +#include <sys/resource.h> #include <sys/sem.h> #include <sys/shm.h> #include <sys/stat.h> @@ -42,6 +43,11 @@ #include <sys/times.h> #include <sys/types.h> +/* Allocation leak finding (requires 'alf' package) */ +#ifdef ALF +#include <alf.h> +#endif + /* flock() macros, incase they aren't present on your system. */ #ifndef LOCK_SH #define LOCK_SH 1 @@ -259,6 +265,7 @@ unsigned laststamp; /* .. last usage */ int actual_port; /* .. currently used port */ char actual_server[FQDN_LENGTH]; /* .. currently used server */ + double last_con_sec; /* .. last connect duration */ } Backendstate; typedef struct { /* Service reporting (shmem) */ @@ -338,6 +345,7 @@ 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 */ @@ -386,6 +394,7 @@ 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, @@ -421,6 +430,7 @@ extern int ipf_parse (char const *val, IpFilter *res); extern int is_hex_digit (char ch); extern int is_space (char ch); +extern void limits_msg (void); extern void lock_reporter (void); extern void log_activity_any (char const *action); extern void log_activity_start (void); @@ -453,7 +463,7 @@ extern void runservice (void); extern void set_program_title (char const *fmt, ...) __attribute__ ((format (printf, 1, 2))); -extern void show_config (void); +extern void show_config (void); extern char *stage_to_string (Programstage stage); extern char *state_to_string (Backendavail avail); extern Backendavail string_to_state (char const *str); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/crossroads/Makefile ^ |
@@ -2,7 +2,8 @@ include $(BASE)/etc/Makefile.conf BIN = crossroads -all: $(BIN) +all: + BASE=$(BASE) $(MAKE) $(BIN) dbginstall: all $(BINDIR)/$(BIN) | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/crossroads/main.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 o; unsigned i; int dumpconf = 0; + char *cp; static Handler handler[] = { /* Argument Nr.args Needconf Handler function */ /* -1=no check */ @@ -29,9 +30,33 @@ { "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 @@ /* 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(); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/Makefile ^ |
@@ -6,9 +6,9 @@ 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 @@ -41,7 +41,7 @@ $(CC) $(DEFS) $(PG) -c -g $< %.o: %.c - $(CC) $(DEFS) $(PG) -c -g -W -Wall $< + $(CC) $(DEFS) $(PG) $(ALF) -c -g -W -Wall $< distclean: clean clean: | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/allocreporter.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ansistamp.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/backendavailable.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ (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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/backendconnect.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,56 +16,52 @@ int sock; struct sockaddr_in servername; int val = 1; + struct timeval con_start, con_end; /* 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); } } -#ifdef SO_NOSIGPIPE +#ifdef SO_NOSIGPIPE /* 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); } #endif - + /* Assign to back end server address. */ if (init_sockaddr ( &servername, servicereport->backendstate[current_backend].actual_server, servicereport->backendstate[current_backend].actual_port)) { /* The hostname is unusable.. */ - warning ("Service %s: unknown host %s", - activeservice->name, + 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); } @@ -74,8 +70,9 @@ signal (SIGALRM, alarmhandler); timed_out = 0; alarm (CONNECT_TIMEOUT); - - /* Try connecting */ + + /* Try connecting. Remember the time we try this. */ + gettimeofday (&con_start, 0); if (connect (sock, (struct sockaddr *) &servername, sizeof(servername)) < 0) { /* This backend is unusable. @@ -89,17 +86,15 @@ 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)); + strerror(errno)); } mark_activity (0, 0, st_unavailable); return (-3); @@ -107,8 +102,13 @@ alarm(0); signal (SIGALRM, SIG_DFL); - /* Log the last connect time. */ + /* Log the last connect time. Store the duration of this connect. */ + gettimeofday (&con_end, 0); + servicereport->backendstate[current_backend].last_con_sec = + ( ((double)con_end.tv_sec * 1000000 + con_end.tv_usec) - + ((double)con_start.tv_sec * 1000000 + con_start.tv_usec) ) + / 1000000; servicereport->backendstate[current_backend].laststamp = time(0); - + return (sock); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/backendcount.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/checkservice.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/choosebackend.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ /* 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 @@ * 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 @@ (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 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ /* 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ 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,48 +336,48 @@ /* 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; } uid_restore(); + signal (SIGCHLD, SIG_IGN); free (backends); free (exthandler); return; } 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); uid_restore(); + signal (SIGCHLD, SIG_IGN); free (backends); free (exthandler); return; } } } - 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; @@ -413,7 +387,7 @@ 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); } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/cmdconfigtest.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/cmdrestart.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,7 @@ if (!cmd_stop (ac, av)) error ("Daemon stop failed, restart failure"); - sleep (1); + sleep (2); /* Now run 'start' */ if (!cmd_start (ac, av)) | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/cmdservices.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/cmdstart.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/cmdstatus.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/cmdstop.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/cmdtell.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/configmsg.c ^ |
@@ -1,16 +1,16 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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) | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/configread.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/configwrite.c ^ |
@@ -1,11 +1,14 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,33 @@ 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 +52,102 @@ 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"); } } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/copysockets.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/data.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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" }, | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/deallocreporter.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/decrclientcount.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/dns.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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 @@ } 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); } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/error.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); | ||
[-] [+] | Added | crossroads-stable.tar.gz/src/lib/expandprogamname.c ^ |
@@ -0,0 +1,30 @@ +/************************************************************************* + * This file is part of Crosroads 1.81, 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); +} | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/gmtstamp.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/hashpjw.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpcopy.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); @@ -22,8 +20,8 @@ * This is the remaining count, or if the buffer is too small * for that, the buffer size. */ to_copy = tot - ncopied; - if (to_copy > opt.tcp_bufsz) - to_copy = opt.tcp_bufsz; + if (to_copy > (int)opt.tcp_bufsz) + to_copy = (int)opt.tcp_bufsz; buf = net_bufread (src, to_copy, &bytes, dir == dir_client_to_server); net_write (dst, buf, bytes, dir == dir_client_to_server); @@ -53,8 +51,7 @@ 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 @@ 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,55 +81,42 @@ 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"); /* Check in what 'mode' we are. - * We know 3 modes: + * We know the following modes: * - Transfer-Encoding is chunked: we copy chunks * - Content-Length is supplied: we copy that # of bytes - * - None of the above: we don't know, go to copy-thru mode + * - None of the above: simply return, the caller http_serve() + * will enter copy-thru mode */ - + if ( (mode = http_header_val (h, "transfer-encoding")) && *mode ) { + /* *** CHUNKED TRANSFER ENCODING *** */ 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. */ if (!nbytes) break; } - } else if ( (mode = http_header_val (h, "content-length")) && - mode ) { + } else if ( (mode = http_header_val (h, "content-length")) && *mode ) { + /* *** CONTENT-LENGTH PRESENT *** */ 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); - if ( (cp = net_buffer (dir_server_to_client, &nbytes)) ) { - msg ("Service %s: Flushing server-side buffer to client, %u bytes", - activeservice->name, nbytes); - net_write (dst, cp, nbytes, 0); - } - copysockets (src, dst); - } else { - msg ("Service %s: Not copying body (nothing to do)", - activeservice->name); } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httperror.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderaddheader.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderappendheader.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderconnectiontype.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderfree.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderhascookie.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderhttpver.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ /* 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheadernew.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderread.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 */ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderremoveheader.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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; } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheadersetheader.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderval.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpheaderwrite.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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])); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpinsertheader.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httplogactivity.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ "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; | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpserve.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ * 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 @@ * 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 @@ * 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 @@ /* 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 @@ /* 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 @@ /* 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpserversocket.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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 @@ 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; | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/httpwrite.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/incrclientcount.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/initsockaddr.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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)) ) | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/interrupt.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,15 +24,15 @@ break; default: + /* In any case, stop the listening socket. */ interrupted++; + shutdown (listen_sock, SHUT_RDWR); + close (listen_sock); switch (program_stage) { case stage_waiting: - warning ("Service %s: listener caught signal %d, " - "closing socket %d and exiting", - activeservice->name, sig, listen_sock); - shutdown (listen_sock, SHUT_RDWR); - close (listen_sock); + warning ("listener caught signal %d, closing socket %d and exiting", + sig, listen_sock); exit (0); break; @@ -41,9 +41,8 @@ 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: | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ipfaddallow.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ipfadddeny.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ipfallowed.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ /* 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ipfdenied.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ /* 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ipfloadfile.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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 @@ } } - 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ipfmatch.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ipfparse.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/ishexdigit.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/isspace.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/lexer.c ^ |
@@ -1,37 +1,98 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #line 2 "lexer.c" -/* A lexical scanner generated by flex */ -/* Scanner skeleton version: - * $Header: /cvs/root/flex/flex/skel.c,v 1.2 2004/05/07 00:28:17 jkh Exp $ - */ +#line 4 "lexer.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 33 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ +/* begin standard C headers. */ #include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ -#ifdef __cplusplus +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif -#include <stdlib.h> -#include <unistd.h> +#endif /* ! FLEXINT_H */ -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS +#ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -40,34 +101,17 @@ #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -82,71 +126,75 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif extern int yyleng; + extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ -typedef unsigned int yy_size_t; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -183,12 +231,16 @@ */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -202,28 +254,38 @@ * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ -static YY_BUFFER_STATE yy_current_buffer = 0; +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches @@ -231,66 +293,90 @@ */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + extern char *yytext; #define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 98 #define YY_END_OF_BUFFER 99 -static yyconst short int yy_accept[616] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[616] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 95, 96, 96, 99, 73, 71, 72, @@ -362,7 +448,7 @@ 25, 11, 59, 62, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -394,7 +480,7 @@ 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[40] = +static yyconst flex_int32_t yy_meta[40] = { 0, 1, 1, 2, 1, 1, 3, 1, 1, 1, 3, 3, 4, 1, 4, 3, 4, 4, 4, 4, 4, @@ -402,7 +488,7 @@ 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst short int yy_base[630] = +static yyconst flex_int16_t yy_base[630] = { 0, 0, 726, 38, 42, 45, 58, 46, 53, 73, 86, 99, 131, 65, 113, 729, 728, 730, 734, 52, 734, @@ -475,7 +561,7 @@ 259, 263, 80, 267, 271, 273, 48, 277, 281 } ; -static yyconst short int yy_def[630] = +static yyconst flex_int16_t yy_def[630] = { 0, 615, 1, 616, 616, 617, 617, 618, 618, 619, 619, 620, 620, 621, 621, 622, 622, 615, 615, 615, 615, @@ -548,7 +634,7 @@ 615, 615, 615, 615, 615, 615, 615, 615, 615 } ; -static yyconst short int yy_nxt[774] = +static yyconst flex_int16_t yy_nxt[774] = { 0, 18, 19, 20, 18, 19, 18, 18, 18, 18, 18, 21, 22, 18, 23, 18, 24, 25, 26, 27, 28, @@ -637,7 +723,7 @@ 615, 615, 615 } ; -static yyconst short int yy_chk[774] = +static yyconst flex_int16_t yy_chk[774] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -729,6 +815,9 @@ static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int yy_flex_debug; +int yy_flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -738,7 +827,6 @@ #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "lexer.l" -#define INITIAL 0 #line 2 "lexer.l" #include "../crossroads.h" #include "parser.h" @@ -760,6 +848,10 @@ vprintf (fmt, args); } } + +#line 848 "lexer.c" + +#define INITIAL 0 #define stringstate 1 #define instr 2 #define commentstate 3 @@ -768,7 +860,19 @@ #define defineredef 6 #define definesym 7 -#line 767 "lexer.c" +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -776,65 +880,30 @@ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int yywrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int yywrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - + static void yyunput (int c,char *buf_ptr ); + #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif +#ifdef __cplusplus +static int yyinput (void ); #else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 +static int input (void ); #endif -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -843,7 +912,6 @@ #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -856,9 +924,10 @@ */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -868,9 +937,22 @@ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -891,12 +973,18 @@ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. @@ -912,31 +1000,33 @@ #define YY_RULE_SETUP \ if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + #line 27 "lexer.l" -#line 924 "lexer.c" +#line 1014 "lexer.c" - if ( yy_init ) + if ( !(yy_init) ) { - yy_init = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; @@ -944,26 +1034,28 @@ if ( ! yyout ) yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); /* Support of yytext. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: do @@ -971,8 +1063,8 @@ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -989,24 +1081,22 @@ yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: @@ -1026,6 +1116,7 @@ } YY_BREAK case 3: +/* rule 3 can match eol */ YY_RULE_SETUP #line 40 "lexer.l" { @@ -1647,6 +1738,7 @@ } YY_BREAK case 72: +/* rule 72 can match eol */ YY_RULE_SETUP #line 454 "lexer.l" { @@ -1681,6 +1773,7 @@ } YY_BREAK case 76: +/* rule 76 can match eol */ YY_RULE_SETUP #line 474 "lexer.l" { @@ -1693,6 +1786,7 @@ ; YY_BREAK case 78: +/* rule 78 can match eol */ YY_RULE_SETUP #line 479 "lexer.l" { @@ -1720,6 +1814,7 @@ } YY_BREAK case 81: +/* rule 81 can match eol */ YY_RULE_SETUP #line 496 "lexer.l" { @@ -1729,6 +1824,7 @@ } YY_BREAK case 82: +/* rule 82 can match eol */ YY_RULE_SETUP #line 501 "lexer.l" { @@ -1770,6 +1866,7 @@ } YY_BREAK case 86: +/* rule 86 can match eol */ YY_RULE_SETUP #line 526 "lexer.l" { @@ -1802,6 +1899,7 @@ ; YY_BREAK case 89: +/* rule 89 can match eol */ YY_RULE_SETUP #line 544 "lexer.l" { @@ -1837,6 +1935,7 @@ } YY_BREAK case 93: +/* rule 93 can match eol */ YY_RULE_SETUP #line 559 "lexer.l" { @@ -1865,6 +1964,7 @@ } YY_BREAK case 97: +/* rule 97 can match eol */ YY_RULE_SETUP #line 572 "lexer.l" { @@ -1878,7 +1978,7 @@ #line 577 "lexer.l" ECHO; YY_BREAK -#line 1877 "lexer.c" +#line 1977 "lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(stringstate): case YY_STATE_EOF(instr): @@ -1888,26 +1988,26 @@ case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -1917,13 +2017,13 @@ * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -1936,30 +2036,30 @@ yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1970,7 +2070,7 @@ * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -1978,30 +2078,30 @@ else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -2012,8 +2112,7 @@ "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2022,21 +2121,20 @@ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -2056,34 +2154,30 @@ /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -2096,8 +2190,7 @@ b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -2107,35 +2200,35 @@ YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -2143,33 +2236,32 @@ else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; - } - +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; - - yy_current_state = yy_start; + + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -2181,30 +2273,23 @@ } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -2216,80 +2301,73 @@ yy_is_jam = (yy_current_state == 615); return yy_is_jam ? 0 : yy_current_state; - } - +} -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { - int c; - *yy_c_buf_p = yy_hold_char; +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -2303,16 +2381,16 @@ */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) - return EOF; + if ( yywrap( ) ) + return 0; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -2322,91 +2400,94 @@ } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); - yy_current_buffer->yy_at_bol = (c == '\n'); + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +} +#endif /* ifndef YY_NO_INPUT */ - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); } + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + (yy_did_buffer_switch_on_eof) = 1; +} +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -2415,80 +2496,75 @@ /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b,file ); return b; - } - +} -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif + yyfree((void *) b->yy_ch_buf ); -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif + yyfree((void *) b ); +} +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -2505,29 +2581,121 @@ b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } +} +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); @@ -2541,56 +2709,51 @@ b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b ); return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif +} +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -2600,148 +2763,196 @@ b->yy_is_our_buffer = 1; return b; - } +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 #endif +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); +/* Accessor methods (get/set functions) to struct members. */ - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} - yy_start_stack[yy_start_stack_ptr++] = YY_START; +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} - BEGIN(new_state); - } -#endif +/** Get the current token. + * + */ +char *yyget_text (void) +{ + return yytext; +} -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +int yyget_debug (void) +{ + return yy_flex_debug; +} -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; #else -static void yy_fatal_error( msg ) -char msg[]; + yyin = (FILE *) 0; + yyout = (FILE *) 0; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } -/* Redefine yyless() so it works in section 3 code. */ + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + return 0; +} -/* Internal utility routines. */ +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *yyalloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *yyrealloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2750,23 +2961,13 @@ * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif #line 577 "lexer.l" | ||
[-] [+] | Added | crossroads-stable.tar.gz/src/lib/limitsmsg.c ^ |
@@ -0,0 +1,47 @@ +/************************************************************************* + * This file is part of Crosroads 1.81, 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" + +typedef struct { + int type; + char *desc; +} Rlimits; + +static Rlimits rlimits[] = { + { RLIMIT_CORE, "core file size" }, + { 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" }, +}; + +void limits_msg () { + struct rlimit lim; + unsigned i; + + if (!activeservice->verbosity) + return; + + msg ("*** Overview of run limits ***"); + for (i = 0; i < sizeof(rlimits) / sizeof(Rlimits); i++) { + if (getrlimit (rlimits[i].type, &lim)) + 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); + } +} | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/lockreporter.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/logactivityany.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/logactivitycontinuation.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/logactivityend.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/logactivitystart.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/makesocket.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ /* 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 @@ /* 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/markactivity.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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 @@ /* 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 @@ /* 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/msg.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,19 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/msgdumpbuf.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/netallocbufs.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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"); } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/netbuffer.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/netbufread.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ /* 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; } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/netcopy.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ * 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/netread.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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,10 @@ 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); + if (is_client) + msg ("read from %s timed out", desc); + else + error ("read from %s timed out", desc); } /* Check for exceptions. */ @@ -61,7 +62,7 @@ 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 +77,13 @@ * 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); } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/netwrite.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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 @@ /* 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 (); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/optionsread.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/optionswrite.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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)); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parser.c ^ |
@@ -1,81 +1,216 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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. */ + +/* 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 -/* 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 +/* Copy the first part of user declarations. */ #line 4 "parser.y" /* Prologue */ @@ -205,685 +340,1347 @@ 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 -}; -#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 -}; +/* Copy the second part of user declarations. */ -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 -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +#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 -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 -}; +/* 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 -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 -}; +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ -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 +# 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)) + +#endif + +/* 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 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 +#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 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 +/* 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 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 +/* 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 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 +#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 +# 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 -#define YYLAST 254 +/* 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 +}; -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. */ +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 +}; -/* 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 - -/* 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)) + +/* 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 indicates the initial size of the parser's stacks */ +/* 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 { - register char *f = from; - register char *t = to; - register int i = count; + 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 +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; - while (i-- > 0) - *t++ = *f++; + 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: ; + } -#else /* __cplusplus */ + if (! yyres) + return yystrlen (yystr); -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) + 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) { - register char *t = to; - register char *f = from; - register int i = count; + 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; - while (i-- > 0) - *t++ = *f++; + 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 */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*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 +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; #endif -#endif - -#line 217 "/usr/share/bison.simple" +{ + YYUSE (yyvaluep); -/* 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. */ + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); -#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 */ + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ -/* 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 */ +/* The look-ahead symbol. */ +int yychar; - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; +/* Number of syntax errors so far. */ +int yynerrs; -#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. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* 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; - int yylen; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + +#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 @@ 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]); - /* 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 + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + 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 @@ 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 @@ 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. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ -#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. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; -yyerrdefault: /* current state does not do anything special for the error token. */ -#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 +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* 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; + + /* 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); -#endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif +/*-------------------------------------. +| 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 + +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) + { + 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" + + + | ||
[-] [+] | Changed | crossroads-stable.tar.gz/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; + | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parserclose.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parserfilename.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parserinput.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parseropen.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parserrun.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parserskipchar.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/parserskipline.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/runservice.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,17 +24,15 @@ /* 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; } /*** Child branch ***/ - + /* We've forked for the first time */ daemonized++; program_stage = stage_waiting; @@ -42,11 +40,24 @@ /* Promote verbosity. */ flag_verbose = activeservice->verbosity; - /* Provide configuration feedback */ - config_msg(); + /* ALF support: open the status file fd */ + #ifdef ALF + { + char file[80]; + snprintf (file, 80, "/tmp/xr-%d.alf", getpid()); + close (alf_fd); + alf_fd = open (file, O_WRONLY | O_CREAT); + msg ("Service listener: alf logging to '%s', fd %d", file, alf_fd); + } + #endif + + /* Provide configuration/limits feedback */ + if (flag_verbose) { + 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); @@ -56,12 +67,9 @@ 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 @@ -72,7 +80,7 @@ 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; } @@ -82,12 +90,10 @@ 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 @@ -97,8 +103,7 @@ 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) { @@ -116,12 +121,10 @@ /* 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)); } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/setproctitle.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/setprogramtitle.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/showconfig.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ "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 @@ , 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, | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/stagetostring.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/statetostring.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/strcasestr.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 *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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/strexpandformat.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,10 @@ * %g - GMT format timestamp. The time in between is the minutes * offset into the future, so %30g is now + 1/2 hour * %h - actual serveraddress of current back end, %h1 = first etc. + * %l - last connect time of current back end, %l1 = first etc. * %n - nr of clients of current back end, %1n = first back end etc. * %p - actual port of current back end, %1p = first etc. + * %P - process ID of the Crossroads handler (debugging) * %r - client IP, number is not interpreted * %s - name of service, number is not interpreted * %t, %T - ANSI timestamp of local or GMT time, number is offset in min @@ -30,8 +32,8 @@ (*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) { @@ -71,6 +73,18 @@ return ("noname"); return (servicereport->backendstate[fmt_number].actual_server); + case 'l': + if (!fmt_number) + fmt_number = current_backend; + else + fmt_number--; + if (fmt_number >= 0 && fmt_number < activeservice->nbackend) { + snprintf (buf, sizeof(buf) - 1, "%f", + servicereport->backendstate[fmt_number].last_con_sec); + return (buf); + } + return ("0"); + case 'n': if (!fmt_number) fmt_number = current_backend; @@ -94,6 +108,10 @@ snprintf (buf, sizeof(buf), "%d", servicereport->backendstate[fmt_number].actual_port); return (buf); + + case 'P': + snprintf (buf, sizeof(buf), "%u", getpid()); + return (buf); case 'r': if (client_ip && *client_ip) @@ -166,8 +184,8 @@ } /* - msg ("Service %s: String [%s] expanded to [%s]", - activeservice->name, h, ret); + msg ("String [%s] expanded to [%s]", + h, ret); */ return (ret); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/stringtostate.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/strlcat.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/strnstr.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/strprintf.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/strupr.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/strvprintf.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/symtabend.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/symtablookup.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/symtabset.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/symtabstart.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/sysrun.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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,28 +19,29 @@ 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. */ + signal (SIGCHLD, SIG_DFL); uid_assume(); ret = system (expanded); + + /* Get our own UID back and ignore child sigs. */ uid_restore(); + 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/tcpserve.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 @@ 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 @@ } /* 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 @@ &(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 @@ 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 @@ 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 @@ */ 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 @@ 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 @@ /* 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 @@ * 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; } @@ -179,6 +170,19 @@ /* Here's the child process as dispatcher. The backend has yet * to be defined. * NOTE NOTE NOTE No continue's below this point - EXIT! */ + + /* ALF support */ + #ifdef ALF + { + char file[80]; + + snprintf (file, 80, "/tmp/xd-%d.alf", getpid()); + close (alf_fd); + alf_fd = open (file, O_WRONLY); + msg ("Service handler: alf logging to '%s', fd %d", file, alf_fd); + } + #endif + current_backend = -1; /* Incase of a http type service: handle separately. */ @@ -189,25 +193,21 @@ /* 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); | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/thruputlog.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/timeofday.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/trafficlog.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/uidassume.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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++; } } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/uidrestore.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/unlockreporter.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/usage.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/usage.txt ^ |
@@ -6,7 +6,7 @@ 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 @@ -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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/vsyslog.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/wakeuphandler.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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 | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/warning.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, 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 @@ 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); } | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/writelog.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/xcalloc.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/xmalloc.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/xrealloc.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/xstrcat.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/xstrcatch.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/src/lib/xstrdup.c ^ |
@@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.76, a load balancer and fail over + * This file is part of Crosroads 1.81, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ | ||
[-] [+] | Changed | crossroads-stable.tar.gz/tools/c-conf ^ |
@@ -4,7 +4,9 @@ use Getopt::Std; # Globals -my $VER = "1.11"; +my $VER = "1.13"; +# 1.13 [KK 2008-07-15] Opimized subfiles() - way faster when nonrecursive now +# 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 +145,19 @@ 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. @@ -165,48 +165,36 @@ sub subfiles ($$$) { my ($dir, $mask, $recursive) = @_; - %_dir_visited = () unless ($recursive); + %_dir_visited = (); 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) { - if (-f $f) { - push (@ret, $f); - $added++; + + if ($recursive) { + foreach my $d (glob ("$dir/*")) { + next unless (-d $d); + my @subret = subfiles ("$d", $mask, 1); + my $added = 0; + foreach my $f (@subret) { + if (-f $f) { + push (@ret, $f); + $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 +228,10 @@ 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 +253,6 @@ 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 +276,11 @@ 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 +303,11 @@ 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 +331,11 @@ 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 +361,14 @@ 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 +386,14 @@ 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 +418,7 @@ if ($@) { warn ($@); } else { + msg ("C compiler: '$cc'\n"); output ($cc); } } @@ -445,6 +434,7 @@ usage() if ($#_ > -1); foreach my $c (@cpp_compilers) { if (findbin ($c)) { + msg ("C++ compiler: '$c'\n"); output ($c); return; } @@ -475,8 +465,10 @@ } 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 +484,13 @@ $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 +503,10 @@ 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 +525,10 @@ 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 +558,7 @@ for my $h (@headerdirs) { $ret .= " -I$h"; } + msg ("C compilation include flags: '$ret'\n"); return ($ret); } @@ -566,6 +568,7 @@ for my $l (@libdirs) { $ret .= " -L$l" if (-d $l); } + msg ("C library directory flags: '$ret'\n"); return ($ret); } @@ -575,6 +578,7 @@ for my $l (@libs) { $ret .= " -l$l"; } + msg ("C library flags: '$ret'\n"); return ($ret); } |