]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
9 years agoMAJOR: stick-tables: use sample types in place of dedicated types
Thierry FOURNIER [Mon, 10 Aug 2015 15:53:45 +0000 (17:53 +0200)] 
MAJOR: stick-tables: use sample types in place of dedicated types

This patch is the first step for sample integration. Actually
the stick tables uses her own data type, and some converters
must be called to convert sample type to stick-tables types.

This patch removes the stick-table types and replace it by
the sample types. This prevent:
 - Maintenance of two types of converters
 - reduce the code using the samples converters

9 years agoMINOR: actions: Remove wrappers
Thierry FOURNIER [Thu, 6 Aug 2015 16:25:56 +0000 (18:25 +0200)] 
MINOR: actions: Remove wrappers

Now the prototype for each action from each section are the same, and
a discriminant for determining for each section we are called are added.
So, this patch removes the wrappers for the action functions called from
more than one section.

This patch removes 132 lines of useless code.

9 years agoMEDIUM: actions: Normalize the return code of the configuration parsers
Thierry FOURNIER [Wed, 19 Aug 2015 07:04:15 +0000 (09:04 +0200)] 
MEDIUM: actions: Normalize the return code of the configuration parsers

This patch normalize the return code of the configuration parsers. Before
these changes, the tcp action parser returned -1 if fail and 0 for the
succes. The http action returned 0 if fail and 1 if succes.

The normalisation does:
 - ACT_RET_PRS_OK for succes
 - ACT_RET_PRS_ERR for failure

9 years agoMINOR: actions: mutualise the action keyword lookup
Thierry FOURNIER [Wed, 19 Aug 2015 07:07:47 +0000 (09:07 +0200)] 
MINOR: actions: mutualise the action keyword lookup

Each (http|tcp)-(request|response) action use the same method
for looking up the action keyword during the cofiguration parsing.

This patch mutualize the code.

9 years agoMINOR: proto_tcp: proto_tcp.h is now useles
Thierry FOURNIER [Wed, 19 Aug 2015 07:06:21 +0000 (09:06 +0200)] 
MINOR: proto_tcp: proto_tcp.h is now useles

After removing the keyword register from types/proto_tcp.h, the header
file remains empty. This patch remove it

9 years agoMEDIUM: actions: Merge (http|tcp)-(request|reponse) keywords structs
Thierry FOURNIER [Wed, 19 Aug 2015 07:01:53 +0000 (09:01 +0200)] 
MEDIUM: actions: Merge (http|tcp)-(request|reponse) keywords structs

This patch merges the conguration keyword struct. Each declared configuration
keyword struct are similar with the others. This patch simplify the code.

9 years agoMEDIUM: actions: Add standard return code for the action API
Thierry FOURNIER [Thu, 6 Aug 2015 06:52:53 +0000 (08:52 +0200)] 
MEDIUM: actions: Add standard return code for the action API

Action function can return 3 status:
 - error if the action encounter fatal error (like out of memory)
 - yield if the action must terminate his work later
 - continue in other cases

9 years agoMINOR: actions: change actions names
Thierry FOURNIER [Wed, 5 Aug 2015 17:05:19 +0000 (19:05 +0200)] 
MINOR: actions: change actions names

For performances considerations, some actions are not processed by remote
function. They are directly processed by the function. Some of these actions
does the same things but for different processing part (request / response).

This patch give the same name for the same actions, and change the normalization
of the other actions names.

This patch is ONLY a rename, it doesn't modify the code.

9 years agoMINOR: actions: Declare all the embedded actions in the same header file
Thierry FOURNIER [Thu, 6 Aug 2015 06:30:11 +0000 (08:30 +0200)] 
MINOR: actions: Declare all the embedded actions in the same header file

This patch group the action name in one file. Some action are called
many times and need an action embedded in the action caller. The main
goal is to have only one header file grouping all definitions.

9 years agoMINOR: actions: remove the mark indicating the last entry in enum
Thierry FOURNIER [Wed, 5 Aug 2015 17:13:48 +0000 (19:13 +0200)] 
MINOR: actions: remove the mark indicating the last entry in enum

This mark permit to detect if the action tag is over the allowed range.
 - Normally, this case doesn't appear
 - If it appears, it is processed by ded fault case of the switch

9 years agoMINOR: actions: add "from" information
Thierry FOURNIER [Fri, 14 Aug 2015 17:20:07 +0000 (19:20 +0200)] 
MINOR: actions: add "from" information

This struct member is used to specify who is the rule caller. It permits
to use one function for differents callers.

9 years agoMEDIUM: capture: Move the capture configuration storage in the union
Thierry FOURNIER [Tue, 4 Aug 2015 06:21:12 +0000 (08:21 +0200)] 
MEDIUM: capture: Move the capture configuration storage in the union

This patch moves the capture configuration struct (capture_prm) in the main
"arg" union. This reduce the size of the struct.

9 years agoMEDIUM: track-sc: Move the track-sc configuration storage in the union
Thierry FOURNIER [Tue, 4 Aug 2015 07:09:48 +0000 (09:09 +0200)] 
MEDIUM: track-sc: Move the track-sc configuration storage in the union

This patch moves the track-sc configuration struct (track_ctr_prm) in the main
"arg" union. This reduce the size od the struct.

9 years agoMINOR: proto_http: replace generic opaque types by real used types in "http_capture...
Thierry FOURNIER [Fri, 31 Jul 2015 06:56:35 +0000 (08:56 +0200)] 
MINOR: proto_http: replace generic opaque types by real used types in "http_capture" by id

This patch removes the generic opaque type for storing the configuration of the
action "http_capture" by id.

9 years agoMINOR: proto_http: replace generic opaque types by real used types in "http_capture"
Thierry FOURNIER [Fri, 31 Jul 2015 06:56:16 +0000 (08:56 +0200)] 
MINOR: proto_http: replace generic opaque types by real used types in "http_capture"

This patch removes the generic opaque type for storing the configuration of the
action "http_capture"".

9 years agoMINOR: proto_http: replace generic opaque types by real used types for the actions...
Thierry FOURNIER [Fri, 31 Jul 2015 06:54:25 +0000 (08:54 +0200)] 
MINOR: proto_http: replace generic opaque types by real used types for the actions on thr request line

This patch removes the generic opaque type for storing the configuration of the
action "set-method", "set-path", "set-query" and "set-uri".

9 years agoMINOR: proto_http: use an "expr" type in place of generic opaque type.
Thierry FOURNIER [Fri, 31 Jul 2015 06:50:51 +0000 (08:50 +0200)] 
MINOR: proto_http: use an "expr" type in place of generic opaque type.

This patch removes the generic opaque type for storing the configuration of the
acion "set-src" (HTTP_REQ_ACT_SET_SRC), and use the dedicated type "struct expr"

9 years agoMINOR: vars: use the vars types as argument in place of opaque type
Thierry FOURNIER [Thu, 30 Jul 2015 17:12:50 +0000 (19:12 +0200)] 
MINOR: vars: use the vars types as argument in place of opaque type

The (http|tcp)-(request|response) action rules use common
opaque type. For the HAProxy embbedded feature, types are know,
it better to add this types in the action union and use it.

9 years agoMINOR: lua: use the hlua_rule type in place of opaque type
Thierry FOURNIER [Thu, 30 Jul 2015 17:03:55 +0000 (19:03 +0200)] 
MINOR: lua: use the hlua_rule type in place of opaque type

The (http|tcp)-(request|response) action rules use common
opaque type. For the HAProxy embbedded feature, types are know,
it better to add this types in the action union and use it.

9 years agoMINOR: actions: Remove the data opaque pointer
Thierry FOURNIER [Thu, 30 Jul 2015 16:53:54 +0000 (18:53 +0200)] 
MINOR: actions: Remove the data opaque pointer

This patch removes the "data" opaque pointer and replace it by the generic
opaque pointer "p[0]".

9 years agoMEDIUM: actions: Merge (http|tcp)-(request|reponse) action structs
Thierry FOURNIER [Tue, 4 Aug 2015 17:35:46 +0000 (19:35 +0200)] 
MEDIUM: actions: Merge (http|tcp)-(request|reponse) action structs

This patch is the first of a serie which merge all the action structs. The
function "tcp-request content", "tcp-response-content", "http-request" and
"http-response" have the same values and the same process for some defined
actions, but the struct and the prototype of the declared function are
different.

This patch try to unify all of these entries.

9 years agoMINOR: map: The map can return IPv4 and IPv6
Thierry FOURNIER [Tue, 4 Aug 2015 17:35:46 +0000 (19:35 +0200)] 
MINOR: map: The map can return IPv4 and IPv6

The maps can store both IPv4 and IPv6 as sample.

9 years agoMEDIUM: pattern/map: Maps can returns various types
Thierry FOURNIER [Wed, 19 Aug 2015 07:05:25 +0000 (09:05 +0200)] 
MEDIUM: pattern/map: Maps can returns various types

A map can store and return various types as output. The only one example is the
IPv4 and IPv6 types. The previous patch remove the type from the sample storage
struct and use the conoverter output type, expecting that all entries of the
map have the same type.

This will be wrong when the maps will support both IPv4 and IPv6 as output.

9 years agoMINOR: samples: data assignation simplification
Thierry FOURNIER [Wed, 19 Aug 2015 07:02:36 +0000 (09:02 +0200)] 
MINOR: samples: data assignation simplification

With the difference between the "struct sample" data and the
"struct sample_storage" data, it was not possible to write
data = data, and we did a memcpy. This patch remove some of
these memcpy.

9 years agoMEDIUM: 51degrees: Adapt the 51Degrees library
Thierry FOURNIER [Thu, 20 Aug 2015 11:42:12 +0000 (13:42 +0200)] 
MEDIUM: 51degrees: Adapt the 51Degrees library

I can't test this patch because the avalaible 51degrees library is
"51Degrees-C-3.1.5.2" and HAProxy obviously build with another version
(some defines and symbols disappear).

This patch is provided as-is in best effort.

9 years agoMINOR: samples: rename union from "data" to "u"
Thierry FOURNIER [Wed, 19 Aug 2015 07:07:19 +0000 (09:07 +0200)] 
MINOR: samples: rename union from "data" to "u"

The union name "data" is a little bit heavy while we read the source
code because we can read "data.data.sint". The rename from "data" to "u"
makes the read easiest like "data.u.sint".

9 years agoMINOR: samples: extract the anonymous union and create the union sample_value
Thierry FOURNIER [Thu, 20 Aug 2015 11:52:51 +0000 (13:52 +0200)] 
MINOR: samples: extract the anonymous union and create the union sample_value

This extract is not really required, but it maybe will be usefull later.
A comming soonpatch about simplification of stick table values will
use this union

9 years agoMEDIUM: samples: Use the "struct sample_data" in the "struct sample"
Thierry FOURNIER [Wed, 19 Aug 2015 07:00:18 +0000 (09:00 +0200)] 
MEDIUM: samples: Use the "struct sample_data" in the "struct sample"

This patch remove the struct information stored both in the struct
sample_data and in the striuct sample. Now, only thestruct sample_data
contains data, and the struct sample use the struct sample_data for storing
his own data.

9 years agoMINOR: samples: rename some struct member from "smp" to "data"
Thierry FOURNIER [Wed, 19 Aug 2015 06:35:43 +0000 (08:35 +0200)] 
MINOR: samples: rename some struct member from "smp" to "data"

This members contains data and not sample.

9 years agoMINOR: samples: rename a struct from sample_storage to sample_data
Thierry FOURNIER [Thu, 13 Aug 2015 22:02:11 +0000 (00:02 +0200)] 
MINOR: samples: rename a struct from sample_storage to sample_data

This a first step of sample reorganization.

9 years agoBUG/MINOR: ssl: TLS Ticket Key rotation broken via socket command
Pradeep Jindal [Thu, 20 Aug 2015 12:55:17 +0000 (18:25 +0530)] 
BUG/MINOR: ssl: TLS Ticket Key rotation broken via socket command

It seems haproxy was doing wrong pointer arithmetic to update the ticket
ring correctly.

9 years agoDOC: add new file intro.txt
Willy Tarreau [Tue, 18 Aug 2015 19:51:36 +0000 (21:51 +0200)] 
DOC: add new file intro.txt

This is an introduction to present HAProxy. The aim is to get rid of the
totally obsolete haproxy-en and haproxy-fr files. This file references
another one which is not there yet and which should cover the remaining
part of these obsolete files, which is how to manage the process. The
format is the same as the other docs so it should integrate seamlessly
to existing docs.

9 years agoBUG/MEDIUM: lua: bad error processing
Thierry FOURNIER [Wed, 19 Aug 2015 08:42:42 +0000 (10:42 +0200)] 
BUG/MEDIUM: lua: bad error processing

When the lua actions (http|tcp)-(request|rersponse) fails a yield is
returned. this patch fix the behavior and returns a continue.

9 years agoDOC: match several lua configuration option names to those implemented in code
Pieter Baauw [Sun, 16 Aug 2015 13:26:24 +0000 (15:26 +0200)] 
DOC: match several lua configuration option names to those implemented in code

9 years agoBUG/MEDIUM: counters: ensure that src_{inc,clr}_gpc0 creates a missing entry
Willy Tarreau [Tue, 18 Aug 2015 15:15:20 +0000 (17:15 +0200)] 
BUG/MEDIUM: counters: ensure that src_{inc,clr}_gpc0 creates a missing entry

During 1.5-dev20 there was some code refactoring to make the src_* fetch
function use the same code as sc_*. Unfortunately this introduced a
regression where src_* doesn't create an entry anymore if it does not
exist in the table. The reason is that smp_fetch_sc_stkctr() only calls
stktable_lookup_key() while src_inc_*/src_clr_* used to make use of
stktable_update_key() which additionally create the entry if it does
not exist.

There's no point modifying the common function for these two exceptions,
so instead we now have a function dedicated to the creation of this entry
for src_* only. It is called when the entry didn't exist, so that requires
minimal modifications to existing code.

Thanks to Thierry Fournier for helping diagnose the issue.

This fix must be backported to 1.5.

9 years agoBUG/MEDIUM: stick-tables: refcount error after copying SC for the session to the...
Thierry FOURNIER [Tue, 18 Aug 2015 09:34:18 +0000 (11:34 +0200)] 
BUG/MEDIUM: stick-tables: refcount error after copying SC for the session to the stream

Each copyied SC counter will be used and released by the stream, so we
need to increment the refcount.

9 years agoBUG/MEDIUM: vars: segfault during the configuration parsing
Thierry FOURNIER [Mon, 17 Aug 2015 16:38:24 +0000 (18:38 +0200)] 
BUG/MEDIUM: vars: segfault during the configuration parsing

This bug is introduced by the patch 48a9cd104d07919fdd941b36e9f927a20d55edd3
"MINOR: vars: reduce the code size of some wrappers". A dereferencement was
removed.

9 years agoMINOR: server SRV_ADMF_CMAINT flag doesn't imply SRV_ADMF_FMAINT
Baptiste Assmann [Mon, 17 Aug 2015 12:25:02 +0000 (14:25 +0200)] 
MINOR: server SRV_ADMF_CMAINT flag doesn't imply SRV_ADMF_FMAINT

The newly created server flag SRV_ADMF_CMAINT means that the server is
in 'disabled' mode because of configuration statement 'disabled'.
The flag SRV_ADMF_FMAINT should not be set anymore in such case and is
reserved only when the server is Forced in maintenance mode from the
stats socket.

9 years agoBUILD: add USE_LUA to BUILD_OPTIONS when it's used
Cyril Bonté [Sun, 16 Aug 2015 18:27:38 +0000 (20:27 +0200)] 
BUILD: add USE_LUA to BUILD_OPTIONS when it's used

haproxy -vv doesn't indicate that USE_LUA was specified at compilation time.
This is caused by the Makefile, which doesn't update BUILD_OPTIONS.

9 years agoBUG/MEDIUM: stream: The stream doen't inherit SC from the session
Thierry FOURNIER [Sun, 16 Aug 2015 10:03:39 +0000 (12:03 +0200)] 
BUG/MEDIUM: stream: The stream doen't inherit SC from the session

During the processing of tcp-request connection, the stream doesn't exists, so the
stick counters are stored in the session. When the stream is created it must
inherit from the session sc.

This patch fix this behavior.

[WT: this is specific to 1.6, no backport needed]

9 years agoMEDIUM: cli: rely on the map's output type instead of the sample type
Thierry FOURNIER [Thu, 23 Jul 2015 16:33:41 +0000 (18:33 +0200)] 
MEDIUM: cli: rely on the map's output type instead of the sample type

Next patch will remove sample_storage->type, and the only user is the
"show map" feature on the CLI which can use the map's output type instead.
Let's do that first.

9 years agoMINOR: sample/proto_tcp: export "smp_fetch_src"
Thierry FOURNIER [Fri, 24 Jul 2015 07:12:15 +0000 (09:12 +0200)] 
MINOR: sample/proto_tcp: export "smp_fetch_src"

This patch exports the sample fetch "smp_fetch_src()".

9 years agoMINOR: sample: Add ipv6 to ipv4 and sint to ipv6 casts
Thierry FOURNIER [Fri, 24 Jul 2015 07:04:56 +0000 (09:04 +0200)] 
MINOR: sample: Add ipv6 to ipv4 and sint to ipv6 casts

The RFC4291 says that when the IPv6 adress have the followin form:
0000::ffff:a.b.c.d, if can be converted to an IPv4 adress. This patch
enable this conversion in casts.

As the sint can be casted as ipv4, and ipv4 can be casted as ipv6, we
can directly cast sint as ipv6 using the RFC4291.

9 years agoMINOR: Move http method enum from proto_http to sample
Thierry FOURNIER [Thu, 23 Jul 2015 16:16:33 +0000 (18:16 +0200)] 
MINOR: Move http method enum from proto_http to sample

This is useful to prevent cross includes. The header file sample.h
needs to include proto_http, stick_tables.h will need to include
sample.h and proto_http includes stick_tables.h.

I choose to move the known http method define because this enum is
mainly used in sample.h. This enum is used for the sample type method.

9 years agoMINOR: vars: reduce the code size of some wrappers
Thierry FOURNIER [Tue, 28 Jul 2015 17:00:28 +0000 (19:00 +0200)] 
MINOR: vars: reduce the code size of some wrappers

Some function are just a wrappers. This patch reduce the size of
this wrapper for improving the readability. One check is moved
from the wrapper to the main function, and some middle vars are
removed.

9 years agoMINOR: proto_tcp: add session in the action prototype
Thierry FOURNIER [Mon, 10 Aug 2015 16:30:18 +0000 (18:30 +0200)] 
MINOR: proto_tcp: add session in the action prototype

Some actions require the "struct session" while the "struct stream" is not
avalaible. This patch adds a pointer to the session.

9 years agoBUG/MINOR: proto_tcp: custom action continue is ignored
Thierry FOURNIER [Tue, 11 Aug 2015 07:48:02 +0000 (09:48 +0200)] 
BUG/MINOR: proto_tcp: custom action continue is ignored

The custom action is ignored by 'tcp-request connection'. This patch
fix this behavior and take in account the value of the flag 'action'.

9 years agoCLEANUP: http/tcp actions: remove the scope member
Thierry FOURNIER [Tue, 11 Aug 2015 08:59:49 +0000 (10:59 +0200)] 
CLEANUP: http/tcp actions: remove the scope member

The scope member is not used. This patch removes this entry.

9 years agoCLEANUP: proto_http: remove useless initialisation
Thierry FOURNIER [Fri, 31 Jul 2015 06:42:38 +0000 (08:42 +0200)] 
CLEANUP: proto_http: remove useless initialisation

This initialisation of the opaque array is useless.

9 years agoDOC: add design thoughts on dynamic buffer allocation
Willy Tarreau [Thu, 30 Oct 2014 15:07:16 +0000 (16:07 +0100)] 
DOC: add design thoughts on dynamic buffer allocation

This is doc/design-thoughts/dynamic-buffers.txt.

9 years agoDOC: add some thoughts on connection sharing for HTTP/2
Willy Tarreau [Tue, 28 Oct 2014 14:58:25 +0000 (15:58 +0100)] 
DOC: add some thoughts on connection sharing for HTTP/2

This is doc/design-thoughts/connection-sharing.txt.

9 years agoDOC: add design thoughts on HTTP/2
Willy Tarreau [Thu, 23 Oct 2014 16:36:16 +0000 (18:36 +0200)] 
DOC: add design thoughts on HTTP/2

This is doc/design-thoughts/http2.txt.

9 years agoDOC: add doc/linux-syn-cookies.txt
Willy Tarreau [Wed, 20 Nov 2013 14:02:38 +0000 (15:02 +0100)] 
DOC: add doc/linux-syn-cookies.txt

This is an analysis of how kernel 3.10 decides to trigger SYN cookies.

9 years agoDOC: add doc/internals/entities-v2.txt
Willy Tarreau [Fri, 25 May 2012 22:18:09 +0000 (00:18 +0200)] 
DOC: add doc/internals/entities-v2.txt

This contains some thoughts about how to improve connection management
for 1.5 in order to support SSL.

9 years agoMEDIUM: config: emit a warning on a frontend without listener
Willy Tarreau [Tue, 11 Aug 2015 09:36:45 +0000 (11:36 +0200)] 
MEDIUM: config: emit a warning on a frontend without listener

Commit c6678e2 ("MEDIUM: config: authorize frontend and listen without bind")
completely removed the test for bind lines in frontends in order to make it
easier for automated tools to generate configs (eg: replacing a bind with
another one passing via a temporary config without any bind line). The
problem is that some common mistakes are totally hidden now. For example,
this apparently valid entry is silently ignored :

       listen 1.2.3.4:8000
           server s1 127.0.0.1:8000

Hint: 1.2.3.4:8000 is mistakenly the proxy name here.

Thus instead we now emit a warning to indicate that a frontend was found
with no listener. This should be backported to 1.5 to help spot abnormal
configurations.

9 years agoCLEANUP: .gitignore: finally ignore everything but what is known.
Willy Tarreau [Tue, 11 Aug 2015 09:21:47 +0000 (11:21 +0200)] 
CLEANUP: .gitignore: finally ignore everything but what is known.

Still too many files remain, it's easier to block everything but
what we know.

9 years agoCLEANUP: .gitignore: ignore more test files
Willy Tarreau [Tue, 11 Aug 2015 09:20:45 +0000 (11:20 +0200)] 
CLEANUP: .gitignore: ignore more test files

Exclude from "git status" many of the files that often result from
development tests and bug reports reproducers.

9 years agoDOC: remove documentation about appsession
Willy Tarreau [Mon, 10 Aug 2015 17:40:12 +0000 (19:40 +0200)] 
DOC: remove documentation about appsession

Some example of typical conversions would be helpful. Probably we need
to start from Aleks' proposals.

9 years agoCLEANUP: appsession: remove the last include files
Willy Tarreau [Mon, 10 Aug 2015 17:17:10 +0000 (19:17 +0200)] 
CLEANUP: appsession: remove the last include files

These ones were include/common/appsession.h and include/common/sessionhash.h.

9 years agoCLEANUP: proxy: remove last references to appsession
Willy Tarreau [Mon, 10 Aug 2015 17:15:14 +0000 (19:15 +0200)] 
CLEANUP: proxy: remove last references to appsession

The code entirely builds without using these elements, let's get rid
of them now.

9 years agoCLEANUP: tests: remove sessionhash_test.c and test-cookie-appsess.cfg
Willy Tarreau [Mon, 10 Aug 2015 17:12:52 +0000 (19:12 +0200)] 
CLEANUP: tests: remove sessionhash_test.c and test-cookie-appsess.cfg

These won't be usable anymore.

9 years agoCLEANUP: appsession: remove appsession.c and sessionhash.c
Willy Tarreau [Mon, 10 Aug 2015 17:10:52 +0000 (19:10 +0200)] 
CLEANUP: appsession: remove appsession.c and sessionhash.c

Now there's no more code using appsessions we can remove them.

9 years agoCLEANUP: config: remove appsession initialization
Willy Tarreau [Mon, 10 Aug 2015 17:04:29 +0000 (19:04 +0200)] 
CLEANUP: config: remove appsession initialization

Now it asks to check the documentation.

9 years agoMAJOR: http: remove references to appsession
Willy Tarreau [Mon, 10 Aug 2015 16:59:40 +0000 (18:59 +0200)] 
MAJOR: http: remove references to appsession

appsessions started to be deprecated with the introduction of stick
tables, and the latter are much more powerful and flexible, and in
addition they are replicated between nodes and maintained across
reloads. Let's now remove appsession completely.

9 years agoBUG/MEDIUM: lua: timeout error with converters, wrapper and actions.
Thierry FOURNIER [Sun, 9 Aug 2015 11:10:24 +0000 (13:10 +0200)] 
BUG/MEDIUM: lua: timeout error with converters, wrapper and actions.

test conf:

   global
      tune.lua.session-timeout 0
      lua-load lol.lua
      debug
      maxconn 4096

   listen test
   bind 0.0.0.0:10010
mode tcp
tcp-request content lua act_test
balance roundrobin
server test 127.0.0.1:3304

lua test:

   function act_test(txn)
      while true do
         core.Alert("TEST")
      end
   end

The function "act_test()" is not executed because a zero timeout is not
considered as TICK_ETERNITY, but is considered as 0.

This path fix this behavior. This is the same problem than the bugfix
685c014e99195d60db0a9cdbc6483f9c44fd0a67.

9 years agoMINOR: init: indicate to check 'bind' lines when no listeners were found.
Willy Tarreau [Sun, 9 Aug 2015 09:01:51 +0000 (11:01 +0200)] 
MINOR: init: indicate to check 'bind' lines when no listeners were found.

It used to still mention '<listen>'.

9 years agoDOC: mention that %ms is left-padded with zeroes.
Willy Tarreau [Sun, 9 Aug 2015 08:56:35 +0000 (10:56 +0200)] 
DOC: mention that %ms is left-padded with zeroes.

That's important to emit logs.

9 years agoBUG/MEDIUM: lua: Lua tasks fail to start.
Camilo Lopez [Sun, 2 Aug 2015 23:07:28 +0000 (19:07 -0400)] 
BUG/MEDIUM: lua: Lua tasks fail to start.

I've been trying out 1.6 dev3 with lua support, and trying to start
lua tasks seems to not be working.

Using this configuration

global
  lua-load /lua/lol.lua
  debug
  maxconn 4096

backend shard_b
  server db01 mysql_shard_b:3306

backend shard_a
  server db01 mysql_shard_a:3306

listen mysql-cluster
  bind 0.0.0.0:8001
  mode tcp
  balance roundrobin
  use_backend shard_b

And this lua function

  core.register_task(function()
    while true do
      core.Alert("LOLOLOLOLOL")
    end
  end)

I'd always get a timeout error starting the registered function.

The problem lies as far as I can tell in the fact that is possible for
now_ms to not change (is this maybe a problem on my config/system?)
until the expiration check happens, in the resume function that
actually kickstarts the lua task, making HAProxy think that expiration
time for the task is up, if I understand correctly tasks are meant to
never really timeout.

9 years agoMINOR: log: Add log-format variable %HQ, to log HTTP query strings
Andrew Hayworth [Fri, 31 Jul 2015 16:14:16 +0000 (16:14 +0000)] 
MINOR: log: Add log-format variable %HQ, to log HTTP query strings

Since sample fetches are not always available in the response phase,
this patch implements %HQ such that:

  GET /foo?bar=baz HTTP/1.0

...would be logged as:

  ?bar=baz

9 years agoMINOR: server: add new SRV_ADMF_CMAINT flag
Baptiste Assmann [Sat, 8 Aug 2015 13:49:13 +0000 (15:49 +0200)] 
MINOR: server: add new SRV_ADMF_CMAINT flag

The purpose of SRV_ADMF_CMAINT flag is to keep in mind the server was
forced to maintenance status because of the configuration file.

9 years agoBUG/MEDIUM: DNS resolution response parsing broken
Baptiste Assmann [Fri, 7 Aug 2015 09:24:05 +0000 (11:24 +0200)] 
BUG/MEDIUM: DNS resolution response parsing broken

In some cases, parsing of the DNS response is broken and the response is
considered as invalid, despite being valid.

The current patch fixes this issue. It's a temporary solution until I
rework the response parsing to store the response buffer into a real DNS
packet structure.

9 years agoMINOR: DNS counters: increment valid counter
Baptiste Assmann [Fri, 7 Aug 2015 08:18:32 +0000 (10:18 +0200)] 
MINOR: DNS counters: increment valid counter

Valid counter was never incremented.
Now it is.

9 years agoMINOR: 51d: unable to start haproxy without "51degrees-data-file"
Dragan Dosen [Fri, 7 Aug 2015 14:41:23 +0000 (16:41 +0200)] 
MINOR: 51d: unable to start haproxy without "51degrees-data-file"

This patch adds a few checks on "global._51degrees.data_file_path" and allows
haproxy to start even when the pattern or trie data file is not specified.

If the "51d" converter is used, a new function "_51d_conv_check" will check
"global._51degrees.data_file_path" and displays a warning if necessary.

In src/haproxy.c, the global 51Degrees "cache_size" has moved outside of the
FIFTYONEDEGREES_H_PATTERN_INCLUDED ifdef block.

9 years agoDOC: internals: document next steps for HTTP connection reuse
Willy Tarreau [Thu, 6 Aug 2015 13:31:23 +0000 (15:31 +0200)] 
DOC: internals: document next steps for HTTP connection reuse

This is mostly based on the design notes and experiments that were
not turned into final code yet.

9 years agoDOC: document the new http-reuse directive
Willy Tarreau [Thu, 6 Aug 2015 13:05:24 +0000 (15:05 +0200)] 
DOC: document the new http-reuse directive

This documents the 4 strategies : never, safe, aggressive, always.

9 years agoMEDIUM: backend: add the "http-reuse aggressive" strategy
Willy Tarreau [Wed, 5 Aug 2015 15:16:33 +0000 (17:16 +0200)] 
MEDIUM: backend: add the "http-reuse aggressive" strategy

This strategy is less extreme than "always", it only dispatches first
requests to validated reused connections, and moves a connection from
the idle list to the safe list once it has seen a second request, thus
proving that it could be reused.

9 years agoMINOR: server: add a list of safe, already reused idle connections
Willy Tarreau [Wed, 5 Aug 2015 14:35:23 +0000 (16:35 +0200)] 
MINOR: server: add a list of safe, already reused idle connections

These ones are considered safe as they have already been reused.
They will be useful in "aggressive" and "always" http-reuse modes
in order to place the first request of a connection with the least
risk.

9 years agoMEDIUM: backend: implement "http-reuse safe"
Willy Tarreau [Wed, 5 Aug 2015 14:02:46 +0000 (16:02 +0200)] 
MEDIUM: backend: implement "http-reuse safe"

The "safe" mode consists in picking existing connections only when
processing a request that's not the first one from a connection. This
ensures that in case where the server finally times out and closes, the
client can decide to replay idempotent requests.

9 years agoMAJOR: backend: improve the connection reuse mechanism
Willy Tarreau [Thu, 6 Aug 2015 09:37:10 +0000 (11:37 +0200)] 
MAJOR: backend: improve the connection reuse mechanism

Now instead of closing the existing connection attached to the
stream interface, we first check if the one we pick was attached to
another stream interface, in which case the connections are swapped
if possible (eg: if the current connection is not private). That way
the previous connection remains attached to an existing session and
significantly increases the chances of being reused.

9 years agoMAJOR: backend: initial work towards connection reuse
Willy Tarreau [Tue, 4 Aug 2015 18:45:52 +0000 (20:45 +0200)] 
MAJOR: backend: initial work towards connection reuse

In connect_server(), if we don't have a connection attached to the
stream-int, we first look into the server's idle_conns list and we
pick the first one there, we detach it from its owner if it had one.
If we used to have a connection, we close it.

This mechanism works well but doesn't scale : as servers increase,
the likeliness that the connection attached to the stream interface
doesn't match the server and gets closed increases.

9 years agoMINOR: config: add new setting "http-reuse"
Willy Tarreau [Wed, 5 Aug 2015 12:12:31 +0000 (14:12 +0200)] 
MINOR: config: add new setting "http-reuse"

For now it only supports "never", meaning that we never want to reuse a
shared connection, and "always", meaning that we can use any connection
that was not marked private. When "never" is set, this also implies that
no idle connection may become a shared one.

9 years agoMINOR: connection: add a new flag CO_FL_PRIVATE
Willy Tarreau [Tue, 4 Aug 2015 17:24:13 +0000 (19:24 +0200)] 
MINOR: connection: add a new flag CO_FL_PRIVATE

This flag is set on an outgoing connection when this connection gets
some properties that must not be shared with other connections, such
as dynamic transparent source binding, SNI or a proxy protocol header,
or an authentication challenge from the server. This will be needed
later to implement connection reuse.

9 years agoMINOR: server: add a list of already used idle connections
Willy Tarreau [Wed, 5 Aug 2015 08:31:57 +0000 (10:31 +0200)] 
MINOR: server: add a list of already used idle connections

There's a difference with the other idle conns in that these new
ones have already been used and may be reused by other streams.

9 years agoMINOR: stream-int: make si_idle_conn() only accept valid connections
Willy Tarreau [Wed, 5 Aug 2015 09:08:30 +0000 (11:08 +0200)] 
MINOR: stream-int: make si_idle_conn() only accept valid connections

This function is now dedicated to idle connections only, which means
that it must not be used without any endpoint nor anything not a
connection. The connection remains attached to the stream interface.

9 years agoMEDIUM: stream-int: queue idle connections at the server
Willy Tarreau [Tue, 4 Aug 2015 17:00:17 +0000 (19:00 +0200)] 
MEDIUM: stream-int: queue idle connections at the server

Now we get a per-server list of all idle connections. That way we'll
be able to reclaim them upon shortage later.

9 years agoMINOR: connection: add a new list member in the connection struct
Willy Tarreau [Tue, 4 Aug 2015 15:25:58 +0000 (17:25 +0200)] 
MINOR: connection: add a new list member in the connection struct

This list member will be used to attach a connection to a list of
idle, reusable or queued connections. It's unused for now. Given
that it's not expected to be used more than a few times per session,
the member was put after the target, in the area starting at the
second cache line of the structure.

9 years agoMINOR: server: add a list of private idle connections
Willy Tarreau [Tue, 4 Aug 2015 15:19:06 +0000 (17:19 +0200)] 
MINOR: server: add a list of private idle connections

For now it's not populated but we have the list entry. It will carry
all idle connections that sessions don't want to share. They may be
used later to reclaim connections upon socket shortage for example.

9 years agoMINOR: stream-int: add new function si_detach_endpoint()
Willy Tarreau [Tue, 4 Aug 2015 18:44:05 +0000 (20:44 +0200)] 
MINOR: stream-int: add new function si_detach_endpoint()

This function only detaches the endpoint from the stream-int and
optionally returns the original pointer. This will be needed to
steal idle connections from other connections.

9 years agoMEDIUM: stream-int: simplify si_alloc_conn()
Willy Tarreau [Wed, 5 Aug 2015 19:47:23 +0000 (21:47 +0200)] 
MEDIUM: stream-int: simplify si_alloc_conn()

Since we now always call this function with the reuse parameter cleared,
let's simplify the function's logic as it cannot return the existing
connection anymore. The savings on this inline function are appreciable
(240 bytes) :

$ size haproxy.old haproxy.new
   text    data     bss     dec     hex filename
1020383   40816   36928 1098127  10c18f haproxy.old
1020143   40816   36928 1097887  10c09f haproxy.new

9 years agoMEDIUM: backend: don't call si_alloc_conn() when we reuse a valid connection
Willy Tarreau [Tue, 4 Aug 2015 17:45:36 +0000 (19:45 +0200)] 
MEDIUM: backend: don't call si_alloc_conn() when we reuse a valid connection

connect_server() already does most of the check that is done again in
si_alloc_conn(), so let's simply reuse the existing connection instead
of calling the function again. It will also simplify the connection
reuse.

Indeed, for reuse to be set, it also requires srv_conn to be valid. In the
end, the only situation where we have to release the existing connection
and allocate a new one is when reuse == 0.

9 years agoCLEANUP: backend: factor out objt_server() in connect_server()
Willy Tarreau [Tue, 4 Aug 2015 17:34:21 +0000 (19:34 +0200)] 
CLEANUP: backend: factor out objt_server() in connect_server()

objt_server() is called multiple times at various places while some
places already make use of srv for this. Let's move the call at the
top of the function and use it all over the place.

9 years agoDOC: resolve-prefer default value and default-server update
Baptiste Assmann [Tue, 4 Aug 2015 20:43:06 +0000 (22:43 +0200)] 
DOC: resolve-prefer default value and default-server update

By the code, resolve-prefer defaults to IPv6 and is also available in
the default-server directive.
These information were missing or wrong in the documentation.

9 years agoDOC: typos in tcp-check expect examples
Baptiste Assmann [Tue, 4 Aug 2015 08:12:18 +0000 (10:12 +0200)] 
DOC: typos in tcp-check expect examples

The match keyword 'string' was missing in a few tcp-check expect example
statements.

9 years agoDOC: typo in 'redirect', 302 code meaning
Baptiste Assmann [Mon, 3 Aug 2015 09:42:50 +0000 (11:42 +0200)] 
DOC: typo in 'redirect', 302 code meaning

302 means a temprary move, not a permanent one

9 years agoDOC/MINOR: fix OpenBSD versions where haproxy works
Daniel Jakots [Wed, 29 Jul 2015 06:03:08 +0000 (08:03 +0200)] 
DOC/MINOR: fix OpenBSD versions where haproxy works

9 years agoMINOR: stream: initialize the current_rule field to NULL on stream init
Remi Gacogne [Wed, 22 Jul 2015 15:10:58 +0000 (17:10 +0200)] 
MINOR: stream: initialize the current_rule field to NULL on stream init

Currently it is possible for the current_rule field to be evaluated before
being set, leading to valgrind complaining:

==16783== Conditional jump or move depends on uninitialised value(s)
==16783==    at 0x44E662: http_res_get_intercept_rule (proto_http.c:3730)
==16783==    by 0x44E662: http_process_res_common (proto_http.c:6528)
==16783==    by 0x4797B7: process_stream (stream.c:1851)
==16783==    by 0x414634: process_runnable_tasks (task.c:238)
==16783==    by 0x40B02F: run_poll_loop (haproxy.c:1528)
==16783==    by 0x407F25: main (haproxy.c:1887)

This was introduced by commit 152b81e7b2565862956af883820d4f79177d0651.

9 years agoBUILD: ssl: Allow building against libssl without SSLv3.
Jérémie Courrèges-Anglas [Sat, 25 Jul 2015 22:50:52 +0000 (16:50 -0600)] 
BUILD: ssl: Allow building against libssl without SSLv3.

If SSLv3 is explicitely requested but not available, warn the user and
bail out.

9 years agoBUILD: link with libdl if needed for Lua support
Vincent Bernat [Thu, 16 Jul 2015 18:52:51 +0000 (20:52 +0200)] 
BUILD: link with libdl if needed for Lua support

On platforms where the dl*() functions are not part of the libc, a
program linking Lua also needs to link to libdl.

Moreover, on platforms using a gold linker with the --as-needed flag,
the libdl library needs to be linked after linking Lua, otherwise, it
won't be marked as needed and will be discarded and its symbols won't be
present at the end of the linking phase.

Ubuntu enables the --as-needed flag by default. Other distributions may
advertise its use, like Gentoo.

9 years agoBUG/MEDIUM: mailer: DATA part must be terminated with <CRLF>.<CRLF>
Pieter Baauw [Wed, 22 Jul 2015 17:51:54 +0000 (19:51 +0200)] 
BUG/MEDIUM: mailer: DATA part must be terminated with <CRLF>.<CRLF>

The dot is send in the wrong place.
As defined in https://www.ietf.org/rfc/rfc2821.txt 'the character sequence "<CRLF>.<CRLF>" ends the mail text'

9 years ago[RELEASE] Released version 1.6-dev3 v1.6-dev3
Willy Tarreau [Wed, 22 Jul 2015 15:32:56 +0000 (17:32 +0200)] 
[RELEASE] Released version 1.6-dev3

Released version 1.6-dev3 with the following main changes :
    - CLEANUP: sample: generalize sample_fetch_string() as sample_fetch_as_type()
    - MEDIUM: http: Add new 'set-src' option to http-request
    - DOC usesrc root privileges requirments
    - BUG/MINOR: dns: wrong time unit for some DNS default parameters
    - MINOR: proxy: bit field for proxy_find_best_match diff status
    - MINOR: server: new server flag: SRV_F_FORCED_ID
    - MINOR: server: server_find functions: id, name, best_match
    - DOC: dns: fix chapters syntax
    - BUILD/MINOR: tools: rename popcount to my_popcountl
    - BUILD: add netbsd TARGET
    - MEDIUM: 51Degrees code refactoring and cleanup
    - MEDIUM: 51d: add LRU-based cache on User-Agent string detection
    - DOC: add notes about the "51degrees-cache-size" parameter
    - BUG/MEDIUM: 51d: possible incorrect operations on smp->data.str.str
    - BUG/MAJOR: connection: fix TLV offset calculation for proxy protocol v2 parsing
    - MINOR: Add sample fetch to detect Supported Elliptic Curves Extension
    - BUG/MINOR: payload: Add volatile flag to smp_fetch_req_ssl_ec_ext
    - BUG/MINOR: lua: type error in the arguments wrapper
    - CLEANUP: vars: remove unused struct
    - BUG/MINOR: http/sample: gmtime/localtime can fail
    - MINOR: standard: add 64 bits conversion functions
    - MAJOR: sample: converts uint and sint in 64 bits signed integer
    - MAJOR: arg: converts uint and sint in sint
    - MEDIUM: sample: switch to saturated arithmetic
    - MINOR: vars: returns variable content
    - MEDIUM: vars/sample: operators can use variables as parameter
    - BUG/MINOR: ssl: fix smp_fetch_ssl_fc_session_id
    - BUILD/MINOR: lua: fix a harmless build warning
    - BUILD/MINOR: stats: fix build warning due to condition always true
    - BUG/MAJOR: lru: fix unconditional call to free due to unexpected semi-colon
    - BUG/MEDIUM: logs: fix improper systematic use of quotes with a few tags
    - BUILD/MINOR: lua: ensure that hlua_ctx_destroy is properly defined
    - BUG/MEDIUM: lru: fix possible memory leak when ->free() is used
    - MINOR: vars: make the accounting not depend on the stream
    - MEDIUM: vars: move the session variables to the session, not the stream
    - BUG/MEDIUM: vars: do not freeze the connection when the expression cannot be fetched
    - BUG/MAJOR: buffers: make the buffer_slow_realign() function respect output data
    - BUG/MAJOR: tcp: tcp rulesets were still broken
    - MINOR: stats: improve compression stats reporting
    - MINOR: ssl: make self-generated certs also work with raw IPv6 addresses
    - CLEANUP: ssl: make ssl_sock_generated_cert_serial() take a const
    - CLEANUP: ssl: make ssl_sock_generate_certificate() use ssl_sock_generated_cert_serial()
    - BUG/MINOR: log: missing some ARGC_* entries in fmt_directives()
    - MINOR: args: add new context for servers
    - MINOR: stream: maintain consistence between channel_forward and HTTP forward
    - MINOR: ssl: provide ia function to set the SNI extension on a connection
    - MEDIUM: ssl: add sni support on the server lines
    - CLEANUP: stream: remove a useless call to si_detach()
    - CLEANUP: stream-int: fix a few outdated comments about stream_int_register_handler()
    - CLEANUP: stream-int: remove stream_int_unregister_handler() and si_detach()
    - MINOR: stream-int: only use si_release_endpoint() to release a connection
    - MINOR: standard: provide htonll() and ntohll()
    - CLEANUP/MINOR: dns: dns_str_to_dn_label() only needs a const char
    - BUG/MAJOR: dns: fix the length of the string to be copied