]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
9 years agoMINOR: config: allow IPv6 bracketed literals
mildis [Mon, 26 Oct 2015 17:50:08 +0000 (18:50 +0100)] 
MINOR: config: allow IPv6 bracketed literals

9 years agoDOC: deviceatlas: more example use cases.
David Carlier [Wed, 28 Oct 2015 11:08:15 +0000 (11:08 +0000)] 
DOC: deviceatlas: more example use cases.

In addition of adding additional headers examples, some examples of
defining an ACL.

9 years agoBUG/MINOR: examples/haproxy.init: missing brace in quiet_check()
jesse.defer@asu.edu [Sun, 1 Nov 2015 03:29:56 +0000 (20:29 -0700)] 
BUG/MINOR: examples/haproxy.init: missing brace in quiet_check()

There is a missing curly brace in the quiet_check function of the example
init script.

[note: This needs to be backported to 1.6]

9 years agoBUG/MINOR: dns: unable to parse CNAMEs response
Baptiste Assmann [Wed, 28 Oct 2015 01:10:02 +0000 (02:10 +0100)] 
BUG/MINOR: dns: unable to parse CNAMEs response

A bug lied in the parsing of DNS CNAME response, leading HAProxy to
think the CNAME was improperly resolved in the response.

This should be backported into 1.6 branch

9 years agoBUG/MAJOR: dns: first DNS response packet not matching queried hostname may lead...
Baptiste Assmann [Wed, 28 Oct 2015 01:03:32 +0000 (02:03 +0100)] 
BUG/MAJOR: dns: first DNS response packet not matching queried hostname may lead to a loop

The status DNS_UPD_NAME_ERROR returned by dns_get_ip_from_response and
which means the queried name can't be found in the response was
improperly processed (fell into the default case).
This lead to a loop where HAProxy simply resend a new query as soon as
it got a response for this status and in the only case where such type
of response is the very first one received by the process.

This should be backported into 1.6 branch

9 years agoBUG/MEDIUM: config: count memory limits on 64 bits, not 32
Willy Tarreau [Thu, 29 Oct 2015 09:42:55 +0000 (10:42 +0100)] 
BUG/MEDIUM: config: count memory limits on 64 bits, not 32

It was accidently discovered that limiting haproxy to 5000 MB leads to
an effective limit of 904 MB. This is because the computation for the
size limit is performed by multiplying rlimit_memmax by 1048576, and
doing so causes the operation to be performed on an int instead of a
long or long long. Just switch to 1048576ULL as is done at other places
to fix this.

This bug affects all supported versions, the backport is desired, though
it rarely affects users since few people apply memory limits.

9 years agoMEDIUM: memory: add accounting for failed allocations
Willy Tarreau [Wed, 28 Oct 2015 15:24:21 +0000 (16:24 +0100)] 
MEDIUM: memory: add accounting for failed allocations

We now keep a per-pool counter of failed memory allocations and
we report that, as well as the amount of memory allocated and used
on the CLI.

9 years agoDEBUG/MEDIUM: memory: add optional control pool memory operations
Willy Tarreau [Wed, 28 Oct 2015 14:23:51 +0000 (15:23 +0100)] 
DEBUG/MEDIUM: memory: add optional control pool memory operations

When DEBUG_MEMORY_POOLS is used, we now use the link pointer at the end
of the pool to store a pointer to the pool, and to control it during
pool_free2() in order to serve four purposes :
  - at any instant we can know what pool an object was allocated from
    when examining memory, hence how we should possibly decode it ;

  - it serves to detect double free when they happen, as the pointer
    cannot be valid after the element is linked into the pool ;

  - it serves to detect if an element is released in the wrong pool ;

  - it serves as a canary, to detect if some buffers experienced an
    overflow before being release.

All these elements will definitely help better troubleshoot strange
situations, or at least confirm that certain conditions did not happen.

9 years agoDEBUG/MEDIUM: memory: optionally protect free data in pools
Willy Tarreau [Wed, 28 Oct 2015 14:09:29 +0000 (15:09 +0100)] 
DEBUG/MEDIUM: memory: optionally protect free data in pools

When debugging a core file, it's sometimes convenient to be able to
visit the released entries in the pools (typically last released
session). Unfortunately the first bytes of these entries are destroyed
by the link elements of the pool. And of course, most structures have
their most accessed elements at the beginning of the structure (typically
flags). Let's add a build-time option DEBUG_MEMORY_POOLS which allocates
an extra pointer in each pool to put the link at the end of each pool
item instead of the beginning.

9 years agoDEBUG/MINOR: memory: add a build option to disable memory pools sharing
Willy Tarreau [Wed, 28 Oct 2015 11:04:02 +0000 (12:04 +0100)] 
DEBUG/MINOR: memory: add a build option to disable memory pools sharing

Sometimes analysing a core file isn't easy due to shared memory pools.
Let's add a build option to disable this. It's not enabled by default,
it could be backported to older versions.

9 years agoMINOR: cli: ability to set per-server maxconn
Andrew Hayworth [Tue, 27 Oct 2015 21:46:25 +0000 (21:46 +0000)] 
MINOR: cli: ability to set per-server maxconn

This commit adds support for setting a per-server maxconn from the stats
socket. The only really notable part of this commit is that we need to
check if maxconn == minconn before changing things, as this indicates
that we are NOT using dynamic maxconn. When we are not using dynamic
maxconn, we should update maxconn/minconn in lockstep.

9 years agoFIX: small typo in an example using the "Referer" header
Cyril Bonté [Mon, 26 Oct 2015 21:37:39 +0000 (22:37 +0100)] 
FIX: small typo in an example using the "Referer" header

It was reported that an example was manipulating a "Referrer" header instead
of the known "Referer" one. Even if it's an example wich doesn't break things,
the typo can be fixed.

The fix should be backported in 1.4/1.5/1.6 branches.

9 years agoDOC: fix a typo for a "deviceatlas" keyword
Cyril Bonté [Mon, 26 Oct 2015 21:37:38 +0000 (22:37 +0100)] 
DOC: fix a typo for a "deviceatlas" keyword

The global keyword 'deviceatlas-properties-cookie' was miswritten.

This typo should also be backported to the 1.6 branch.

9 years agoBUILD: ssl: fix build error introduced in commit 7969a3 with OpenSSL < 1.0.0
Christopher Faulet [Mon, 19 Oct 2015 11:59:24 +0000 (13:59 +0200)] 
BUILD: ssl: fix build error introduced in commit 7969a3 with OpenSSL < 1.0.0

The function 'EVP_PKEY_get_default_digest_nid()' was introduced in OpenSSL
1.0.0. So for older version of OpenSSL, compiled with the SNI support, the
HAProxy compilation fails with the following error:

src/ssl_sock.c: In function 'ssl_sock_do_create_cert':
src/ssl_sock.c:1096:7: warning: implicit declaration of function 'EVP_PKEY_get_default_digest_nid'
   if (EVP_PKEY_get_default_digest_nid(capkey, &nid) <= 0)
[...]
src/ssl_sock.c:1096: undefined reference to `EVP_PKEY_get_default_digest_nid'
collect2: error: ld returned 1 exit status
Makefile:760: recipe for target 'haproxy' failed
make: *** [haproxy] Error 1

So we must add a #ifdef to check the OpenSSL version (>= 1.0.0) to use this
function. It is used to get default signature digest associated to the private
key used to sign generated X509 certificates. It is called when the private key
differs than EVP_PKEY_RSA, EVP_PKEY_DSA and EVP_PKEY_EC. It should be enough for
most of cases.

9 years agoMEDIUM: dns: Don't use the ANY query type
Andrew Hayworth [Mon, 19 Oct 2015 22:29:51 +0000 (22:29 +0000)] 
MEDIUM: dns: Don't use the ANY query type

Basically, it's ill-defined and shouldn't really be used going forward.
We can't guarantee that resolvers will do the 'legwork' for us and
actually resolve CNAMES when we request the ANY query-type. Case in point
(obfuscated, clearly):

  PRODUCTION! ahayworth@secret-hostname.com:~$
  dig @10.11.12.53 ANY api.somestartup.io

  ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @10.11.12.53 ANY api.somestartup.io
  ; (1 server found)
  ;; global options: +cmd
  ;; Got answer:
  ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62454
  ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0

  ;; QUESTION SECTION:
  ;api.somestartup.io.                        IN      ANY

  ;; ANSWER SECTION:
  api.somestartup.io.         20      IN      CNAME api-somestartup-production.ap-southeast-2.elb.amazonaws.com.

  ;; AUTHORITY SECTION:
  somestartup.io.               166687  IN      NS      ns-1254.awsdns-28.org.
  somestartup.io.               166687  IN      NS      ns-1884.awsdns-43.co.uk.
  somestartup.io.               166687  IN      NS      ns-440.awsdns-55.com.
  somestartup.io.               166687  IN      NS      ns-577.awsdns-08.net.

  ;; Query time: 1 msec
  ;; SERVER: 10.11.12.53#53(10.11.12.53)
  ;; WHEN: Mon Oct 19 22:02:29 2015
  ;; MSG SIZE  rcvd: 242

HAProxy can't handle that response correctly.

Rather than try to build in support for resolving CNAMEs presented
without an A record in an answer section (which may be a valid
improvement further on), this change just skips ANY record types
altogether. A and AAAA are much more well-defined and predictable.

Notably, this commit preserves the implicit "Prefer IPV6 behavior."

Furthermore, ANY query type by default is a bad idea: (from Robin on
HAProxy's ML):
  Using ANY queries for this kind of stuff is considered by most people
  to be a bad practice since besides all the things you named it can
  lead to incomplete responses. Basically a resolver is allowed to just
  return whatever it has in cache when it receives an ANY query instead
  of actually doing an ANY query at the authoritative nameserver. Thus
  if it only received queries for an A record before you do an ANY query
  you will not get an AAAA record even if it is actually available since
  the resolver doesn't have it in its cache. Even worse if before it
  only got MX queries, you won't get either A or AAAA

9 years agoBUG/MAJOR: ssl: free the generated SSL_CTX if the LRU cache is disabled
Willy Tarreau [Tue, 20 Oct 2015 13:16:01 +0000 (15:16 +0200)] 
BUG/MAJOR: ssl: free the generated SSL_CTX if the LRU cache is disabled

Kim Seri reported that haproxy 1.6.0 crashes after a few requests
when a bind line has SSL enabled with more than one certificate. This
was caused by an insufficient condition to free generated certs during
ssl_sock_close() which can also catch other certs.

Christopher Faulet analysed the situation like this :

-------
First the LRU tree is only initialized when the SSL certs generation is
configured on a bind line. So, in the most of cases, it is NULL (it is
not the same thing than empty).
When the SSL certs generation is used, if the cache is not NULL, a such
certificate is pushed in the cache and there is no need to release it
when the connection is closed.
But it can be disabled in the configuration. So in that case, we must
free the generated certificate when the connection is closed.

Then here, we have really a bug. Here is the buggy part:

3125)      if (conn->xprt_ctx) {
3126) #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
3127)              if (!ssl_ctx_lru_tree && objt_listener(conn->target)) {
3128)                      SSL_CTX *ctx = SSL_get_SSL_CTX(conn->xprt_ctx);
3129)                      if (ctx != 3130)
 SSL_CTX_free(ctx);
3131)              }
3133)              SSL_free(conn->xprt_ctx);
3134)              conn->xprt_ctx = NULL;
3135)              sslconns--;
3136)      }

The check on the line 3127 is not enough to determine if this is a
generated certificate or not. Because ssl_ctx_lru_tree is NULL,
generated certificates, if any, must be freed. But here ctx should also
be compared to all SNI certificates and not only to default_ctx. Because
of this bug, when a SNI certificate is used for a connection, it is
erroneously freed when this connection is closed.
-------

Christopher provided this reliable reproducer :

----------
global
    tune.ssl.default-dh-param   2048
    daemon

listen ssl_server
    mode tcp
    bind 127.0.0.1:4443 ssl crt srv1.test.com.pem crt srv2.test.com.pem

    timeout connect 5000
    timeout client  30000
    timeout server  30000

    server srv A.B.C.D:80

You just need to generate 2 SSL certificates with 2 CN (here
srv1.test.com and srv2.test.com).

Then, by doing SSL requests with the first CN, there is no problem. But
with the second CN, it should segfault on the 2nd request.

openssl s_client -connect 127.0.0.1:4443 -servername srv1.test.com // OK
openssl s_client -connect 127.0.0.1:4443 -servername srv1.test.com // OK

But,

openssl s_client -connect 127.0.0.1:4443 -servername srv2.test.com // OK
openssl s_client -connect 127.0.0.1:4443 -servername srv2.test.com // KO
-----------

A long discussion led to the following proposal which this patch implements :

- the cert is generated. It gets a refcount = 1.
- we assign it to the SSL. Its refcount becomes two.
- we try to insert it into the tree. The tree will handle its freeing
  using SSL_CTX_free() during eviction.
- if we can't insert into the tree because the tree is disabled, then
  we have to call SSL_CTX_free() ourselves, then we'd rather do it
  immediately. It will more closely mimmick the case where the cert
  is added to the tree and immediately evicted by concurrent activity
  on the cache.
- we never have to call SSL_CTX_free() during ssl_sock_close() because
  the SSL session only relies on openssl doing the right thing based on
  the refcount only.
- thus we never need to know how the cert was created since the
  SSL_CTX_free() is either guaranteed or already done for generated
  certs, and this protects other ones against any accidental call to
  SSL_CTX_free() without having to track where the cert comes from.

This patch also reduces the inter-dependence between the LRU tree and
the SSL stack, so it should cause less sweating to migrate to threads
later.

This bug is specific to 1.6.0, as it was introduced after dev7 by
this fix :

   d2cab92 ("BUG/MINOR: ssl: fix management of the cache where forged certificates are stored")

Thus a backport to 1.6 is required, but not to 1.5.

9 years agoBUG/MEDIUM: namespaces: don't fail if no namespace is used
Willy Tarreau [Tue, 20 Oct 2015 13:14:07 +0000 (15:14 +0200)] 
BUG/MEDIUM: namespaces: don't fail if no namespace is used

Susheel Jalali reported a confusing bug in namespaces implementation.
If namespaces are enabled at build time (USE_NS=1) and *no* namespace
is used at all in the whole config file, my_socketat() returns -1 and
all socket bindings fail. This is because of a wrong condition in this
function. A possible workaround consists in creating some namespaces.

9 years agoBUG/MINOR: dns: parsing error of some DNS response
Baptiste Assmann [Thu, 15 Oct 2015 13:23:28 +0000 (15:23 +0200)] 
BUG/MINOR: dns: parsing error of some DNS response

The function which parses a DNS response buffer did not move properly a
pointer when reading a packet where records does not use DNS "message
compression" techniques.

Thanks to 0yvind Johnsen for the help provided during the troubleshooting
session.

9 years agoCLEANUP: don't ignore debian/ directory if present
Vincent Bernat [Wed, 14 Oct 2015 19:43:58 +0000 (21:43 +0200)] 
CLEANUP: don't ignore debian/ directory if present

This makes packaging with git tools easier as it is not possible to
cancel anything in debian/.gitignore since the whole directory is
ignored.

9 years agoBUILD: install only relevant and existing documentation
Vincent Bernat [Tue, 13 Oct 2015 20:20:55 +0000 (22:20 +0200)] 
BUILD: install only relevant and existing documentation

doc/haproxy-{en,fr}.txt have been removed recently but they were still
referenced in the Makefile. Many other documents have also been
added. Instead of hard-coding a list of documents to install, install
all those in doc/ with some exceptions:

 - coding-style.txt is more for developers
 - gpl.txt and lgpl.txt are usually present at other places (and I would
   have to remove them in the Debian packaging, less work for me)

The documentation in the subdirectories is not installed as it is more
targeted to developers.

9 years agoDOC: specify that stats socket doc (section 9.2) is in management
Kevin Decherf [Tue, 13 Oct 2015 21:26:44 +0000 (23:26 +0200)] 
DOC: specify that stats socket doc (section 9.2) is in management

Commit 44aed90ce102c4136a5eda66d541f6fa79e141e8 moved the stats socket
documentation from config to management but the remaining references to
section 9.2 were not updated; improve it to be less confusing.

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
9 years ago[RELEASE] Released version 1.7-dev0 v1.7-dev0
Willy Tarreau [Tue, 13 Oct 2015 19:48:10 +0000 (21:48 +0200)] 
[RELEASE] Released version 1.7-dev0

Released version 1.7-dev0 with the following main changes :
    - exact copy of 1.6.0

9 years ago[RELEASE] Released version 1.6.0 v1.6.0
Willy Tarreau [Tue, 13 Oct 2015 16:52:22 +0000 (18:52 +0200)] 
[RELEASE] Released version 1.6.0

Released version 1.6.0 with the following main changes :
    - BUG/MINOR: Handle interactive mode in cli handler
    - DOC: global section missing parameters
    - DOC: backend section missing parameters
    - DOC: stats paramaters available in frontend
    - MINOR: lru: do not allocate useless memory in lru64_lookup
    - BUG/MINOR: http: Add OPTIONS in supported http methods (found by find_http_meth)
    - BUG/MINOR: ssl: fix management of the cache where forged certificates are stored
    - MINOR: ssl: Release Servers SSL context when HAProxy is shut down
    - MINOR: ssl: Read the file used to generate certificates in any order
    - MINOR: ssl: Add support for EC for the CA used to sign generated certificates
    - MINOR: ssl: Add callbacks to set DH/ECDH params for generated certificates
    - BUG/MEDIUM: logs: fix time zone offset format in RFC5424
    - BUILD: Fix the build on OSX (htonll/ntohll)
    - BUILD: enable build on Linux/s390x
    - BUG/MEDIUM: lua: direction test failed
    - MINOR: lua: fix a spelling error in some error messages
    - CLEANUP: cli: ensure we can never double-free error messages
    - BUG/MEDIUM: lua: force server-close mode on Lua services
    - MEDIUM: init: support more command line arguments after pid list
    - MEDIUM: init: support a list of files on the command line
    - MINOR: debug: enable memory poisonning to use byte 0
    - BUILD: ssl: fix build error introduced by recent commit
    - BUG/MINOR: config: make the stats socket pass the correct proxy to the parsers
    - MEDIUM: server: implement TCP_USER_TIMEOUT on the server
    - DOC: mention the "namespace" options for bind and server lines
    - DOC: add the "management" documentation
    - DOC: move the stats socket documentation from config to management
    - MINOR: examples: update haproxy.spec to mention new docs
    - DOC: mention management.txt in README
    - DOC: remove haproxy-{en,fr}.txt
    - BUILD: properly report when USE_ZLIB and USE_SLZ are used together
    - MINOR: init: report use of libslz instead of "no compression"
    - CLEANUP: examples: remove some obsolete and confusing files
    - CLEANUP: examples: remove obsolete configuration file samples
    - CLEANUP: examples: fix the example file content-sw-sample.cfg
    - CLEANUP: examples: update sample file option-http_proxy.cfg
    - CLEANUP: examples: update sample file ssl.cfg
    - CLEANUP: tests: move a test file from examples/ to tests/
    - CLEANUP: examples: shut up warnings in transparent proxy example
    - CLEANUP: tests: removed completely obsolete test files
    - DOC: update ROADMAP to remove what was done in 1.6
    - BUG/MEDIUM: pattern: fixup use_after_free in the pat_ref_delete_by_id

9 years agoDOC: update ROADMAP to remove what was done in 1.6
Willy Tarreau [Tue, 13 Oct 2015 16:38:15 +0000 (18:38 +0200)] 
DOC: update ROADMAP to remove what was done in 1.6

9 years agoBUG/MEDIUM: pattern: fixup use_after_free in the pat_ref_delete_by_id
peter cai [Wed, 7 Oct 2015 07:07:43 +0000 (00:07 -0700)] 
BUG/MEDIUM: pattern: fixup use_after_free in the pat_ref_delete_by_id

I found there is use_after_free bug in the pat_ref_delete_by_id.

[wt: it seems this fix must be backported to 1.5 as well]

9 years agoCLEANUP: tests: removed completely obsolete test files
Willy Tarreau [Tue, 13 Oct 2015 15:07:34 +0000 (17:07 +0200)] 
CLEANUP: tests: removed completely obsolete test files

A number of config files were present in the tests/ directory and which
would either test features that are easier to test using more recent files
or test obsolete features. All of them emit tons of useless warnings, and
instead of fixing them, better remove them since they have never been used
in the last 10 years or so.

The remaining files may still emit warnings and require some fixing but
they provide some value for some tests.

9 years agoCLEANUP: examples: shut up warnings in transparent proxy example
Willy Tarreau [Tue, 13 Oct 2015 13:46:50 +0000 (15:46 +0200)] 
CLEANUP: examples: shut up warnings in transparent proxy example

Just add some missing timeouts.

9 years agoCLEANUP: tests: move a test file from examples/ to tests/
Willy Tarreau [Tue, 13 Oct 2015 13:45:17 +0000 (15:45 +0200)] 
CLEANUP: tests: move a test file from examples/ to tests/

examples are for users, tests are for developers.

9 years agoCLEANUP: examples: update sample file ssl.cfg
Willy Tarreau [Tue, 13 Oct 2015 13:44:31 +0000 (15:44 +0200)] 
CLEANUP: examples: update sample file ssl.cfg

This one emitted an error due to the lack of "verify none" on the server line.

9 years agoCLEANUP: examples: update sample file option-http_proxy.cfg
Willy Tarreau [Tue, 13 Oct 2015 13:43:39 +0000 (15:43 +0200)] 
CLEANUP: examples: update sample file option-http_proxy.cfg

This one was still valid but emitted lots of warnings.

9 years agoCLEANUP: examples: fix the example file content-sw-sample.cfg
Willy Tarreau [Tue, 13 Oct 2015 13:38:46 +0000 (15:38 +0200)] 
CLEANUP: examples: fix the example file content-sw-sample.cfg

This one didn't load anymore, but it was worth updating it since it matches
most common needs.

9 years agoCLEANUP: examples: remove obsolete configuration file samples
Willy Tarreau [Tue, 13 Oct 2015 13:22:59 +0000 (15:22 +0200)] 
CLEANUP: examples: remove obsolete configuration file samples

This removes the obsolete CTTPROXY configuration, the tarpit example,
and the pre-content switching example involving 3 layers and cookie
rewriting to emulate the use_backend feature... (9 years old).

9 years agoCLEANUP: examples: remove some obsolete and confusing files
Willy Tarreau [Tue, 13 Oct 2015 13:15:10 +0000 (15:15 +0200)] 
CLEANUP: examples: remove some obsolete and confusing files

Some files are totally obsolete. The Formilux init scripts and packaging
scripts for haproxy 1.1.21 should go. Linux 2.4 kernel patch to enable
epoll() on EOLed RHEL3 should go. The tuning script is incomplete and
only suited to older kernels, better stop shipping this one.

9 years agoMINOR: init: report use of libslz instead of "no compression"
Willy Tarreau [Tue, 13 Oct 2015 14:46:28 +0000 (16:46 +0200)] 
MINOR: init: report use of libslz instead of "no compression"

It's confusing to see "no zlib support" followed by supported
compression algorithms. Fix this.

9 years agoBUILD: properly report when USE_ZLIB and USE_SLZ are used together
Willy Tarreau [Tue, 13 Oct 2015 14:45:21 +0000 (16:45 +0200)] 
BUILD: properly report when USE_ZLIB and USE_SLZ are used together

Use #error here otherwise the errors are hard to spot for the casual
user.

9 years agoDOC: remove haproxy-{en,fr}.txt
Willy Tarreau [Tue, 13 Oct 2015 14:34:46 +0000 (16:34 +0200)] 
DOC: remove haproxy-{en,fr}.txt

This long-awaited moment finally came!

9 years agoDOC: mention management.txt in README
Willy Tarreau [Tue, 13 Oct 2015 14:32:20 +0000 (16:32 +0200)] 
DOC: mention management.txt in README

and in intro.txt as well. Remove references to haproxy-{en,fr}.txt.

9 years agoMINOR: examples: update haproxy.spec to mention new docs
Willy Tarreau [Tue, 13 Oct 2015 14:33:57 +0000 (16:33 +0200)] 
MINOR: examples: update haproxy.spec to mention new docs

intro.txt and management.txt were added. haproxy-{en,fr}.txt were removed.

9 years agoDOC: move the stats socket documentation from config to management
Willy Tarreau [Tue, 13 Oct 2015 12:45:29 +0000 (14:45 +0200)] 
DOC: move the stats socket documentation from config to management

The documentation of the stats part is much more related to management
than to the configuration, move it there.

9 years agoDOC: add the "management" documentation
Willy Tarreau [Tue, 13 Oct 2015 12:40:55 +0000 (14:40 +0200)] 
DOC: add the "management" documentation

This doc explains how to start/stop haproxy, what signals are used
and a few debugging tricks. It's far from being complete but should
already help a number of users.

The stats part will be taken from the config doc.

9 years agoDOC: mention the "namespace" options for bind and server lines
Willy Tarreau [Tue, 13 Oct 2015 12:50:22 +0000 (14:50 +0200)] 
DOC: mention the "namespace" options for bind and server lines

It was only in the network-namespaces doc, but it needs to be
present in the config doc as well.

9 years agoMEDIUM: server: implement TCP_USER_TIMEOUT on the server
Willy Tarreau [Tue, 13 Oct 2015 14:16:41 +0000 (16:16 +0200)] 
MEDIUM: server: implement TCP_USER_TIMEOUT on the server

This is equivalent to commit 2af207a ("MEDIUM: tcp: implement tcp-ut
bind option to set TCP_USER_TIMEOUT") except that this time it works
on the server side. The purpose is to detect dead server connections
even when checks are rare, disabled, or after a soft reload (since
checks are disabled there as well), and to ensure client connections
will get killed faster.

9 years agoBUG/MINOR: config: make the stats socket pass the correct proxy to the parsers
Willy Tarreau [Tue, 13 Oct 2015 13:06:57 +0000 (15:06 +0200)] 
BUG/MINOR: config: make the stats socket pass the correct proxy to the parsers

Baptiste reported a segfault when the "id" keyword was passed on the
"stats socket" line. The problem is related to the fact that the stats
parser stats_parse_global() passes curpx instead of global.stats_fe to
the keyword parser. Indeed, curpx being a pointer to the proxy in the
current section, it is not correct here since the global section does
not describe a proxy. It's just by pure luck that only bind_parse_id()
uses the proxy since any other keyword parser could use it as well.

The bug has no impact since the id specified here is not usable at all
and can be discarded from a faulty configuration.

This fix must be backported to 1.5.

9 years agoBUG/MEDIUM: lua: direction test failed
Thierry FOURNIER [Tue, 13 Oct 2015 12:25:11 +0000 (14:25 +0200)] 
BUG/MEDIUM: lua: direction test failed

Lua needs to known the direction of the http data processed (request or
response). It checks the flag SMP_OPT_DIR_REQ, buf this flag is 0. This patch
correctly checks the flags after applying the SMP_OPT_DIR mask.

9 years agoDOC: stats paramaters available in frontend
Baptiste Assmann [Mon, 12 Oct 2015 18:30:24 +0000 (20:30 +0200)] 
DOC: stats paramaters available in frontend

All stats directive are now available in both frontend and backend
sections.

9 years agoDOC: backend section missing parameters
Baptiste Assmann [Mon, 12 Oct 2015 18:22:55 +0000 (20:22 +0200)] 
DOC: backend section missing parameters

One parameter was missing in the proxy paramater list.
One parameter was not alphabeticaly sorted.

9 years agoDOC: global section missing parameters
Baptiste Assmann [Mon, 12 Oct 2015 18:21:23 +0000 (20:21 +0200)] 
DOC: global section missing parameters

Some parameters were missing in the global paramater list.
A few parameters were not alphabeticaly sorted.

9 years agoBUILD: enable build on Linux/s390x
Neale Ferguson [Mon, 12 Oct 2015 18:58:51 +0000 (20:58 +0200)] 
BUILD: enable build on Linux/s390x

I would like to contribute the following fix to enable the Linux s390x
platform. The fix was built against today's git master. I've attached the
patch for review. Depending on your buildbot/jenkins/? requirements I can
set up a virtual machine for automated building/testing of the package in
this environment.

9 years agoBUG/MINOR: Handle interactive mode in cli handler
Andrew Hayworth [Fri, 2 Oct 2015 15:08:10 +0000 (15:08 +0000)] 
BUG/MINOR: Handle interactive mode in cli handler

A previous commit broke the interactive stats cli prompt. Specifically,
it was not clear that we could be in STAT_CLI_PROMPT when we get to
the output functions for the cli handler, and the switch statement did
not handle this case. We would then fall through to the default
statement, which was recently changed to set error flags on the socket.
This in turn causes the socket to be closed, which is not what we wanted
in this specific case.

To fix, we add a case for STAT_CLI_PROMPT, and simply break out of the
switch statement.

Testing:
 - Connected to unix stats socket, issued 'prompt', observed that I
   could issue multiple consecutive commands.
 - Connected to unix stats socket, issued 'prompt', observed that socket
   timed out after inactivity expired.
 - Connected to unix stats socket, issued 'prompt' then 'set timeout cli
   5', observed that socket timed out after 5 seconds expired.
 - Connected to unix stats socket, issued invalid commands, received
   usage output.
 - Connected to unix stats socket, issued 'show info', received info
   output and socket disconnected.
 - Connected to unix stats socket, issued 'show stat', received stats
   output and socket disconnected.
 - Repeated above tests with TCP stats socket.

[wt: no backport needed, this was introduced during the applet rework in 1.6]

9 years agoMINOR: lua: fix a spelling error in some error messages
Vincent Bernat [Tue, 6 Oct 2015 14:05:59 +0000 (16:05 +0200)] 
MINOR: lua: fix a spelling error in some error messages

"unknown" was spelled "unkown".

9 years agoBUG/MEDIUM: logs: fix time zone offset format in RFC5424
Dragan Dosen [Fri, 9 Oct 2015 19:31:43 +0000 (21:31 +0200)] 
BUG/MEDIUM: logs: fix time zone offset format in RFC5424

The time zone offset format used in function update_log_hdr_rfc5424() was
missing ":" as a separator.

9 years agoMINOR: ssl: Add callbacks to set DH/ECDH params for generated certificates
Christopher Faulet [Fri, 9 Oct 2015 09:46:32 +0000 (11:46 +0200)] 
MINOR: ssl: Add callbacks to set DH/ECDH params for generated certificates

Now, A callback is defined for generated certificates to set DH parameters for
ephemeral key exchange when required.
In same way, when possible, we also defined Elliptic Curve DH (ECDH) parameters.

9 years agoMINOR: ssl: Add support for EC for the CA used to sign generated certificates
Christopher Faulet [Fri, 9 Oct 2015 09:15:03 +0000 (11:15 +0200)] 
MINOR: ssl: Add support for EC for the CA used to sign generated certificates

This is done by adding EVP_PKEY_EC type in supported types for the CA private
key when we get the message digest used to sign a generated X509 certificate.
So now, we support DSA, RSA and EC private keys.

And to be sure, when the type of the private key is not directly supported, we
get its default message digest using the function
'EVP_PKEY_get_default_digest_nid'.

We also use the key of the default certificate instead of generated it. So we
are sure to use the same key type instead of always using a RSA key.

9 years agoMINOR: ssl: Read the file used to generate certificates in any order
Christopher Faulet [Fri, 9 Oct 2015 08:53:31 +0000 (10:53 +0200)] 
MINOR: ssl: Read the file used to generate certificates in any order

the file specified by the SSL option 'ca-sign-file' can now contain the CA
certificate used to dynamically generate certificates and its private key in any
order.

9 years agoBUILD: ssl: fix build error introduced by recent commit
Willy Tarreau [Fri, 9 Oct 2015 10:10:13 +0000 (12:10 +0200)] 
BUILD: ssl: fix build error introduced by recent commit

Commit d2cab92 ("BUG/MINOR: ssl: fix management of the cache where forged
certificates are stored") removed some needed #ifdefs resulting in ssl not
building on older openssl versions where SSL_CTRL_SET_TLSEXT_HOSTNAME is
not defined :

src/ssl_sock.c: In function 'ssl_sock_load_ca':
src/ssl_sock.c:2504: error: 'ssl_ctx_lru_tree' undeclared (first use in this function)
src/ssl_sock.c:2504: error: (Each undeclared identifier is reported only once
src/ssl_sock.c:2504: error: for each function it appears in.)
src/ssl_sock.c:2505: error: 'ssl_ctx_lru_seed' undeclared (first use in this function)
src/ssl_sock.c: In function 'ssl_sock_close':
src/ssl_sock.c:3095: error: 'ssl_ctx_lru_tree' undeclared (first use in this function)
src/ssl_sock.c: In function '__ssl_sock_deinit':
src/ssl_sock.c:5367: error: 'ssl_ctx_lru_tree' undeclared (first use in this function)
make: *** [src/ssl_sock.o] Error 1

Reintroduce the ifdefs around the faulty areas.

9 years agoMINOR: ssl: Release Servers SSL context when HAProxy is shut down
Christopher Faulet [Wed, 29 Jul 2015 11:02:40 +0000 (13:02 +0200)] 
MINOR: ssl: Release Servers SSL context when HAProxy is shut down

[wt: could be backported to 1.5 as well]

9 years agoBUG/MINOR: ssl: fix management of the cache where forged certificates are stored
Christopher Faulet [Tue, 28 Jul 2015 14:03:47 +0000 (16:03 +0200)] 
BUG/MINOR: ssl: fix management of the cache where forged certificates are stored

First, the LRU cache must be initialized after the configuration parsing to
correctly set its size.
Next, the function 'ssl_sock_set_generated_cert' returns -1 when an error occurs
(0 if success). In that case, the caller is responsible to free the memory
allocated for the certificate.
Finally, when a SSL certificate is generated by HAProxy but cannot be inserted
in the cache, it must be freed when the SSL connection is closed. This happens
when 'tune.ssl.ssl-ctx-cache-size' is set to 0.

9 years agoBUG/MINOR: http: Add OPTIONS in supported http methods (found by find_http_meth)
Christopher Faulet [Fri, 31 Jul 2015 12:26:57 +0000 (14:26 +0200)] 
BUG/MINOR: http: Add OPTIONS in supported http methods (found by find_http_meth)

The 'OPTIONS' method was not in the list of supported HTTP methods and
find_http_meth return HTTP_METH_OTHER instead of HTTP_METH_OPTIONS.

[wt: this fix needs to be backported at least to 1.5, 1.4 and 1.3]

9 years agoMINOR: lru: do not allocate useless memory in lru64_lookup
Christopher Faulet [Tue, 28 Jul 2015 14:01:07 +0000 (16:01 +0200)] 
MINOR: lru: do not allocate useless memory in lru64_lookup

lru64_lookup function was added in a previous patch of mine. This one
just remove a useless memory allocation.

9 years agoBUILD: Fix the build on OSX (htonll/ntohll)
Joseph Lynch [Wed, 7 Oct 2015 02:43:18 +0000 (19:43 -0700)] 
BUILD: Fix the build on OSX (htonll/ntohll)

htonll and ntohll were defined in 5b4dd683cb but on osx they are already
defined in sys/_endian.h. So, we check if they are defined before
declaring them.

[wt: no backport needed]

9 years agoMINOR: debug: enable memory poisonning to use byte 0
Willy Tarreau [Thu, 8 Oct 2015 12:12:13 +0000 (14:12 +0200)] 
MINOR: debug: enable memory poisonning to use byte 0

When debugging an issue, sometimes it can be useful to be able to use
byte 0 to poison memory areas, resulting in the same effect as a calloc().
This patch changes the default mem_poison_byte to -1 to disable it so that
all positive values are usable.

9 years agoMEDIUM: init: support a list of files on the command line
Willy Tarreau [Thu, 8 Oct 2015 09:58:48 +0000 (11:58 +0200)] 
MEDIUM: init: support a list of files on the command line

HAProxy could already support being passed a file list on the command
line, by passing multiple times "-f" followed by a file name. People
have been complaining that it made it hard to pass file lists from init
scripts.

This patch introduces an end of arguments using the common "--" tag,
after which only file names may appear. These files are then added to
the existing list of other files specified using -f and are loaded in
their declaration order. Thus it becomes possible to do something like
this :

    haproxy -sf $(pidof haproxy) -- /etc/haproxy/global.cfg /etc/haproxy/customers/*.cfg

9 years agoMEDIUM: init: support more command line arguments after pid list
Willy Tarreau [Thu, 8 Oct 2015 09:32:32 +0000 (11:32 +0200)] 
MEDIUM: init: support more command line arguments after pid list

Given that all command line arguments start with a '-' and that
no pid number can start with this character, there's no constraint
to make the pid list the last argument. Let's relax this rule.

9 years agoBUG/MEDIUM: lua: force server-close mode on Lua services
Willy Tarreau [Wed, 7 Oct 2015 18:20:28 +0000 (20:20 +0200)] 
BUG/MEDIUM: lua: force server-close mode on Lua services

Thierry reported that keep-alive still didn't cope well with Lua
services. The reason is that for now applets have to be closed at
the end of a transaction so we want to work in server-close mode,
which isn't noticeable by the client since it still sees keep-alive.
Additionally we want to enable the request body transfer analyser
which will be needed to synchronize with the response analyser to
indicate the end of the transfer.

9 years agoCLEANUP: cli: ensure we can never double-free error messages
Willy Tarreau [Wed, 7 Oct 2015 18:00:24 +0000 (20:00 +0200)] 
CLEANUP: cli: ensure we can never double-free error messages

The release handler used to be called twice for some time and just by
pure luck we never ended up double-freeing the data there. Add a NULL
to ensure this can never happen should a future change permit this
situation again.

9 years ago[RELEASE] Released version 1.6-dev7 v1.6-dev7
Willy Tarreau [Tue, 6 Oct 2015 10:13:56 +0000 (12:13 +0200)] 
[RELEASE] Released version 1.6-dev7

Released version 1.6-dev7 with the following main changes :
    - MINOR: cli: Dump all resolvers stats if no resolver section is given
    - BUG: config: external-check command validation is checking for incorrect arguments.
    - DOC: documentation format cleanups
    - DOC: lua: few typos.
    - BUG/MEDIUM: str2ip: make getaddrinfo() consider local address selection policy
    - BUG/MEDIUM: logs: segfault writing to log from Lua
    - DOC: fix lua use-service example
    - MINOR: payload: add support for tls session ticket ext
    - MINOR: lua: remove the run flag
    - MEDIUM: lua: change the timeout execution
    - MINOR: lua: rename the tune.lua.applet-timeout
    - DOC: lua: update Lua doc
    - DOC: lua: update doc according with the last Lua changes
    - MINOR: http/tcp: fill the avalaible actions
    - DOC: reorder misplaced res.ssl_hello_type in the doc
    - BUG/MINOR: tcp: make silent-drop always force a TCP reset
    - CLEANUP: tcp: silent-drop: only drain the connection when quick-ack is disabled
    - BUILD: tcp: use IPPROTO_IP when SOL_IP is not available
    - BUILD: server: fix build warnings introduced by load-server-state
    - BUG/MEDIUM: server: fix misuse of format string in load-server-state's warnings

9 years agoMINOR: cli: Dump all resolvers stats if no resolver section is given
Andrew Hayworth [Fri, 2 Oct 2015 20:33:01 +0000 (20:33 +0000)] 
MINOR: cli: Dump all resolvers stats if no resolver section is given

This commit adds support for dumping all resolver stats. Specifically
if a command 'show stats resolvers' is issued withOUT a resolver section
id, we dump all known resolver sections. If none are configured, a
message is displayed indicating that.

9 years agoBUG: config: external-check command validation is checking for incorrect arguments.
Ben Cabot [Wed, 16 Sep 2015 11:07:51 +0000 (12:07 +0100)] 
BUG: config: external-check command validation is checking for incorrect arguments.

When using the external-check command option HAProxy was failing to
start with a fatal error "'external-check' cannot handle unexpected
argument". When looking at the code it was looking for an incorrect
argument. Also correcting an Alert message text as spotted by by
PiBa-NL.

9 years agoDOC: lua: few typos.
David Carlier [Fri, 2 Oct 2015 10:59:38 +0000 (11:59 +0100)] 
DOC: lua: few typos.

9 years agoMINOR: http/tcp: fill the avalaible actions
Thierry FOURNIER [Fri, 2 Oct 2015 06:24:51 +0000 (08:24 +0200)] 
MINOR: http/tcp: fill the avalaible actions

This patch adds a function that generates the list of avalaible actions
for the error message.

9 years agoDOC: lua: update doc according with the last Lua changes
Thierry FOURNIER [Thu, 1 Oct 2015 13:00:42 +0000 (15:00 +0200)] 
DOC: lua: update doc according with the last Lua changes

The impact of the register_action() was not repported.

9 years agoDOC: lua: update Lua doc
Thierry FOURNIER [Thu, 1 Oct 2015 12:49:33 +0000 (14:49 +0200)] 
DOC: lua: update Lua doc

 - Removes the Lua action reference
 - Update the tune.lu.service-timeout

9 years agoMINOR: lua: rename the tune.lua.applet-timeout
Thierry FOURNIER [Thu, 1 Oct 2015 06:42:31 +0000 (08:42 +0200)] 
MINOR: lua: rename the tune.lua.applet-timeout

The name of applet is "service", so this patch renames the
tune.lua.applet-timeout to tune.lua.service-timeout

9 years agoBUG/MEDIUM: str2ip: make getaddrinfo() consider local address selection policy
Dmitry Sivachenko [Thu, 1 Oct 2015 23:01:58 +0000 (01:01 +0200)] 
BUG/MEDIUM: str2ip: make getaddrinfo() consider local address selection policy

When first parameter to getaddrinfo() is not NULL (it is always not NULL
in str2ip()), on Linux AI_PASSIVE value for ai_flags is ignored. On
FreeBSD, when AI_PASSIVE is specified and hostname parameter is not NULL,
getaddrinfo() ignores local address selection policy, always returning
AAAA record. Pass zero ai_flags to behave correctly on FreeBSD, this
change should be no-op for Linux.

This fix should be backported to 1.5 as well, after some observation
period.

9 years agoBUG/MEDIUM: logs: segfault writing to log from Lua
Dragan Dosen [Thu, 1 Oct 2015 11:18:13 +0000 (13:18 +0200)] 
BUG/MEDIUM: logs: segfault writing to log from Lua

Michael Ezzell reported a bug causing haproxy to segfault during startup
when trying to send syslog message from Lua. The function __send_log() can
be called with *p that is NULL and/or when the configuration is not fully
parsed, as is the case with Lua.

This patch fixes this problem by using individual vectors instead of the
pre-generated strings log_htp and log_htp_rfc5424.

Also, this patch fixes a problem causing haproxy to write the wrong pid in
the logs -- the log_htp(_rfc5424) strings were generated at the haproxy
start, but "pid" value would be changed after haproxy is started in
daemon/systemd mode.

9 years agoDOC: fix lua use-service example
Pieter Baauw [Thu, 1 Oct 2015 20:47:12 +0000 (22:47 +0200)] 
DOC: fix lua use-service example

9 years agoMEDIUM: lua: change the timeout execution
Thierry FOURNIER [Mon, 28 Sep 2015 23:59:42 +0000 (01:59 +0200)] 
MEDIUM: lua: change the timeout execution

Now, the Lua timeout is relative to the effective run time.
When the Lua is waiting for I/O, this time is not took in
lua run time account.

9 years agoMINOR: lua: remove the run flag
Thierry FOURNIER [Mon, 28 Sep 2015 23:41:25 +0000 (01:41 +0200)] 
MINOR: lua: remove the run flag

Only the main execution function can set the run flag, because it is
the last function before the execution time.

This patch removes the flag set by another function. It will be used
by the new lua timeout counter.

9 years agoBUG/MEDIUM: server: fix misuse of format string in load-server-state's warnings
Willy Tarreau [Tue, 29 Sep 2015 16:38:47 +0000 (18:38 +0200)] 
BUG/MEDIUM: server: fix misuse of format string in load-server-state's warnings

Commit e11cfcd ("MINOR: config: new backend directives:
load-server-state-from-file and server-state-file-name") introduced a bug
which can cause haproxy to crash upon startup by sending user-controlled
data in a format string when emitting a warning. Fix the way the warning
message is built to avoid this.

No backport is needed, this was introduced in 1.6-dev6 only.

9 years agoBUILD: server: fix build warnings introduced by load-server-state
Willy Tarreau [Tue, 29 Sep 2015 16:32:57 +0000 (18:32 +0200)] 
BUILD: server: fix build warnings introduced by load-server-state

Commit e11cfcd ("MINOR: config: new backend directives:
load-server-state-from-file and server-state-file-name") caused these
warnings when building with Clang :

src/server.c:1972:21: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                            (srv_uweight < 0) || (srv_uweight > SRV_UWGHT_MAX))
                             ~~~~~~~~~~~ ^ ~
src/server.c:1980:21: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                            (srv_iweight < 0) || (srv_iweight > SRV_UWGHT_MAX))
                             ~~~~~~~~~~~ ^ ~

Indeed, srv_iweight and srv_uweight are unsigned. Just drop the offending test.

9 years agoBUILD: tcp: use IPPROTO_IP when SOL_IP is not available
Willy Tarreau [Tue, 29 Sep 2015 16:19:32 +0000 (18:19 +0200)] 
BUILD: tcp: use IPPROTO_IP when SOL_IP is not available

Dmitry Sivachenko reported a build failure on FreeBSD due to SOL_IP not
being defined. IPPROTO_IP must be used there instead.

9 years agoCLEANUP: tcp: silent-drop: only drain the connection when quick-ack is disabled
Willy Tarreau [Tue, 29 Sep 2015 16:15:01 +0000 (18:15 +0200)] 
CLEANUP: tcp: silent-drop: only drain the connection when quick-ack is disabled

The conn_sock_drain() call is only there to force the system to ACK
pending data in case of TCP_QUICKACK so that the client doesn't retransmit,
otherwise it leads to a real RST making the feature useless. There's no
point in draining the connection when quick ack cannot be disabled, so
let's move the call inside the ifdef part.

9 years agoBUG/MINOR: tcp: make silent-drop always force a TCP reset
Willy Tarreau [Tue, 29 Sep 2015 16:11:32 +0000 (18:11 +0200)] 
BUG/MINOR: tcp: make silent-drop always force a TCP reset

The silent-drop action is supposed to close with a TCP reset that is
either not sent or not too far. But since it's on the client-facing
side, the socket's lingering is enabled by default and the RST only
occurs if some pending unread data remain in the queue when closing.
This causes some clean shutdowns to occur with retransmits, which is
not good at all. Force linger_risk on the socket to flush all data
and destroy the socket.

No backport is needed, this was introduced in 1.6-dev6.

9 years agoDOC: reorder misplaced res.ssl_hello_type in the doc
Willy Tarreau [Tue, 29 Sep 2015 12:06:59 +0000 (14:06 +0200)] 
DOC: reorder misplaced res.ssl_hello_type in the doc

Entries are supposed to be in alphabetical order.

9 years agoMINOR: payload: add support for tls session ticket ext
Pradeep Jindal [Tue, 29 Sep 2015 04:42:57 +0000 (10:12 +0530)] 
MINOR: payload: add support for tls session ticket ext

req.ssl_st_ext : integer
  Returns 0 if the client didn't send a SessionTicket TLS Extension (RFC5077)
  Returns 1 if the client sent SessionTicket TLS Extension
  Returns 2 if the client also sent non-zero length TLS SessionTicket

9 years agoDOC: documentation format cleanups
Cyril Bonté [Mon, 28 Sep 2015 21:16:06 +0000 (23:16 +0200)] 
DOC: documentation format cleanups

Chapter "Mailers" was missing from the summary, tabulations were used and
several lines exceeded 80 columns : some lines still exceeds the 80 columns
limit but are left as is, as it mostly concerns syntax and configuration
examples.

9 years ago[RELEASE] Released version 1.6-dev6 v1.6-dev6
Willy Tarreau [Mon, 28 Sep 2015 21:46:27 +0000 (23:46 +0200)] 
[RELEASE] Released version 1.6-dev6

Released version 1.6-dev6 with the following main changes :
    - BUG/MAJOR: can't enable a server through the stat socket
    - MINOR: server: Macro definition for server-state
    - MINOR: cli: new stats socket command: show servers state
    - DOC: stats socket command: show servers state
    - MINOR: config: new global directive server-state-base
    - DOC: global directive server-state-base
    - MINOR: config: new global section directive: server-state-file
    - DOC: new global directive: server-state-file
    - MINOR: config: new backend directives: load-server-state-from-file and server-state-file-name
    - DOC: load-server-state-from-file
    - MINOR: init: server state loaded from file
    - MINOR: server: startup slowstart task when using seamless reload of HAProxy
    - MINOR: cli: new stats socket command: show backend
    - DOC: servers state seamless reload example
    - BUG: dns: can't connect UDP socket on FreeBSD
    - MINOR: cfgparse: New function cfg_unregister_sections()
    - MINOR: chunk: New function free_trash_buffers()
    - BUG/MEDIUM: main: Freeing a bunch of static pointers
    - MINOR: proto_http: Externalisation of previously internal functions
    - MINOR: global: Few new struct fields for da module
    - MAJOR: da: Update of the DeviceAtlas API module
    - DOC: DeviceAtlas new keywords
    - DOC: README: DeviceAtlas sample configuration updates
    - MEDIUM: log: replace sendto() with sendmsg() in __send_log()
    - MEDIUM: log: use a separate buffer for the header and for the message
    - MEDIUM: logs: remove the hostname, tag and pid part from the logheader
    - MEDIUM: logs: add support for RFC5424 header format per logger
    - MEDIUM: logs: add a new RFC5424 log-format for the structured-data
    - DOC: mention support for the RFC5424 syslog message format
    - MEDIUM: logs: have global.log_send_hostname not contain the trailing space
    - MEDIUM: logs: pass the trailing "\n" as an iovec
    - BUG/MEDIUM: peers: some table updates are randomly not pushed.
    - BUG/MEDIUM: peers: same table updates re-pushed after a re-connect
    - BUG/MINOR: fct peer_prepare_ackmsg should not use trash.
    - MINOR: http: made CHECK_HTTP_MESSAGE_FIRST accessible to other functions
    - MINOR: global: Added new fields for 51Degrees device detection
    - DOC: Added more explanation for 51Degrees V3.2
    - BUILD: Changed 51Degrees option to support V3.2
    - MAJOR: 51d: Upgraded to support 51Degrees V3.2 and new features
    - MINOR: 51d: Improved string handling for LRU cache
    - DOC: add references to rise/fall for the fastinter explanation
    - MINOR: support cpu-map feature through the compile option USE_CPU_AFFINITY on FreeBSD
    - BUG/MAJOR: lua: potential unexpected aborts()
    - BUG/MINOR: lua: breaks the log message if his size exceed one buffer
    - MINOR: action: add private configuration
    - MINOR: action: add reference to the original keywork matched for the called parser.
    - MINOR: lua: change actions registration
    - MEDIUM: proto_http: smp_prefetch_http initialize txn
    - MINOR: channel: rename function chn_sess to chn_strm
    - CLEANUP: lua: align defines
    - MINOR: http: export http_get_path() function
    - MINOR: http: export the get_reason() function
    - MINOR: http: export function http_msg_analyzer()
    - MINOR: http: split initialization
    - MINOR: lua: reset pointer after use
    - MINOR: lua: identify userdata objects
    - MEDIUM: lua: use the function lua_rawset in place of lua_settable
    - BUG/MAJOR: lua: segfault after the channel data is modified by some Lua action.
    - CLEANUP: lua: use calloc in place of malloc
    - BUG/MEDIUM: lua: longjmp function must be unregistered
    - BUG/MEDIUM: lua: forces a garbage collection
    - BUG/MEDIUM: lua: wakeup task on bad conditions
    - MINOR: standard: avoid DNS resolution from the function str2sa_range()
    - MINOR: lua: extend socket address to support non-IP families
    - MINOR: lua/applet: the cosocket applet should use appctx_wakeup in place of task_wakeup
    - BUG/MEDIUM: lua: socket destroy before reading pending data
    - MEDIUM: lua: change the GC policy
    - OPTIM/MEDIUM: lua: executes the garbage collector only when using cosocket
    - BUG/MEDIUM: lua: don't reset undesired flags in hlua_ctx_resume
    - MINOR: applet: add init function
    - MINOR: applet: add an execution timeout
    - MINOR: stream/applet: add use-service action
    - MINOR: lua: add AppletTCP class and service
    - MINOR: lua: add AppletHTTP class and service
    - DOC: lua: some documentation update
    - DOC: add the documentation about internal circular lists
    - DOC: add a CONTRIBUTING file
    - DOC: add a MAINTAINERS file
    - BUG/MAJOR: peers: fix a crash when stopping peers on unbound processes
    - DOC: update coding-style to reference checkpatch.pl
    - BUG/MEDIUM: stick-tables: fix double-decrement of tracked entries
    - BUG/MINOR: args: add name for ARGT_VAR
    - DOC: add more entries to MAINTAINERS
    - DOC: add more entries to MAINTAINERS
    - CLEANUP: stream-int: remove obsolete function si_applet_call()
    - BUG/MAJOR: cli: do not dereference strm_li()->proto->name
    - BUG/MEDIUM: http: do not dereference strm_li(stream)
    - BUG/MEDIUM: proxy: do not dereference strm_li(stream)
    - BUG/MEDIUM: stream: do not dereference strm_li(stream)
    - MINOR: stream-int: use si_release_endpoint() to close idle conns
    - BUG/MEDIUM: payload: make req.payload and payload_lv aware of dynamic buffers
    - BUG/MEDIUM: acl: always accept match "found"
    - MINOR: applet: rename applet_runq to applet_active_queue
    - BUG/MAJOR: applet: use a separate run queue to maintain list integrity
    - MEDIUM: stream-int: split stream_int_update_conn() into si- and conn-specific parts
    - MINOR: stream-int: implement a new stream_int_update() function
    - MEDIUM: stream-int: factor out the stream update functions
    - MEDIUM: stream-int: call stream_int_update() from si_update()
    - MINOR: stream-int: export stream_int_update_*
    - MINOR: stream-int: move the applet_pause call out of the stream updates
    - MEDIUM: stream-int: clean up the conditions to enable reading in si_conn_wake_cb
    - MINOR: stream-int: implement the stream_int_notify() function
    - MEDIUM: stream-int: use the same stream notification function for applets and conns
    - MEDIUM: stream-int: completely remove stream_int_update_embedded()
    - MINOR: stream-int: rename si_applet_done() to si_applet_wake_cb()
    - BUG/MEDIUM: applet: fix reporting of broken write situation
    - BUG/MINOR: stats: do not call cli_release_handler 3 times
    - BUG/MEDIUM: cli: properly handle closed output
    - MINOR: cli: do not call the release handler on internal error.
    - BUG/MEDIUM: stream-int: avoid double-call to applet->release
    - DEBUG: add p_malloc() to return a poisonned memory area
    - CLEANUP: lua: remove unneeded memset(0) after calloc()
    - MINOR: lua: use the proper applet wakeup mechanism
    - BUG/MEDIUM: lua: better fix for the protocol check
    - BUG/MEDIUM: lua: properly set the target on the connection
    - MEDIUM: actions: pass a new "flags" argument to custom actions
    - MEDIUM: actions: add new flag ACT_FLAG_FINAL to notify about last call
    - MEDIUM: http: pass ACT_FLAG_FINAL to custom actions
    - MEDIUM: lua: only allow actions to yield if not in a final call
    - DOC: clarify how to make use of abstract sockets in socat
    - CLEANUP: config: make the errorloc/errorfile messages less confusing
    - MEDIUM: action: add a new flag ACT_FLAG_FIRST
    - BUG/MINOR: config: check that tune.bufsize is always positive
    - MEDIUM: config: set tune.maxrewrite to 1024 by default
    - DOC: add David Carlier as maintainer of da.c
    - DOC: fix some broken unexpected unicode chars in the Lua doc.
    - BUG/MEDIUM: proxy: ignore stopped peers
    - BUG/MEDIUM: proxy: do not wake stopped proxies' tasks during soft_stop()
    - MEDIUM: init: completely deallocate unused peers
    - BUG/MEDIUM: tcp: fix inverted condition to call custom actions
    - DOC: remove outdated actions lists on tcp-request/response
    - MEDIUM: tcp: add new tcp action "silent-drop"
    - DOC: add URLs to optional libraries in the README

9 years agoDOC: add URLs to optional libraries in the README
Willy Tarreau [Mon, 28 Sep 2015 20:36:21 +0000 (22:36 +0200)] 
DOC: add URLs to optional libraries in the README

It's nice to suggest people how to build with certain libraries but
it's nicer to tell them where to fetch them.

9 years agoMEDIUM: tcp: add new tcp action "silent-drop"
Willy Tarreau [Sun, 23 Aug 2015 23:43:45 +0000 (01:43 +0200)] 
MEDIUM: tcp: add new tcp action "silent-drop"

This stops the evaluation of the rules and makes the client-facing
connection suddenly disappear using a system-dependant way that tries
to prevent the client from being notified. The effect it then that the
client still sees an established connection while there's none on
HAProxy. The purpose is to achieve a comparable effect to "tarpit"
except that it doesn't use any local resource at all on the machine
running HAProxy. It can resist much higher loads than "tarpit", and
slow down stronger attackers. It is important to undestand the impact
of using this mechanism. All stateful equipments placed between the
client and HAProxy (firewalls, proxies, load balancers) will also keep
the established connection for a long time and may suffer from this
action. On modern Linux systems running with enough privileges, the
TCP_REPAIR socket option is used to block the emission of a TCP
reset. On other systems, the socket's TTL is reduced to 1 so that the
TCP reset doesn't pass the first router, though it's still delivered to
local networks.

9 years agoDOC: remove outdated actions lists on tcp-request/response
Willy Tarreau [Mon, 28 Sep 2015 16:47:38 +0000 (18:47 +0200)] 
DOC: remove outdated actions lists on tcp-request/response

The valid actions are enumerated in the text, and the small set listed
in the definition is not accurate.

9 years agoBUG/MEDIUM: tcp: fix inverted condition to call custom actions
Willy Tarreau [Mon, 28 Sep 2015 15:50:10 +0000 (17:50 +0200)] 
BUG/MEDIUM: tcp: fix inverted condition to call custom actions

tcp-request connection had an inverted condition on action_ptr, resulting
in no registered actions to be usable since commit 4214873 ("MEDIUM: actions:
remove ACTION_STOP") merged in 1.6-dev5. Very few new actions were impacted.
No backport is needed.

9 years agoMEDIUM: logs: pass the trailing "\n" as an iovec
Dragan Dosen [Mon, 28 Sep 2015 14:01:03 +0000 (16:01 +0200)] 
MEDIUM: logs: pass the trailing "\n" as an iovec

This patch passes the trailing "\n" as an iovec in the function
__send_log(), so that we don't need to modify the original log message.

9 years agoMEDIUM: logs: have global.log_send_hostname not contain the trailing space
Dragan Dosen [Mon, 28 Sep 2015 11:28:21 +0000 (13:28 +0200)] 
MEDIUM: logs: have global.log_send_hostname not contain the trailing space

This patch unifies global.log_send_hostname addition in the log header
processing.

9 years agoDOC: mention support for the RFC5424 syslog message format
Dragan Dosen [Mon, 28 Sep 2015 15:16:47 +0000 (17:16 +0200)] 
DOC: mention support for the RFC5424 syslog message format

Document the new log "format" argument and the "log-format-sd" statement.

9 years agoMEDIUM: init: completely deallocate unused peers
Willy Tarreau [Mon, 28 Sep 2015 14:39:25 +0000 (16:39 +0200)] 
MEDIUM: init: completely deallocate unused peers

When peers are stopped due to not being running on the appropriate
process, we want to completely release them and unregister their signals
and task in order to ensure there's no way they may be called in the
future.

Note: ideally we should have a list of all tables attached to a peers
section being disabled in order to unregister them and void their
sync_task. It doesn't appear to be *that* easy for now.

9 years agoBUG/MEDIUM: proxy: do not wake stopped proxies' tasks during soft_stop()
Willy Tarreau [Mon, 28 Sep 2015 14:35:04 +0000 (16:35 +0200)] 
BUG/MEDIUM: proxy: do not wake stopped proxies' tasks during soft_stop()

When performing a soft stop, we used to wake up every proxy's task and
each of their table's task. The problem is that since we're able to stop
proxies and peers not bound to a specific process, we may end up calling
random junk by doing so of the proxy we're waking up is already stopped.
This causes a segfault to appear during soft reloads for old processes
not bound to a peers section if such a section exists in other processes.

Let's only consider proxies that are not stopped when doing this.

This fix must be backported to 1.5 which also has the same issue.

9 years agoBUG/MEDIUM: proxy: ignore stopped peers
Willy Tarreau [Mon, 28 Sep 2015 14:27:44 +0000 (16:27 +0200)] 
BUG/MEDIUM: proxy: ignore stopped peers

Since commit f83d3fe ("MEDIUM: init: stop any peers section not bound
to the correct process"), it is possible to stop unused peers on certain
processes. The problem is that the pause/resume/stop functions are not
aware of this and will pass a NULL proxy pointer to the respective
functions, resulting in segfaults in unbound processes during soft
restarts.

Properly check that the peers' frontend is still valid before calling
them.

This bug also affects 1.5 so the fix must be backported. Note that this
fix is not enough to completely get rid of the segfault, the next one
is needed as well.

9 years agoDOC: fix some broken unexpected unicode chars in the Lua doc.
Willy Tarreau [Mon, 28 Sep 2015 13:39:10 +0000 (15:39 +0200)] 
DOC: fix some broken unexpected unicode chars in the Lua doc.

A few chars didn't render properly in some terminals and had no
reason for being there.

9 years agoDOC: lua: some documentation update
Thierry FOURNIER [Fri, 25 Sep 2015 19:43:56 +0000 (21:43 +0200)] 
DOC: lua: some documentation update

this update embbeds some fix of existing function, and the applet documentation.

9 years agoDOC: add David Carlier as maintainer of da.c
Willy Tarreau [Mon, 28 Sep 2015 11:37:30 +0000 (13:37 +0200)] 
DOC: add David Carlier as maintainer of da.c

David is willing to handle any issue related to da.c.