]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
10 years agoDOC: add 51Degrees notes to configuration.txt.
Thomas Holmes [Mon, 18 May 2015 12:21:39 +0000 (13:21 +0100)] 
DOC: add 51Degrees notes to configuration.txt.

10 years agoMEDIUM: sample: add trie support to 51Degrees
Thomas Holmes [Fri, 29 May 2015 11:54:25 +0000 (12:54 +0100)] 
MEDIUM: sample: add trie support to 51Degrees

Trie or pattern algorithm is used depending on what 51Degrees source
files are provided to MAKE.

10 years agoMEDIUM: deinit: add cleanup for 51Degrees to deinit
Thomas Holmes [Thu, 14 May 2015 16:14:30 +0000 (17:14 +0100)] 
MEDIUM: deinit: add cleanup for 51Degrees to deinit

10 years agoMEDIUM: sample: add fiftyone_degrees converter.
Thomas Holmes [Wed, 13 May 2015 10:27:35 +0000 (11:27 +0100)] 
MEDIUM: sample: add fiftyone_degrees converter.

It takes up to 5 string arguments that are to be 51Degrees property names.
It will then create a chunk with values detected based on the request header
supplied (this should be the User-Agent).

10 years agoMINOR: init: add 51Degrees initialisation code
Thomas Holmes [Tue, 12 May 2015 15:23:58 +0000 (16:23 +0100)] 
MINOR: init: add 51Degrees initialisation code

This creates a dataset using the file given in global._51d_data_file_path.

10 years agoMINOR: config: add 51Degrees config parsing.
Thomas Holmes [Tue, 12 May 2015 14:50:47 +0000 (15:50 +0100)] 
MINOR: config: add 51Degrees config parsing.

10 years agoMINOR: global: add several 51Degrees members to global
Thomas Holmes [Tue, 12 May 2015 14:47:24 +0000 (15:47 +0100)] 
MINOR: global: add several 51Degrees members to global

These are :
  fiftyoneDegreesDataSet _51d_data_set
  char *_51d_data_file_path
  char _51d_property_seperator
  struct list _51d_property_names

10 years agoBUILD: add 51degrees options to makefile.
Thomas Holmes [Tue, 12 May 2015 14:06:21 +0000 (15:06 +0100)] 
BUILD: add 51degrees options to makefile.

To build with 51Degrees set USE_51DEGREES=1. 51DEGREES_INC, 51DEGREES_LIB,
and 51DEGREES_SRC will need to be set to the 51Degrees pattern header and
C file.

10 years agoCLEANUP: da: remove ifdef USE_DEVICEATLAS from da.c
Willy Tarreau [Tue, 2 Jun 2015 11:25:39 +0000 (13:25 +0200)] 
CLEANUP: da: remove ifdef USE_DEVICEATLAS from da.c

This file is only built when the macro is defined, there's no point
having it ifdefed here.

10 years agoCLEANUP: adjust the envelope name in da.h to reflect the file name
Willy Tarreau [Mon, 1 Jun 2015 13:52:54 +0000 (15:52 +0200)] 
CLEANUP: adjust the envelope name in da.h to reflect the file name

Since the file is import/da.h, the define should be _IMPORT_DA_H,
nor MOBI_DA_DAC_HAPROXY_H.

10 years agoCLEANUP: da: register the config keywords in da.c
Willy Tarreau [Mon, 1 Jun 2015 13:42:29 +0000 (15:42 +0200)] 
CLEANUP: da: register the config keywords in da.c

No need to export the registration to haproxy.c, it can be done
locally.

10 years agoCLEANUP: da: move the converter registration to da.c
Willy Tarreau [Mon, 1 Jun 2015 13:39:50 +0000 (15:39 +0200)] 
CLEANUP: da: move the converter registration to da.c

There's no reason to put it into sample.c, it's better to register it
locally in da.c, it removes a number of ifdefs and exports.

10 years agoCLEANUP: global: remove one ifdef USE_DEVICEATLAS
Willy Tarreau [Mon, 1 Jun 2015 13:38:33 +0000 (15:38 +0200)] 
CLEANUP: global: remove one ifdef USE_DEVICEATLAS

The include file already has the ifdef, let's remove it from the global
file.

10 years agoBUG/MINOR: da: fix log-level comparison to emove annoying warning
Willy Tarreau [Mon, 1 Jun 2015 13:25:46 +0000 (15:25 +0200)] 
BUG/MINOR: da: fix log-level comparison to emove annoying warning

When haproxy is run on the foreground with DeviceAtlas enabled, one
line of warning is seen for every test because the comparison is always
true even when loglevel is zero :

willy@wtap:haproxy$ ./haproxy  -db -f test-da.cfg
[WARNING] 151/150831 (25506) : deviceatlas : final memory image 7148029 bytes.
Deviceatlas module loaded.
[WARNING] 151/150832 (25506) : deviceatlas : .
[WARNING] 151/150833 (25506) : deviceatlas : .
[WARNING] 151/150833 (25506) : deviceatlas : .
^C

Don't emit a warning when loglevel is null.

10 years agoDOC: README: explain how to build with DeviceAtlas
David Carlier [Mon, 1 Jun 2015 12:21:47 +0000 (14:21 +0200)] 
DOC: README: explain how to build with DeviceAtlas

This diff is related to the additional documentation in
order to build the DeviceAtlas module and in addition with
an example of a basic configuration.

10 years agoBUILD: Makefile: add options to build with DeviceAtlas
David Carlier [Mon, 1 Jun 2015 12:00:07 +0000 (14:00 +0200)] 
BUILD: Makefile: add options to build with DeviceAtlas

This diff updates the Makefile to compile conditionally via
some new sets of flags, USE_DEVICEATLAS to enable the module
and the couple DEVICEATLAS_INC/DEVICEATLAS_LIB which needs to
point to the API root folder in order to compile the API and
the module.

10 years agoMEDIUM: init: DeviceAtlas initialization
David Carlier [Mon, 1 Jun 2015 11:57:22 +0000 (13:57 +0200)] 
MEDIUM: init: DeviceAtlas initialization

This diff initialises few DeviceAtlas struct fields member with
their inherent default values.
Furthermore, the specific DeviceAtlas configuration keywords are
registered and the module is initialised and all necessary
resources are freed during the deinit phase.

10 years agoMEDIUM: sample: add the da-csv converter
David Carlier [Mon, 1 Jun 2015 11:54:29 +0000 (13:54 +0200)] 
MEDIUM: sample: add the da-csv converter

This diff declares the deviceatlas module and can accept up to 5
property names for the API lookup.

[wt: this should probably be moved to its own file using the keyword
      registration mechanism]

10 years agoMEDIUM: global: add the DeviceAtlas required elements to struct global
David Carlier [Mon, 1 Jun 2015 11:53:01 +0000 (13:53 +0200)] 
MEDIUM: global: add the DeviceAtlas required elements to struct global

This diff is the raw C struct definition of all DeviceAtlas module
data needed added to the main global struct haproxy configuration.
The three first members are needed for both init and deinit phases
as some dynamic memory allocations are done.
The useragentid serves to hold during the whole lifecycle of the
module the User-Agent HTTP Header identifier from the DeviceAtlas
data during the init process.

10 years agoMEDIUM: config: add DeviceAtlas global keywords
David Carlier [Mon, 1 Jun 2015 11:50:06 +0000 (13:50 +0200)] 
MEDIUM: config: add DeviceAtlas global keywords

This diff is for the DeviceAtlas convertor.

This patch adds the following converters :
  deviceatlas-json-file
  deviceatlas-log-level
  deviceatlas-property-separator

First, the configuration keywords handling (only the log
level configuration part does not end the haproxy process
if it is wrongly set, it fallbacks to the default level).
Furthermore, init, deinit phases and the API lookup phase,
the da_haproxy function which is fed by the input provided
and set all necessary properties chosen via the configuration
to the output, separated by the separator.

10 years agoMEDIUM: ssl: replace standards DH groups with custom ones
Remi Gacogne [Fri, 29 May 2015 14:26:17 +0000 (16:26 +0200)] 
MEDIUM: ssl: replace standards DH groups with custom ones

It is likely that powerful adversaries have been pre-computing the
standardized DH groups, because being widely used have made them
valuable targets. While users are advised to generate their own
DH parameters, replace the ones we ship by values been randomly
generated for this product only.

[wt: replaced dh1024_p, dh2048_p, and dh4096_p with locally-generated
 ones as recommended by Rémi]

10 years agoMEDIUM: ssl: add the possibility to use a global DH parameters file
Remi Gacogne [Fri, 29 May 2015 13:53:22 +0000 (15:53 +0200)] 
MEDIUM: ssl: add the possibility to use a global DH parameters file

This patch adds the ssl-dh-param-file global setting. It sets the
default DH parameters that will be used during the SSL/TLS handshake when
ephemeral Diffie-Hellman (DHE) key exchange is used, for all "bind" lines
which do not explicitely define theirs.

10 years agoMINOR: lua: Lua tcp action are not final action
Thierry FOURNIER [Fri, 29 May 2015 15:31:12 +0000 (17:31 +0200)] 
MINOR: lua: Lua tcp action are not final action

Actually, the registered lua actions with "tcp-request lua" and
"tcp-response lua" are final actions. This patch change the action
type type and permit to continue the evaluation of tcp-* processing
after the evaluation of the lua actions.

10 years agoMINOR: tcp: add custom actions that can continue tcp-(request|response) processing
Thierry FOURNIER [Fri, 29 May 2015 15:29:14 +0000 (17:29 +0200)] 
MINOR: tcp: add custom actions that can continue tcp-(request|response) processing

Actually, the tcp-request and tcp-response custom ation are always final
actions. This patch create a new type of action that can permit to
continue the evaluation of tcp-request and tcp-response processing.

10 years agoMAJOR: peers: peers protocol version 2.0
Emeric Brun [Tue, 12 May 2015 16:49:09 +0000 (18:49 +0200)] 
MAJOR: peers: peers protocol version 2.0

This patch does'nt add any new feature: the functional behavior
is the same than version 1.0.

Technical differences:

In this version all updates on different stick tables are
multiplexed on the same tcp session. There is only one established
tcp session per peer whereas in first version there was one established
tcp session per peer and per stick table.

Messages format was reviewed to be more evolutive and to support
further types of data exchange such as SSL sessions or other sticktable's
data types (currently only the sticktable's server id is supported).

10 years agoBUG/MEDIUM: http: fix body processing for the stats applet
Willy Tarreau [Thu, 28 May 2015 23:09:15 +0000 (01:09 +0200)] 
BUG/MEDIUM: http: fix body processing for the stats applet

Commit 9fbe18e ("MEDIUM: http: add a new option http-buffer-request")
introduced a regression due to a misplaced check causing the admin
mode of the HTTP stats not to work anymore.

This patch tried to ensure that when we need a request body for the
stats applet, and we have already waited for this body, we don't wait
for it again, but the condition was applied too early causing a
disabling of the entire processing the body, and based on the wrong
HTTP state (MSG_BODY) resulting in the test never matching.

Thanks to Chad Lavoie for reporting the problem.

This bug is 1.6-only, no backport is needed.

10 years agoMEDIUM: cfgparse: check max arguments in the proxies sections
William Lallemand [Tue, 28 Apr 2015 18:17:49 +0000 (20:17 +0200)] 
MEDIUM: cfgparse: check max arguments in the proxies sections

Add checks on the maximum number of arguments in proxies sections.

10 years agoMEDIUM: cfgparse: max arguments check in the global section
William Lallemand [Tue, 19 May 2015 14:37:23 +0000 (16:37 +0200)] 
MEDIUM: cfgparse: max arguments check in the global section

Most of the keywords in the global section does not check the maximum
number of arguments. This leds sometines to unused and wrong arguments
in the configuration file. This patch add a maximum argument test in
many keywords of this section.

10 years agoMEDIUM: cfgparse: check section maximum number of arguments
William Lallemand [Tue, 28 Apr 2015 14:55:23 +0000 (16:55 +0200)] 
MEDIUM: cfgparse: check section maximum number of arguments

This patch checks the number of arguments of the keywords:
'global', 'defaults', 'listen', 'backend', 'frontend', 'peers' and
'userlist'

The 'global' section does not take any arguments.

Proxy sections does not support bind address as argument anymore.  Those
sections supports only an <id> argument.

The 'defaults' section didn't had any check on its arguments. It takes
an optional <name> argument.

'peers' section takes a <peersect> argument.

'userlist' section takes a <listname> argument.

10 years agoCLEANUP: cfgparse: remove reference to 'ruleset' section
William Lallemand [Tue, 14 Apr 2015 14:35:22 +0000 (16:35 +0200)] 
CLEANUP: cfgparse: remove reference to 'ruleset' section

The 'ruleset' section was never implemented. This patch remove
references and tests about this keyword.

10 years agoBUG/MEDIUM: cfgparse: segfault when userlist is misused
William Lallemand [Thu, 28 May 2015 16:03:51 +0000 (18:03 +0200)] 
BUG/MEDIUM: cfgparse: segfault when userlist is misused

If the 'userlist' keyword parsing returns an error and no userlist were
previously created. The parsing of 'user' and 'group' leads to NULL
derefence.

The userlist pointer is now tested to prevent this issue.

10 years agoBUG/MINOR: cfgparse: fix typo in 'option httplog' error message
William Lallemand [Thu, 28 May 2015 16:02:48 +0000 (18:02 +0200)] 
BUG/MINOR: cfgparse: fix typo in 'option httplog' error message

The error message was displaying the wrong argument when 'option
httplog' took a wrong argument.

10 years agoMINOR: ssl: add a destructor to free allocated SSL ressources
Remi Gacogne [Thu, 28 May 2015 14:39:47 +0000 (16:39 +0200)] 
MINOR: ssl: add a destructor to free allocated SSL ressources

Using valgrind or another memory leak tracking tool is easier
when the memory internally allocated by OpenSSL is cleanly released
at shutdown.

10 years agoBUG/MEDIUM: ssl: fix tune.ssl.default-dh-param value being overwritten
Remi Gacogne [Thu, 28 May 2015 14:23:00 +0000 (16:23 +0200)] 
BUG/MEDIUM: ssl: fix tune.ssl.default-dh-param value being overwritten

Hervé Commowick reported that the logic used to avoid complaining about
ssl-default-dh-param not being set when static DH params are present
in the certificate file was clearly wrong when more than one sni_ctx
is used.
This patch stores whether static DH params are being used for each
SSL_CTX individually, and does not overwrite the value of
tune.ssl.default-dh-param.

10 years agoMEDIUM: stats: escape some strings in the CSV dump
Thierry FOURNIER [Thu, 28 May 2015 14:02:01 +0000 (16:02 +0200)] 
MEDIUM: stats: escape some strings in the CSV dump

Some strings which must be dumped in the CSV output can contain one of
the following chars : <,>, <">, or CR/LF. This patch escapes these
strings if the case is encountered.

10 years agoMINOR: common: escape CSV strings
Thierry FOURNIER [Thu, 28 May 2015 14:00:28 +0000 (16:00 +0200)] 
MINOR: common: escape CSV strings

This function checks a string for using it in a CSV output format. If
the string contains one of the following four char <">, <,>, CR or LF,
the string is encapsulated between <"> and the <"> are escaped by a <"">
sequence.

The rounding by <"> is optionnal. It can be canceled, forced or the
function choose automatically the right way.

10 years agoMEDIUM: http: no need to close the request on redirect if data was parsed
Willy Tarreau [Thu, 28 May 2015 15:23:54 +0000 (17:23 +0200)] 
MEDIUM: http: no need to close the request on redirect if data was parsed

There are two reasons for not keeping the client connection alive upon a
redirect :
  - save the client from uploading all data
  - avoid keeping a connection alive if the redirect goes to another domain

The first case should consider an exception when all the data from the
client have been read already. This specifically happens on response
redirects after a POST to a server. This is an easy situation to detect.

It could later be improved to cover the cases where option
http-buffer-request is used.

10 years agoMEDIUM: http: implement http-response redirect rules
Willy Tarreau [Fri, 22 May 2015 15:30:48 +0000 (17:30 +0200)] 
MEDIUM: http: implement http-response redirect rules

Sometimes it's problematic not to have "http-response redirect" rules,
for example to perform a browser-based redirect based on certain server
conditions (eg: match of a header).

This patch adds "http-response redirect location <fmt>" which gives
enough flexibility for most imaginable operations. The connection to
the server is closed when this is performed so that we don't risk to
forward any pending data from the server.

Any pending response data are trimmed so that we don't risk to
forward anything pending to the client. It's harmless to also do that
for requests so we don't need to consider the direction.

10 years agoMINOR: http: prepare support for parsing redirect actions on responses
Willy Tarreau [Thu, 28 May 2015 13:26:58 +0000 (15:26 +0200)] 
MINOR: http: prepare support for parsing redirect actions on responses

In order to support http-response redirect, the parsing needs to be
adapted a little bit to only support the "location" type, and to
adjust the log-format parser so that it knows the direction of the
sample fetch calls.

10 years agoCLEANUP: http: explicitly reference request in http_apply_redirect_rules()
Willy Tarreau [Fri, 22 May 2015 14:27:37 +0000 (16:27 +0200)] 
CLEANUP: http: explicitly reference request in http_apply_redirect_rules()

This function was made to perform a redirect on requests only, it was
using a message or txn->req in an inconsistent way and did not consider
the possibility that it could be used for the other direction. Let's
clean it up to have both a request and a response messages.

10 years agoMEDIUM: capture: adds http-response capture
Thierry FOURNIER [Tue, 26 May 2015 16:06:31 +0000 (18:06 +0200)] 
MEDIUM: capture: adds http-response capture

This patch adds a http response capture keyword with the same behavior
as the previous patch called "MEDIUM: capture: Allow capture with slot
identifier".

10 years agoMINOR: http: add array of generic pointers in http_res_rules
Thierry FOURNIER [Tue, 26 May 2015 15:38:47 +0000 (17:38 +0200)] 
MINOR: http: add array of generic pointers in http_res_rules

This patch adds an array of generic pointers in the http_res_rules
struct. It is used later by the "response capture" functions.

10 years agoMEDIUM: capture: Allow capture with slot identifier
Thierry FOURNIER [Tue, 26 May 2015 15:58:29 +0000 (17:58 +0200)] 
MEDIUM: capture: Allow capture with slot identifier

This patch modifies the current http-request capture function
and adds a new keyword "id" that permits to identify a capture slot.
If the identified doesn't exists, the action fails silently.

Note that this patch removs an unused list initilisation, which seems
to be inherited from a copy/paste. It's harmless and does not need to
be backported.

   LIST_INIT((struct list *)&rule->arg.act.p[0]);

10 years agoMINOR: capture: add two "capture" converters
Thierry FOURNIER [Thu, 28 May 2015 11:22:03 +0000 (13:22 +0200)] 
MINOR: capture: add two "capture" converters

This patch adds "capture-req" and "capture-res". These two converters
capture their entry in the allocated slot given in argument and pass
the input on the output.

10 years agoMINOR: proxy: custom capture declaration
Thierry FOURNIER [Tue, 26 May 2015 15:44:32 +0000 (17:44 +0200)] 
MINOR: proxy: custom capture declaration

This patch adds a new keyword called "declare". This keyword
allow to declare some capture slots in requests and response.
It is useful for sharing capture between frontend and backends.

10 years agoMEDIUM: proxy: add a new proxy_find_best_match() function
Willy Tarreau [Wed, 27 May 2015 14:46:26 +0000 (16:46 +0200)] 
MEDIUM: proxy: add a new proxy_find_best_match() function

This function tries to spot a proxy by its name, ID and type, and
in case some elements don't match, it tries to determine which ones
could be ignored and reports which ones were ignored so that the
caller can decide whether or not it wants to pick this proxy. This
will be used for maintaining the status across reloads where the
config might have changed a bit.

10 years agoMINOR: proxy: add a flag to memorize that the proxy's ID was forced
Willy Tarreau [Wed, 27 May 2015 14:44:02 +0000 (16:44 +0200)] 
MINOR: proxy: add a flag to memorize that the proxy's ID was forced

This will be used to know if proxy's ID should be considered when names
mismatch upon check status reload.

10 years agoMINOR: proxy: add a new function proxy_find_by_id()
Willy Tarreau [Tue, 26 May 2015 13:25:32 +0000 (15:25 +0200)] 
MINOR: proxy: add a new function proxy_find_by_id()

It does the same as the other one except that it only focuses on the
numeric ID and the capabilities. It's used by proxy_find_by_name()
for numeric names.

10 years agoMAJOR: config: remove the deprecated reqsetbe / reqisetbe actions
Willy Tarreau [Tue, 26 May 2015 10:18:29 +0000 (12:18 +0200)] 
MAJOR: config: remove the deprecated reqsetbe / reqisetbe actions

These ones were already obsoleted in 1.4, marked for removal in 1.5,
and not documented anymore. They used to emit warnings, and do still
require quite some code to stay in place. Let's remove them now.

10 years agoMEDIUM: stick-table: remove the now duplicate find_stktable() function
Willy Tarreau [Tue, 26 May 2015 10:08:07 +0000 (12:08 +0200)] 
MEDIUM: stick-table: remove the now duplicate find_stktable() function

Since proxy_tbl_by_name() already does the same job, let's not keep
duplicate functions and use this one only.

10 years agoCLEANUP: proxy: remove now unused function findproxy_mode()
Willy Tarreau [Tue, 26 May 2015 10:05:53 +0000 (12:05 +0200)] 
CLEANUP: proxy: remove now unused function findproxy_mode()

It's not used anymore.

10 years agoMEDIUM: config: clarify the conflicting modes detection for backend rules
Willy Tarreau [Tue, 26 May 2015 10:04:09 +0000 (12:04 +0200)] 
MEDIUM: config: clarify the conflicting modes detection for backend rules

We don't use findproxy_mode() anymore so we can check the conflicting
modes and report the anomalies accordingly with line numbers and more
explicit details.

10 years agoMINOR: config: don't open-code proxy name lookups
Willy Tarreau [Tue, 26 May 2015 09:45:02 +0000 (11:45 +0200)] 
MINOR: config: don't open-code proxy name lookups

We can now safely use the standard functions to detect proxy name
duplicates.

10 years agoMINOR: proxy: simply ignore duplicates in proxy name lookups
Willy Tarreau [Tue, 26 May 2015 09:35:41 +0000 (11:35 +0200)] 
MINOR: proxy: simply ignore duplicates in proxy name lookups

Now that we can't have duplicate proxies with similar capabilities, we
can remove some painful check. The first one is the check that made the
lookup function return NULL when a duplicate is found, as it prevented
it from being used in the config parser to detect duplicates.

10 years agoCLEANUP: proxy: make the proxy lookup functions more user-friendly
Willy Tarreau [Tue, 26 May 2015 09:24:42 +0000 (11:24 +0200)] 
CLEANUP: proxy: make the proxy lookup functions more user-friendly

First, findproxy() was renamed proxy_find_by_name() so that its explicit
that a name is required for the lookup. Second, we give this function
the ability to search for tables if needed. Third we now provide inline
wrappers to pass the appropriate PR_CAP_* flags and to explicitly look
up a frontend, backend or table.

10 years agoMEDIUM: config: reject conflicts in table names
Willy Tarreau [Tue, 26 May 2015 08:49:46 +0000 (10:49 +0200)] 
MEDIUM: config: reject conflicts in table names

A nasty situation happens when two tables have the same name. Since it
is possible to declare a table in a frontend and another one in a backend,
this situation may happen and result in a random behaviour each time a
table is designated in a "stick" or "track" rule. Let's make sure this
is properly detected and stopped. Such a config will now report :

[ALERT] 145/104933 (31571) : parsing [prx.cfg:36] : stick-table name 't' conflicts with table declared in frontend 't' at prx.cfg:30.
[ALERT] 145/104933 (31571) : Error(s) found in configuration file : prx.cfg
[ALERT] 145/104933 (31571) : Fatal errors found in configuration.

10 years agoMEDIUM: config: reject invalid config with name duplicates
Willy Tarreau [Tue, 26 May 2015 08:35:50 +0000 (10:35 +0200)] 
MEDIUM: config: reject invalid config with name duplicates

Since 1.4 we used to emit a warning when two frontends or two backends
had the same name. In 1.5 we added the same warning for two peers sections.
In 1.6 we added the same warning for two mailers sections. It's about time
to reject such invalid configurations, the impact they have on the code
complexity is huge and it is becoming a real obstacle to some improvements
such as restoring servers check status across reloads.

Now these errors are reported as fatal errors and will need to be fixed.
Anyway, till now there was no guarantee that what was written was working
as expected since the behaviour is not defined (eg: use_backend with a
name used by two backends leads to undefined behaviour).

Example of output :

[ALERT] 145/104759 (31564) : Parsing [prx.cfg:12]: mailers section 'm' has the same name as another mailers section declared at prx.cfg:10.
[ALERT] 145/104759 (31564) : Parsing [prx.cfg:16]: peers section 'p' has the same name as another peers section declared at prx.cfg:14.
[ALERT] 145/104759 (31564) : Parsing [prx.cfg:21]: frontend 'f' has the same name as another frontend declared at prx.cfg:18.
[ALERT] 145/104759 (31564) : Parsing [prx.cfg:27]: backend 'b' has the same name as another backend declared at prx.cfg:24.
[ALERT] 145/104759 (31564) : Error(s) found in configuration file : prx.cfg
[ALERT] 145/104759 (31564) : Fatal errors found in configuration.

10 years agoDOC: Update doc about weight, act and bck fields in the statistics
Pavlos Parissis [Sat, 2 May 2015 18:30:44 +0000 (20:30 +0200)] 
DOC: Update doc about weight, act and bck fields in the statistics

Reorder description of the mentioned fields in order to match the
order of types

10 years agoBUG/MEDIUM: http: fix the url_param fetch
Dragan Dosen [Mon, 25 May 2015 08:02:11 +0000 (10:02 +0200)] 
BUG/MEDIUM: http: fix the url_param fetch

The "name" and "name_len" arguments in function "smp_fetch_url_param"
could be left uninitialized for subsequent calls.

[wt: no backport needed, this is an 1.6 regression introduced by
 commit 4fdc74c ("MINOR: http: split the url_param in two parts") ]

10 years agoMEDIUM: backend: Allow redispatch on retry intervals
Joseph Lynch [Tue, 12 May 2015 06:25:34 +0000 (23:25 -0700)] 
MEDIUM: backend: Allow redispatch on retry intervals

For backend load balancing it sometimes makes sense to redispatch rather
than retrying against the same server. For example, when machines or routers
fail you may not want to waste time retrying against a dead server and
would instead prefer to immediately redispatch against other servers.

This patch allows backend sections to specify that they want to
redispatch on a particular interval. If the interval N is positive the
redispatch occurs on every Nth retry, and if the interval N is negative then
the redispatch occurs on the Nth retry prior to the last retry (-1 is the
default and maintains backwards compatibility). In low latency environments
tuning this setting can save a few hundred milliseconds when backends fail.

10 years agoDOC: http: req.body_param documentation
Thierry FOURNIER [Wed, 20 May 2015 13:50:54 +0000 (15:50 +0200)] 
DOC: http: req.body_param documentation

This patch adds the req.body_param documentation.

10 years agoMEDIUM: http: url-encoded parsing function can run throught wrapped buffer
Thierry FOURNIER [Wed, 20 May 2015 13:28:12 +0000 (15:28 +0200)] 
MEDIUM: http: url-encoded parsing function can run throught wrapped buffer

The functions smp_fetch_param(), find_next_url_param() and
find_url_param_pos() can look for argument in 2 chunks and not only
one.

10 years agoMINOR: http: add body_param fetch
Thierry FOURNIER [Tue, 19 May 2015 12:45:09 +0000 (14:45 +0200)] 
MINOR: http: add body_param fetch

This fetch returns one body param or the list of each body param.
This first version runs only with one chunk.

10 years agoCLEANUP: http: bad indentation
Thierry FOURNIER [Wed, 20 May 2015 13:22:37 +0000 (15:22 +0200)] 
CLEANUP: http: bad indentation

Some function argument uses space in place of tabulation
for the indentation.

10 years agoMINOR: http: split the url_param in two parts
Thierry FOURNIER [Tue, 19 May 2015 12:46:23 +0000 (14:46 +0200)] 
MINOR: http: split the url_param in two parts

This patch is the part of the body_param fetch. The goal is to have
generic url-encoded parser which can used for parsing the query string
and the body.

10 years agoBUG/MEDIUM: peers: apply a random reconnection timeout
Willy Tarreau [Wed, 20 May 2015 08:39:04 +0000 (10:39 +0200)] 
BUG/MEDIUM: peers: apply a random reconnection timeout

Commit 9ff95bb ("BUG/MEDIUM: peers: correctly configure the client timeout")
uncovered an old bug in the peers : upon disconnect, we reconnect immediately.
This sometimes results in both ends to do the same thing in parallel causing
a loop of connect/accept/close/close that can last several seconds. The risk
of occurrence of the trouble increases with latency, and is emphasized by the
fact that idle connections are now frequently recycled (after 5s of idle).

In order to avoid this we must apply a random delay before reconnecting.
Fortunately the mechanism already supports a reconnect delay, so here we
compute the random timeout when killing a session. The delay is 50ms plus
a random between 0 and 2 seconds. Ideally an exponential back-off would
be preferred but it's preferable to keep the fix simple.

This bug was reported by Marco Corte.

This fix must be backported to 1.5 since the fix above was backported into
1.5.12.

10 years agoMEDIUM: http: make url_param iterate over multiple occurrences
Willy Tarreau [Thu, 7 May 2015 14:06:18 +0000 (16:06 +0200)] 
MEDIUM: http: make url_param iterate over multiple occurrences

There are some situations hwere it's desirable to scan multiple occurrences
of a same parameter name in the query string. This change ensures this can
work, even with an empty name which will then iterate over all parameters.

10 years agoMINOR: Add sample fetch which identifies if the SSL session has been resumed
Nenad Merdanovic [Mon, 18 May 2015 00:28:57 +0000 (02:28 +0200)] 
MINOR: Add sample fetch which identifies if the SSL session has been resumed

Signed-off-by: Nenad Merdanovic <nmerdan@anine.io>
10 years agoDOC: Document new socket commands "show tls-keys" and "set ssl tls-key"
Nenad Merdanovic [Sat, 9 May 2015 06:46:02 +0000 (08:46 +0200)] 
DOC: Document new socket commands "show tls-keys" and "set ssl tls-key"

Signed-off-by: Nenad Merdanovic <nmerdan@anine.io>
10 years agoMEDIUM: Add support for updating TLS ticket keys via socket
Nenad Merdanovic [Sat, 9 May 2015 06:46:01 +0000 (08:46 +0200)] 
MEDIUM: Add support for updating TLS ticket keys via socket

Until now, HAproxy needed to be restarted to change the TLS ticket
keys. With this patch, the TLS keys can be updated on a per-file
basis using the admin socket. Two new socket commands have been
introduced: "show tls-keys" and "set ssl tls-keys".

Signed-off-by: Nenad Merdanovic <nmerdan@anine.io>
10 years agoMINOR: Add TLS ticket keys reference and use it in the listener struct
Nenad Merdanovic [Sat, 9 May 2015 06:46:00 +0000 (08:46 +0200)] 
MINOR: Add TLS ticket keys reference and use it in the listener struct

Within the listener struct we need to use a reference to the TLS
ticket keys which binds the actual keys with the filename. This will
make it possible to update the keys through the socket

Signed-off-by: Nenad Merdanovic <nmerdan@anine.io>
10 years agoBUG/MAJOR: checks: break infinite loops when tcp-checks starts with comment
Willy Tarreau [Wed, 13 May 2015 13:39:48 +0000 (15:39 +0200)] 
BUG/MAJOR: checks: break infinite loops when tcp-checks starts with comment

If a tcp-check sequence starts with "comment", then the action is not
matched in the while() loop and the pointer doesn't advance so we face
an endless loop. It is normally detected early except in the case where
very slow checks are performed causing it to trigger after the admin stops
watching.

This bug is 1.6-only and very recent so it didn't have the time to affect
anyone.

10 years agoBUG/MEDIUM: checks: do not dereference a list as a tcpcheck struct
Willy Tarreau [Wed, 13 May 2015 10:24:53 +0000 (12:24 +0200)] 
BUG/MEDIUM: checks: do not dereference a list as a tcpcheck struct

The method used to skip to next rule in the list is wrong, it assumes
that the list element starts at the same offset as the rule. It happens
to be true on most architectures since the list is the first element for
now but it's definitely wrong. Now the code doesn't crash anymore when
the struct list is moved anywhere else in the struct tcpcheck_rule.

This fix must be backported to 1.5.

10 years agoBUG/MAJOR: checks: always check for end of list before proceeding
Willy Tarreau [Wed, 13 May 2015 10:08:21 +0000 (12:08 +0200)] 
BUG/MAJOR: checks: always check for end of list before proceeding

This is the most important fix of this series. There's a risk of endless
loop and crashes caused by the fact that we go past the head of the list
when skipping to next rule, without checking if it's still a valid element.
Most of the time, the ->action field is checked, which points to the proxy's
check_req pointer (generally NULL), meaning the element is confused with a
TCPCHK_ACT_SEND action.

The situation was accidently made worse with the addition of tcp-check
comment since it also skips list elements. However, since the action that
makes it go forward is TCPCHK_ACT_COMMENT (3), there's little chance to
see this as a valid pointer, except on 64-bit machines where it can match
the end of a check_req string pointer.

This fix heavily depends on previous cleanup and both must be backported
to 1.5 where the bug is present.

10 years agoCLEANUP: checks: simplify the loop processing of tcp-checks
Willy Tarreau [Wed, 13 May 2015 09:59:14 +0000 (11:59 +0200)] 
CLEANUP: checks: simplify the loop processing of tcp-checks

There is some unobvious redundancy between the various ways we can leave
the loop. Some of them can be factored out. So now we leave the loop when
we can't go further, whether it's caused by reaching the end of the rules
or by a blocking I/O.

10 years agoBUG/MEDIUM: checks: do not dereference head of a tcp-check at the end
Willy Tarreau [Wed, 13 May 2015 09:38:17 +0000 (11:38 +0200)] 
BUG/MEDIUM: checks: do not dereference head of a tcp-check at the end

When the end of the list is reached, the current step's action is checked
to know if we must poll or not. Unfortunately, the main reason for going
there is that we walked past the end of list and current_step points to
the head. We cannot dereference ->action since it does not belong to this
structure and can definitely crash if the address is not mapped.

This bug is unlikely to cause a crash since the action appears just after
the list, and corresponds to the "char *check_req" pointer in the proxy
struct, and it seems that we can't go there with current_step being null.
At worst it can cause the check to register for recv events.

This fix needs to be backported to 1.5 since the code is incorrect there
as well.

10 years agoCLEANUP: checks: fix double usage of cur / current_step in tcp-checks
Willy Tarreau [Wed, 13 May 2015 09:23:01 +0000 (11:23 +0200)] 
CLEANUP: checks: fix double usage of cur / current_step in tcp-checks

This cleanup is a preliminary requirement to the upcoming fixes for
the bug that affect tcp-check's improper use of lists. It will have
to be backported to 1.5 though it will not easily apply.

There are two variables pointing to the current rule within the loop,
and either one or the other is used depending on the code blocks,
making it much harder to apply checks to fix the list walking bug.
So first get rid of "cur" and only focus on current_step.

10 years agoMEDIUM: cfgparse: expand environment variables
William Lallemand [Tue, 12 May 2015 12:27:13 +0000 (14:27 +0200)] 
MEDIUM: cfgparse: expand environment variables

Environment variables were expandables only in adresses.
Now there are expandables everywhere in the configuration file within
double quotes.

This patch breaks compatibility with the previous behavior of
environment variables in adresses, you must enclose adresses with double
quotes to make it work.

10 years agoMINOR: cfgparse: remove line size limitation
William Lallemand [Tue, 12 May 2015 12:25:37 +0000 (14:25 +0200)] 
MINOR: cfgparse: remove line size limitation

Remove the line size limitation of the configuration parser.  The buffer
is now allocated dynamically and grows when the line is too long.

10 years agoBUG/MEDIUM: cfgparse: incorrect memmove in quotes management
William Lallemand [Tue, 12 May 2015 12:01:09 +0000 (14:01 +0200)] 
BUG/MEDIUM: cfgparse: incorrect memmove in quotes management

The size of the memmove was incorrect (one byte too far) in the quotes
parser and can lead to segfault during configuration parsing.

10 years agoBUG/MAJOR: check: fix breakage of inverted tcp-check rules
Willy Tarreau [Tue, 12 May 2015 09:57:07 +0000 (11:57 +0200)] 
BUG/MAJOR: check: fix breakage of inverted tcp-check rules

Recent commit 22b09d2 ("MINOR: include comment in tcpcheck error log")
accidently left a double-step to the next rule in case of an inverted
rule. The effect is that an inverted rule is necessarily skipped and
that we can crash if it was the last rule since we'd use as a rule the
head of the list, thus dereference random memory contents.

No backport is needed.

10 years agoDOC: tcpcheck comment documentation
Baptiste Assmann [Sat, 25 Apr 2015 14:27:23 +0000 (16:27 +0200)] 
DOC: tcpcheck comment documentation

Introduction of new tcpcheck comment directive and also update texpcheck
ruleset examples.

10 years agoMINOR: include comment in tcpcheck error log
Baptiste Assmann [Fri, 1 May 2015 06:03:04 +0000 (08:03 +0200)] 
MINOR: include comment in tcpcheck error log

tcpcheck error messages include the step id where the error occurs.
In some cases, this is not enough. Now, HAProxy also use the comment
field of the latest tcpcheck rule which has been run.
This commit allows HAProxy to parse a new directive in the tcpcheck
ruleset: 'comment'.
It is used to setup comments on the current tcpcheck rules.

10 years agoMINOR: tcpcheck_rule structure update
Baptiste Assmann [Sat, 25 Apr 2015 14:16:48 +0000 (16:16 +0200)] 
MINOR: tcpcheck_rule structure update

A new field is added into the tcpcheck_rule structure.
This field will host a string used as a comment to describe the rule.
Then this comment can be used in logs to report a more user friendly
message on the step which failed during the tcpcheck ruleset.

10 years agoMINOR: use an int instead of calling tcpcheck_get_step_id
Baptiste Assmann [Sat, 2 May 2015 07:00:23 +0000 (09:00 +0200)] 
MINOR: use an int instead of calling tcpcheck_get_step_id

in src.checks.c, the function tcpcheck_get_step_id is called many times.
In order to save some cpu cycles, I save the result of this function in
an integer.

10 years agoBUG/MINOR: check: fix tcpcheck error message
Baptiste Assmann [Fri, 1 May 2015 06:09:29 +0000 (08:09 +0200)] 
BUG/MINOR: check: fix tcpcheck error message

add the keyword 'string' when required (error in a tcpcheck expect
string)

10 years agoBUILD/MINOR: ssl: fix build failure introduced by recent patch
Willy Tarreau [Tue, 12 May 2015 08:30:12 +0000 (10:30 +0200)] 
BUILD/MINOR: ssl: fix build failure introduced by recent patch

Baptiste reported that commit 0a9a2b8 ("MEDIUM: sample change the
prototype of sample-fetches and converters functions") broke the
build of ssl_sock.c when using openssl-1.0.2 because one missed
replacement of sess with smp->sess. No backport is needed.

10 years agoMEDIUM: sample: change the prototype of sample-fetches functions
Thierry FOURNIER [Mon, 11 May 2015 13:42:45 +0000 (15:42 +0200)] 
MEDIUM: sample: change the prototype of sample-fetches functions

This patch removes the "opt" entry from the prototype of the
sample-fetches fucntions. This permits to remove some weight
in the prototype call.

10 years agoMINOR: sample: fill the struct sample with the options.
Thierry FOURNIER [Mon, 11 May 2015 13:25:29 +0000 (15:25 +0200)] 
MINOR: sample: fill the struct sample with the options.

Options are relative to the sample. Each sample fetched is associated with
fetch options or fetch flags.

This patch adds the 'opt' vaue in the sample struct. This permits to reduce
the sample-fetch function prototype. In other way, the converters will have
more detail about the origin of the sample.

10 years agoMEDIUM: sample change the prototype of sample-fetches and converters functions
Thierry FOURNIER [Mon, 11 May 2015 13:20:49 +0000 (15:20 +0200)] 
MEDIUM: sample change the prototype of sample-fetches and converters functions

This patch removes the structs "session", "stream" and "proxy" from
the sample-fetches and converters function prototypes.

This permits to remove some weight in the prototype call.

10 years agoMEDIUM: sample: fill the struct sample with the session, proxy and stream pointers
Thierry FOURNIER [Mon, 11 May 2015 09:54:58 +0000 (11:54 +0200)] 
MEDIUM: sample: fill the struct sample with the session, proxy and stream pointers

Some sample analyzer (sample-fetch or converters) needs to known the proxy,
session and stream attached to the sampel. The sample-fetches and the converters
function pointers cannot be called without these 3 pointers filled.

This patch permits to reduce the sample-fetch and the converters called
prototypes, and provides a new mean to add information for this type of
functions.

10 years agoBUG/MEDIUM: http: don't forward client shutdown without NOLINGER except for tunnels
Willy Tarreau [Mon, 11 May 2015 16:30:33 +0000 (18:30 +0200)] 
BUG/MEDIUM: http: don't forward client shutdown without NOLINGER except for tunnels

There's an issue related with shutting down POST transfers or closing the
connection after the end of the upload : the shutdown is forwarded to the
server regardless of the abortonclose option. The problem it causes is that
during a scan, brute force or whatever, it becomes possible that all source
ports are exhausted with all sockets in TIME_WAIT state.

There are multiple issues at once in fact :
  - no action is done for the close, it automatically happens at the lower
    layers thanks for channel_auto_close(), so we cannot act on NOLINGER ;

  - we *do* want to continue to send a clean shutdown in tunnel mode because
    some protocols transported over HTTP may need this, regardless of option
    abortonclose, thus we can't set the option inconditionally

  - for all other modes, we do want to close the dirty way because we're
    certain whether we've sent everything or not, and we don't want to eat
    all source ports.

The solution is a bit complex and applies to DONE/TUNNEL states :

  1) disable automatic close for everything not a tunnel and not just
     keep-alive / server-close. Force-close is now covered, as is HTTP/1.0
     which implicitly works in force-close mode ;

  2) when processing option abortonclose, we know we can disable lingering
     if the client has closed and the connection is not in tunnel mode.

Since the last case above leads to a situation where the client side reports
an error, we know the connection will not be reused, so leaving the flag on
the stream-interface is safe. A client closing in the middle of the data
transmission already aborts the transaction so this case is not a problem.

This fix must be backported to 1.5 where the problem was detected.

10 years agoMINOR: sample: add url_dec converter
Thierry FOURNIER [Thu, 7 May 2015 13:46:20 +0000 (15:46 +0200)] 
MINOR: sample: add url_dec converter

This converter decodes an url-encoded string. It takes a string as
input and returns string as output.

10 years agoBUG/MEDIUM: http: fix the http-request capture parser
Willy Tarreau [Fri, 8 May 2015 14:13:42 +0000 (16:13 +0200)] 
BUG/MEDIUM: http: fix the http-request capture parser

Due to the code being mostly inspired from the tcp-request parser, it
does some crap because both don't work the same way. The "len" argument
could be mismatched and then the length could be used uninitialized.

10 years agoMEDIUM: http: add new "capture" action for http-request
Willy Tarreau [Fri, 8 May 2015 13:27:59 +0000 (15:27 +0200)] 
MEDIUM: http: add new "capture" action for http-request

This is only possible in frontends of course, but it will finally
make it possible to capture arbitrary http parts, including URL
parameters or parts of the message body.

It's worth noting that an ugly (char **) cast had to be done to
call sample_fetch_string() which is caused by a 5- or 6- levels
of inheritance of this type in the API. Here it's harmless since
the function uses it as a const, but this API madness must be
fixed, starting with the one or two rare functions that modify
the args and inflict this on each and every keyword parser.
(cherry picked from commit 484a4f38460593919a1c1d9a047a043198d69f45)

10 years agoMEDIUM: cfgparse: introduce weak and strong quoting
William Lallemand [Tue, 5 May 2015 15:37:14 +0000 (17:37 +0200)] 
MEDIUM: cfgparse: introduce weak and strong quoting

This patch introduces quoting which allows to write configuration string
including spaces without escaping them.

Strong (with single quotes) and weak (with double quotes) quoting are
supported. Weak quoting supports escaping and special characters when
strong quoting does not interpret anything.

This patch could break configuration files where ' and " where used.

10 years agoBUG/MEDIUM: config: properly compute the default number of processes for a proxy
Willy Tarreau [Mon, 4 May 2015 19:57:58 +0000 (21:57 +0200)] 
BUG/MEDIUM: config: properly compute the default number of processes for a proxy

Chad Lavoie reported an interesting regression caused by the latest
updates to automatically detect the processes a peers section runs on.
It turns out that if a config has neither nbproc nor a bind-process
statement and depending on the frontend->backend chaining, it is possible
to evade all bind_proc propagations, resulting in assigning only ~0UL (all
processes, which is 32 or 64) without ever restricting it to nbproc. It
was not visible in backends until they started to reference peers sections
which saw themselves with 64 processes at once.

This patch addresses this by replacing all those ~0UL with nbits(nbproc).
That way all "bind-process" settings *default* to the number of processes
defined in nbproc instead of 32 or 64.

This fix could possibly be backported into 1.5, though there is no indication
that this bug could have any effect there.

10 years agoMINOR: config: report the number of processes using a peers section in the error...
Willy Tarreau [Mon, 4 May 2015 19:48:51 +0000 (21:48 +0200)] 
MINOR: config: report the number of processes using a peers section in the error case

It can be helpful to know how many different processes try to use the
same peers section when trying to find the culprits.

10 years agoCLEANUP: config: fix misleading information in error message.
Willy Tarreau [Mon, 4 May 2015 19:46:08 +0000 (21:46 +0200)] 
CLEANUP: config: fix misleading information in error message.

The parameter name is "bind-process", not "bind_proc" which is the
internal variable name.

10 years agoBUG/MEDIUM: stats: properly initialize the scope before dumping stats
Willy Tarreau [Mon, 4 May 2015 16:07:56 +0000 (18:07 +0200)] 
BUG/MEDIUM: stats: properly initialize the scope before dumping stats

Issuing a "show sess all" prior to a "show stat" on the CLI results in no
proxy being dumped because the scope_len union member was not properly
reinitialized.

This fix must be backported into 1.5.