]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
9 years agoBUG/MEDIUM: payload: make req.payload and payload_lv aware of dynamic buffers
Willy Tarreau [Thu, 24 Sep 2015 14:33:10 +0000 (16:33 +0200)] 
BUG/MEDIUM: payload: make req.payload and payload_lv aware of dynamic buffers

Due to a check between offset+len and buf->size, an empty buffer returns
"will never match". Check against tune.bufsize instead.
(cherry picked from commit 43e4039fd5d208fd9d32157d20de93d3ddf9bc0d)

9 years agoMINOR: stream-int: use si_release_endpoint() to close idle conns
Willy Tarreau [Wed, 23 Sep 2015 15:56:02 +0000 (17:56 +0200)] 
MINOR: stream-int: use si_release_endpoint() to close idle conns

We don't want to open-code the connection close code in
si_idle_conn_wake_cb() because we need to centralize some controls.

9 years agoMINOR: lua: change actions registration
Thierry FOURNIER [Wed, 23 Sep 2015 19:03:35 +0000 (21:03 +0200)] 
MINOR: lua: change actions registration

The current Lua action are not registered. The executed function is
selected according with a function name writed in the HAProxy configuration.

This patch add an action registration function. The configuration mode
described above disappear.

This change make some incompatibilities with existing configuration files for
HAProxy 1.6-dev.

9 years agoMINOR: action: add reference to the original keywork matched for the called parser.
Thierry FOURNIER [Tue, 22 Sep 2015 17:14:35 +0000 (19:14 +0200)] 
MINOR: action: add reference to the original keywork matched for the called parser.

This is usefull because the keyword can contains some condifiguration
data set while the keyword registration.

9 years agoMINOR: action: add private configuration
Thierry FOURNIER [Tue, 22 Sep 2015 16:26:42 +0000 (18:26 +0200)] 
MINOR: action: add private configuration

This private configuration pointer is used for storing some configuration
data associated the keyword, So many keywords can use the same parse
function, and this one can use a discriminator.

9 years agoBUG/MEDIUM: stream: do not dereference strm_li(stream)
Willy Tarreau [Wed, 23 Sep 2015 10:21:21 +0000 (12:21 +0200)] 
BUG/MEDIUM: stream: do not dereference strm_li(stream)

Some streams do not have a listener (eg: Lua's cosockets) so
let's check for this. For now this problem cannot happen but
it's definitely unsafe.

9 years agoBUG/MEDIUM: proxy: do not dereference strm_li(stream)
Willy Tarreau [Wed, 23 Sep 2015 10:20:10 +0000 (12:20 +0200)] 
BUG/MEDIUM: proxy: do not dereference strm_li(stream)

Some streams do not have a listener (eg: Lua's cosockets) so
let's check for this. For now this problem cannot happen but
it's definitely unsafe.

9 years agoBUG/MEDIUM: http: do not dereference strm_li(stream)
Willy Tarreau [Wed, 23 Sep 2015 10:18:14 +0000 (12:18 +0200)] 
BUG/MEDIUM: http: do not dereference strm_li(stream)

Some streams do not have a listener (eg: Lua's cosockets) so
let's check for this. For now this problem cannot happen but
it's definitely unsafe.

9 years agoBUG/MAJOR: cli: do not dereference strm_li()->proto->name
Willy Tarreau [Wed, 23 Sep 2015 10:16:43 +0000 (12:16 +0200)] 
BUG/MAJOR: cli: do not dereference strm_li()->proto->name

Or it will crash when dumping streams instanciated by an applet,
like Lua's cosockets.

9 years agoCLEANUP: stream-int: remove obsolete function si_applet_call()
Willy Tarreau [Wed, 23 Sep 2015 08:12:49 +0000 (10:12 +0200)] 
CLEANUP: stream-int: remove obsolete function si_applet_call()

This one is not used anymore and is bogus due to the way applets
now work. Remove it instead of fixing it before someone finds it
fun to use it.

9 years agoDOC: add more entries to MAINTAINERS
Willy Tarreau [Wed, 23 Sep 2015 05:41:56 +0000 (07:41 +0200)] 
DOC: add more entries to MAINTAINERS

Simon is willing to maintain mailers and external checks.

9 years agoBUG/MINOR: fct peer_prepare_ackmsg should not use trash.
Emeric Brun [Tue, 22 Sep 2015 13:50:18 +0000 (15:50 +0200)] 
BUG/MINOR: fct peer_prepare_ackmsg should not use trash.

function 'peer_prepare_ackmsg' is designed to use the argument 'msg'
instead of 'trash.str'.

There is currently no bug because the caller passes 'trash.str' in
the 'msg' argument.

9 years agoBUG/MEDIUM: peers: same table updates re-pushed after a re-connect
Emeric Brun [Tue, 22 Sep 2015 13:34:19 +0000 (15:34 +0200)] 
BUG/MEDIUM: peers: same table updates re-pushed after a re-connect

Some updates are pushed using an incremental update message after a
re-connection whereas the origin is forgotten by the peer.
These updates are never correctly acknowledged. So they are regularly
re-pushed after an idle timeout and a re-connect.

The fix consists to use an absolute update message in some cases.

9 years agoBUG/MEDIUM: peers: some table updates are randomly not pushed.
Emeric Brun [Tue, 22 Sep 2015 13:05:06 +0000 (15:05 +0200)] 
BUG/MEDIUM: peers: some table updates are randomly not pushed.

If an entry is still not present in the update tree, we could miss to schedule
for a push depending of an un-initialized value (upd.key remains un-initialized
for new sessions or isn't re-initalized for reused ones).

In the same way, if an entry is present in the tree, but its update's tick
is far in the past (> 2^31). We could consider it's still scheduled even if
it is not the case.

The fix consist to force the re-scheduling of an update if it was not present in
the updates tree or if the update is not in the scheduling window of every peers.

9 years agoBUG: dns: can't connect UDP socket on FreeBSD
Baptiste Assmann [Mon, 21 Sep 2015 18:55:08 +0000 (20:55 +0200)] 
BUG: dns: can't connect UDP socket on FreeBSD

PiBANL reported that HAProxy's DNS resolver can't "connect" its socker
on FreeBSD.
Remi Gacogne reported that we should use the function 'get_addr_len' to
get the addr structure size instead of sizeof.

9 years agoDOC: add more entries to MAINTAINERS
Willy Tarreau [Mon, 21 Sep 2015 23:07:00 +0000 (01:07 +0200)] 
DOC: add more entries to MAINTAINERS

Cyril is the most impacted by doc format changes, Thierry is the one who
knows maps and patterns infrastructure in great details.

9 years agoBUG/MINOR: args: add name for ARGT_VAR
Willy Tarreau [Mon, 21 Sep 2015 18:57:12 +0000 (20:57 +0200)] 
BUG/MINOR: args: add name for ARGT_VAR

Commit 4834bc7 ("MEDIUM: vars: adds support of variables") introduced
ARGT_VAR but forgot to put it in the names array. No backport needed.

9 years agoBUG/MEDIUM: stick-tables: fix double-decrement of tracked entries
Willy Tarreau [Mon, 21 Sep 2015 15:48:24 +0000 (17:48 +0200)] 
BUG/MEDIUM: stick-tables: fix double-decrement of tracked entries

Mailing list participant "mlist" reported negative conn_cur values in
stick tables as the result of "tcp-request connection track-sc". The
reason is that after the stick entry it copied from the session to the
stream, both the session and the stream grab a reference to the entry
and when the stream ends, it decrements one reference and one connection,
then the same is done for the session.

In fact this problem was already encountered slightly differently in the
past and addressed by Thierry using the patch below as it was believed by
then to be only a refcount issue since it was the observable symptom :

   827752e "BUG/MEDIUM: stick-tables: refcount error after copying SC..."

In reality the problem is that the stream must touch neither the refcount
nor the connection count for entries it inherits from the session. While
we have no way to tell whether a track entry was inherited from the session
(since they're simply memcpy'd), it is possible to prevent the stream from
touching an entry that already exists in the session because that's a
guarantee that it was inherited from it.

Note that it may be a temporary fix. Maybe in the future when a session
gives birth to multiple streams we'll face a situation where a session may
be updated to add more tracked entries after instanciating some streams.
The correct long-term fix is to mark some tracked entries as shared or
private (or RO/RW). That will allow the session to track more entries
even after the same trackers are being used by early streams.

No backport is needed, this is only caused by the session/stream split in 1.6.

9 years agoDOC: update coding-style to reference checkpatch.pl
Willy Tarreau [Mon, 21 Sep 2015 14:36:15 +0000 (16:36 +0200)] 
DOC: update coding-style to reference checkpatch.pl

Running the Linux kernel's checkpatch.pl is actually quite efficient
at spotting style issues and even sometimes bugs. The doc now suggests
how to use it to avoid the warnings that are specific to Linux's stricter
rules.

It properly reports errors like the following ones that were found on
real submissions so it should improve the situation for everyone :

ERROR: "foo * bar" should be "foo *bar"
+static char * tcpcheck_get_step_comment(struct check *, int);

ERROR: do not use assignment in if condition
+                       if ((comment = tcpcheck_get_step_comment(check, step)))

WARNING: trailing semicolon indicates no statements, indent implies otherwise
+                       if (elem->data && elem->free);
+                               elem->free(elem->data);

ERROR: do not initialise statics to 0 or NULL
+static struct lru64_head *ssl_ctx_lru_tree = NULL;

ERROR: space required after that ',' (ctx:VxV)
+           !X509_gmtime_adj(X509_get_notAfter(newcrt),(long)60*60*24*365))
                                                      ^
WARNING: space prohibited between function name and open parenthesis '('
+       else if (EVP_PKEY_type (capkey->type) == EVP_PKEY_RSA)

ERROR: trailing statements should be on next line
+       if (cacert) X509_free(cacert);

ERROR: space prohibited after that open parenthesis '('
+                                       !(         (srv_op_state == SRV_ST_STOPPED)

9 years agoBUG/MAJOR: peers: fix a crash when stopping peers on unbound processes
Willy Tarreau [Mon, 21 Sep 2015 13:24:58 +0000 (15:24 +0200)] 
BUG/MAJOR: peers: fix a crash when stopping peers on unbound processes

Pradeep Jindal reported and troubleshooted a bug causing haproxy to die
during startup on all processes not making use of a peers section. It
only happens with nbproc > 1 when peers are declared. Technically it's
when the peers task is stopped on processes that don't use it that the
crash occurred (a task_free() called on a NULL task pointer).

This only affects peers v2 in the dev branch, no backport is needed.

9 years agoDOC: add a MAINTAINERS file
Willy Tarreau [Mon, 21 Sep 2015 13:21:09 +0000 (15:21 +0200)] 
DOC: add a MAINTAINERS file

This one indicates who to CC when sending changes affecting certain
parts of the product.

9 years agoMINOR: 51d: Improved string handling for LRU cache
James Rosewell [Fri, 18 Sep 2015 18:53:05 +0000 (19:53 +0100)] 
MINOR: 51d: Improved string handling for LRU cache

Removed use of strlen with the data added to and retrived from the cache
by using chunk structures instead of string pointers.

9 years agoMAJOR: 51d: Upgraded to support 51Degrees V3.2 and new features
James Rosewell [Fri, 18 Sep 2015 17:28:52 +0000 (18:28 +0100)] 
MAJOR: 51d: Upgraded to support 51Degrees V3.2 and new features

Trie device detection doesn't benefit from caching compared to Pattern.
As such the LRU cache has been removed from the Trie method.

A new fetch  method has been added named 51d.all which uses all the
available HTTP headers for device device detection. The previous 51d
conv method has been changed to 51d.single where one HTTP header,
typically User-Agent, is used for detection. This method is marginally
faster but less accurate.

Three new properties are available with the Pattern method called
Method, Difference and Rank which provide insight into the validity of
the results returned.

A pool of worksets is used to avoid needing to create a new workset for
every request. The workset pool is thread safe ready to support a future
multi threaded version of HAProxy.

9 years agoBUILD: Changed 51Degrees option to support V3.2
James Rosewell [Fri, 18 Sep 2015 16:24:29 +0000 (17:24 +0100)] 
BUILD: Changed 51Degrees option to support V3.2

Added support for city hash method, turned off multi threading support
and included maths library. Removed reference to compression library
which was never needed.

9 years agoDOC: Added more explanation for 51Degrees V3.2
James Rosewell [Fri, 18 Sep 2015 16:21:37 +0000 (17:21 +0100)] 
DOC: Added more explanation for 51Degrees V3.2

Changed examples to demonstrate the the new fetch and conv methods
available with the enhancements made in version 3.2 of 51Degrees.

Added reference to the accuracy indicators available with Pattern
detection method.

9 years agoMINOR: global: Added new fields for 51Degrees device detection
James Rosewell [Fri, 18 Sep 2015 16:13:47 +0000 (17:13 +0100)] 
MINOR: global: Added new fields for 51Degrees device detection

Added support for version 3.2 of 51Degrees C library.

Added fields to store HTTP header names important to device detection
other than User-Agent.

Included a pool of worksets for use with Pattern device detection.

9 years agoMINOR: http: made CHECK_HTTP_MESSAGE_FIRST accessible to other functions
James Rosewell [Fri, 18 Sep 2015 16:11:16 +0000 (17:11 +0100)] 
MINOR: http: made CHECK_HTTP_MESSAGE_FIRST accessible to other functions

Added the definition of CHECK_HTTP_MESSAGE_FIRST and the declaration of
smp_prefetch_http to the header.

Changed smp_prefetch_http implementation to remove the static qualifier.

9 years agoDOC: add a CONTRIBUTING file
Willy Tarreau [Sun, 20 Sep 2015 20:31:42 +0000 (22:31 +0200)] 
DOC: add a CONTRIBUTING file

This file tries to explain in the most detailed way how to contribute
patches. A few parts of it were moved from the README. .gitignore was
updated.

9 years agoDOC: add the documentation about internal circular lists
Willy Tarreau [Mon, 28 Jul 2003 23:16:05 +0000 (01:16 +0200)] 
DOC: add the documentation about internal circular lists

This file was recovered from the first project where it was born 12 years
ago, but it's still convenient to understand how our circular lists work,
so let's add it.

9 years agoDOC: servers state seamless reload example
Baptiste Assmann [Fri, 18 Sep 2015 14:38:21 +0000 (16:38 +0200)] 
DOC: servers state seamless reload example

A short doc + example to help people start using seamless reload for
server state

9 years agoMINOR: cli: new stats socket command: show backend
Baptiste Assmann [Fri, 18 Sep 2015 12:49:12 +0000 (14:49 +0200)] 
MINOR: cli: new stats socket command: show backend

new stats socket command which displays only the list of backends
available in the current process.
For now only the backend name is displayed.

9 years agoMINOR: server: startup slowstart task when using seamless reload of HAProxy
Baptiste Assmann [Thu, 17 Sep 2015 20:53:59 +0000 (22:53 +0200)] 
MINOR: server: startup slowstart task when using seamless reload of HAProxy

This patch uses the start up of the health check task to also start
the warmup task when required.

This is executed only once: when HAProxy has just started up and can
be started only if the load-server-state-from-file feature is enabled
and the server was in the warmup state before a reload occurs.

9 years agoMINOR: init: server state loaded from file
Baptiste Assmann [Fri, 14 Aug 2015 14:20:52 +0000 (16:20 +0200)] 
MINOR: init: server state loaded from file

With this patch, HAProxy reads the content of server state file and
update state of servers accordingly.

9 years agoDOC: load-server-state-from-file
Baptiste Assmann [Sun, 23 Aug 2015 09:45:29 +0000 (11:45 +0200)] 
DOC: load-server-state-from-file

9 years agoMINOR: config: new backend directives: load-server-state-from-file and server-state...
Baptiste Assmann [Wed, 19 Aug 2015 14:44:03 +0000 (16:44 +0200)] 
MINOR: config: new backend directives: load-server-state-from-file and server-state-file-name

This directive gives HAProxy the ability to use the either the global
server-state-file directive or a local one using server-state-file-name to
load server states.
The state can be saved right before the reload by the init script, using
the "show servers state" command on the stats socket redirecting output into
a file.

9 years agoDOC: new global directive: server-state-file
Baptiste Assmann [Sun, 23 Aug 2015 08:06:39 +0000 (10:06 +0200)] 
DOC: new global directive: server-state-file

Documentation related to a new global directive.
Purpose of this directive is to store a file path into the global
structure of HAProxy. The file pointed by the path may be used by
HAProxy to retrieve server state from the previous running process
after a reload occured.

9 years agoMINOR: config: new global section directive: server-state-file
Baptiste Assmann [Sun, 23 Aug 2015 07:54:31 +0000 (09:54 +0200)] 
MINOR: config: new global section directive: server-state-file

This new global section directive is used to store the path to the file
where HAProxy will be able to retrieve server states across reloads.

The file pointed by this path is used to store a file which can contains
state of all servers from all backends.

9 years agoDOC: global directive server-state-base
Baptiste Assmann [Sun, 23 Aug 2015 08:00:10 +0000 (10:00 +0200)] 
DOC: global directive server-state-base

Documentation relative to the new global directive server-state-file.

9 years agoMINOR: config: new global directive server-state-base
Baptiste Assmann [Sun, 23 Aug 2015 07:22:25 +0000 (09:22 +0200)] 
MINOR: config: new global directive server-state-base

This new global directive can be used to provide a base directory where
all the server state files could be loaded.
If a server state file name starts with a slash '/', then this directive
must not be applied.

9 years agoDOC: stats socket command: show servers state
Baptiste Assmann [Fri, 8 May 2015 17:35:08 +0000 (19:35 +0200)] 
DOC: stats socket command: show servers state

Documentation related to the new command available over the stats socket
"show servers state".

A description of the fields is also included.

9 years agoMINOR: cli: new stats socket command: show servers state
Baptiste Assmann [Fri, 3 Jul 2015 06:01:20 +0000 (08:01 +0200)] 
MINOR: cli: new stats socket command: show servers state

new command 'show servers state' which dumps all variable parameters
of a server during an HAProxy process life.
Purpose is to dump current server state at current run time in order to
read them right after the reload.

The format of the output is versionned and we support version 1 for now.

9 years agoMINOR: server: Macro definition for server-state
Baptiste Assmann [Fri, 8 May 2015 21:34:06 +0000 (23:34 +0200)] 
MINOR: server: Macro definition for server-state

Introduces a few new macros used by server state save and application accros reloads:
- currently used state server file format version
- currently used state server file header fields
- MIN and MAX value for version number
- maximum number of fields that could be found in a server-state file
- an arbitrary state-file max line length

9 years agoBUG/MAJOR: can't enable a server through the stat socket
Baptiste Assmann [Fri, 18 Sep 2015 08:30:03 +0000 (10:30 +0200)] 
BUG/MAJOR: can't enable a server through the stat socket

When a server is disabled in the configuration using the "disabled"
keyword, a single flag is positionned: SRV_ADMF_CMAINT (use to be
SRV_ADMF_FMAINT)..
That said, when providing the first version of this code, we also
changed the SRV_ADMF_MAINT mask to match any of the possible MAINT
cases: SRV_ADMF_FMAINT, SRV_ADMF_IMAINT, SRV_ADMF_CMAINT

Since SRV_ADMF_CMAINT is never (and is not supposed to be) altered at
run time, once a server has this flag set up, it can never ever be
enabled again using the stats socket.

In order to fix this, we should:
- consider SRV_ADMF_CMAINT as a simple flag to report the state in the
  old configuration file (will be used after a reload to deduce the
  state of the server in a new running process)
- enabling both SRV_ADMF_CMAINT and SRV_ADMF_FMAINT when the keyword
  "disabled" is in use in the configuration
- update the mask SRV_ADMF_MAINT as it was before, to only match
  SRV_ADMF_FMAINT and SRV_ADMF_IMAINT.

The following patch perform the changes above.
It allows fixing the regression without breaking the way the up coming
feature (seamless server state accross reloads) is going to work.

Note: this is 1.6-only, no backport needed.

9 years agoMINOR: support cpu-map feature through the compile option USE_CPU_AFFINITY on FreeBSD
Pieter Baauw [Thu, 17 Sep 2015 19:26:40 +0000 (21:26 +0200)] 
MINOR: support cpu-map feature through the compile option USE_CPU_AFFINITY on FreeBSD

9 years agoDOC: add references to rise/fall for the fastinter explanation
Pieter Baauw [Thu, 17 Sep 2015 19:30:46 +0000 (21:30 +0200)] 
DOC: add references to rise/fall for the fastinter explanation

9 years agoBUG/MINOR: lua: breaks the log message if his size exceed one buffer
Thierry FOURNIER [Wed, 16 Sep 2015 10:47:03 +0000 (12:47 +0200)] 
BUG/MINOR: lua: breaks the log message if his size exceed one buffer

Previously, the log was ignored if the log message exceed one buffer.
This patch doens't ignore the log, but trancate the message.

9 years agoBUG/MAJOR: lua: potential unexpected aborts()
Thierry FOURNIER [Thu, 17 Sep 2015 09:36:37 +0000 (11:36 +0200)] 
BUG/MAJOR: lua: potential unexpected aborts()

This couple of function executes securely some Lua calls outside of
the lua runtime environment. Each Lua call can return a longjmp
if it encounter a memory error.

Lua documentation extract:

   If an error happens outside any protected environment, Lua calls
   a panic function (see lua_atpanic) and then calls abort, thus
   exiting the host application. Your panic function can avoid this
   exit by never returning (e.g., doing a long jump to your own
   recovery point outside Lua).

   The panic function runs as if it were a message handler (see
   Â§2.3); in particular, the error message is at the top of the
   stack. However, there is no guarantee about stack space. To push
   anything on the stack, the panic function must first check the
   available space (see Â§4.2).

We must check all the Lua entry point. This includes:
 - The include/proto/hlua.h exported functions
 - the task wrapper function
 - The action wrapper function
 - The converters wrapper function
 - The sample-fetch wrapper functions

It is tolerated that the initilisation function returns an abort.
Before each Lua abort, an error message is writed on stderr.

The macro SET_SAFE_LJMP initialise the longjmp. The Macro
RESET_SAFE_LJMP reset the longjmp. These function must be macro
because they must be exists in the program stack when the longjmp
is called

9 years ago[RELEASE] Released version 1.6-dev5 v1.6-dev5
Willy Tarreau [Mon, 14 Sep 2015 10:23:10 +0000 (12:23 +0200)] 
[RELEASE] Released version 1.6-dev5

Released version 1.6-dev5 with the following main changes :
    - MINOR: dns: dns_resolution structure update: time_t to unsigned int
    - BUG/MEDIUM: dns: DNS resolution doesn't start
    - BUG/MAJOR: dns: dns client resolution infinite loop
    - MINOR: dns: coding style update
    - MINOR: dns: new bitmasks to use against DNS flags
    - MINOR: dns: dns_nameserver structure update: new counter for truncated response
    - MINOR: dns: New DNS response analysis code: DNS_RESP_TRUNCATED
    - MEDIUM: dns: handling of truncated response
    - MINOR: DNS client query type failover management
    - MINOR: dns: no expected DNS record type found
    - MINOR: dns: new flag to report that no IP can be found in a DNS response packet
    - BUG/MINOR: DNS request retry counter used for retry only
    - DOC: DNS documentation updated
    - MEDIUM: actions: remove ACTION_STOP
    - BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2 (bis)
    - BUG/MINOR: lua: last log character truncated.
    - CLEANUP: typo: bad indent
    - CLEANUP: actions: missplaced includes
    - MINOR: build: missing header
    - CLEANUP: lua: Merge log functions
    - BUG/MAJOR: http: don't manipulate the server connection if it's killed
    - BUG/MINOR: http: remove stupid HTTP_METH_NONE entry
    - BUG/MAJOR: http: don't call http_send_name_header() after an error
    - MEDIUM: tools: make str2sa_range() optionally return the FQDN
    - BUG/MINOR: tools: make str2sa_range() report unresolvable addresses
    - BUG/MEDIUM: dns: use the correct server hostname when resolving

9 years agoCLEANUP: lua: Merge log functions
Thierry FOURNIER [Fri, 11 Sep 2015 17:15:43 +0000 (19:15 +0200)] 
CLEANUP: lua: Merge log functions

All the code which emits error log have the same pattern. Its:
Send log with syslog system, and if it is allowed, display error
log on screen.

This patch replace this pattern by a macro. This reduces the number
of lines.

9 years agoMINOR: build: missing header
Thierry FOURNIER [Fri, 11 Sep 2015 06:33:33 +0000 (08:33 +0200)] 
MINOR: build: missing header

Regex header file is missing in types/action.h

Repported by Conrad Hoffmann

I cannot build the current dev's master HEAD (ec3c37d) because of this error:

> In file included from include/proto/proto_http.h:26:0,
>                  from src/stick_table.c:26:
> include/types/action.h:102:20: error: field Ã¢\80\98reâ\80\99 has incomplete type
>     struct my_regex re;    /* used by replace-header and replace-value */
>                     ^
> Makefile:771: recipe for target 'src/stick_table.o' failed
> make: *** [src/stick_table.o] Error 1

The struct act_rule defined in action.h includes a full struct my_regex
without #include-ing regex.h. Both gcc 5.2.0 and clang 3.6.2 do not allow this.

9 years agoCLEANUP: actions: missplaced includes
Thierry FOURNIER [Thu, 10 Sep 2015 16:28:10 +0000 (18:28 +0200)] 
CLEANUP: actions: missplaced includes

The include of action.h are misplaced.

9 years agoCLEANUP: typo: bad indent
Thierry FOURNIER [Fri, 4 Sep 2015 16:40:36 +0000 (18:40 +0200)] 
CLEANUP: typo: bad indent

A space alignment remains in the stream_interface.c file

9 years agoDOC: DNS documentation updated
Baptiste Assmann [Tue, 8 Sep 2015 23:11:36 +0000 (01:11 +0200)] 
DOC: DNS documentation updated

More information regarding DNS resolution:
- behavior in case of errors
- behavior when multiple name servers are configured in a resolvers
  section
- when a retry is performed
- when a query type change is performed
- make it clear that DNS resolution requires health checking enabled
  on the server

9 years agoBUG/MINOR: DNS request retry counter used for retry only
Baptiste Assmann [Tue, 8 Sep 2015 22:54:38 +0000 (00:54 +0200)] 
BUG/MINOR: DNS request retry counter used for retry only

There are two types of retries when performing a DNS resolution:
1. retry because of a timeout
2. retry of the full sequence of requests (query types failover)

Before this patch, the 'resolution->try' counter was incremented
after each send of a DNS request, which does not cover the 2 cases
above.
This patch fix this behavior.

9 years agoMINOR: dns: new flag to report that no IP can be found in a DNS response packet
Baptiste Assmann [Tue, 8 Sep 2015 22:51:08 +0000 (00:51 +0200)] 
MINOR: dns: new flag to report that no IP can be found in a DNS response packet

Some DNS response may be valid from a protocol point of view but may not
contain any IP addresses.
This patch gives a new flag to the function dns_get_ip_from_response to
report such case.
It's up to the upper layer to decide what to do with this information.

9 years agoMINOR: dns: no expected DNS record type found
Baptiste Assmann [Tue, 8 Sep 2015 22:46:58 +0000 (00:46 +0200)] 
MINOR: dns: no expected DNS record type found

Some DNS responses may be valid from a protocol point of view, but may
not contain any information considered as interested by the requester..
Purpose of the flag DNS_RESP_NO_EXPECTED_RECORD introduced by this patch is
to allow reporting such situation.

When this happens, a new DNS query is sent with a new query type.

For now, the function only expect A and AAAA query types which is enough
to cover current cases.
In a next future, it will be up to the caller to tell the function which
query types are expected.

9 years agoBUG/MINOR: lua: last log character truncated.
Thierry FOURNIER [Wed, 9 Sep 2015 09:21:37 +0000 (11:21 +0200)] 
BUG/MINOR: lua: last log character truncated.

The send_log function needs a final \n.

This bug is repported by Michael Ezzell.

Minor bug: when writing to syslog from Lua scripts, the last character from
each log entry is truncated.

core.Alert("this is truncated");

Sep  7 15:07:56 localhost haproxy[7055]: this is truncate

This issue appears to be related to the fact that send_log() (in src/log.c)
is expecting a newline at the end of the message's format string:

/*
 * This function adds a header to the message and sends the syslog message
 * using a printf format string. It expects an LF-terminated message.
 */
void send_log(struct proxy *p, int level, const char *format, ...)

I believe the fix would be in in src/hlua.c at line 760
<http://git.haproxy.org/?p=haproxy.git;a=blob;f=src/hlua.c;h=1e4d47c31e66c16c837ff2aa5ef577f6cafdc7e7;hb=316e3196285b89a917c7d84794ced59a6a5b4eba#l760>,
where this...

   send_log(px, level, "%s", trash.str);

...should be adding a newline into the format string to accommodate what
the code expects.

    send_log(px, level, "%s\n", trash.str);

This change provides what seems to be the correct behavior:

Sep  7 15:08:30 localhost haproxy[7150]: this is truncated

All other uses of send_log() in hlua.c have a trailing dot "." in the
message that is masking the truncation issue because the output message
stops on a clean word boundary.  I suspect these would also benefit from
"\n" appended to their format strings as well, since this appears to be the
pattern seen throughout the rest of the code base.

Reported-by: Michael Ezzell <michael@ezzell.net>
9 years agoBUG/MEDIUM: dns: use the correct server hostname when resolving
Willy Tarreau [Tue, 8 Sep 2015 14:16:35 +0000 (16:16 +0200)] 
BUG/MEDIUM: dns: use the correct server hostname when resolving

The server's host name picked for resolution was incorrect, it did not
skip the address family specifier, did not resolve environment variables,
and messed up with the optional trailing colon.

Instead, let's get the fqdn returned by str2sa_range() and use that
exclusively.

9 years agoBUG/MINOR: tools: make str2sa_range() report unresolvable addresses
Willy Tarreau [Tue, 8 Sep 2015 14:01:25 +0000 (16:01 +0200)] 
BUG/MINOR: tools: make str2sa_range() report unresolvable addresses

If an environment variable is used in an address, and is not set, it's
silently considered as ":" or "0.0.0.0:0" which is not correct as it
can hide environment issues and lead to unexpected behaviours. Let's
report this case when it happens.

This fix should be backported to 1.5.

9 years agoMEDIUM: tools: make str2sa_range() optionally return the FQDN
Willy Tarreau [Tue, 8 Sep 2015 13:50:19 +0000 (15:50 +0200)] 
MEDIUM: tools: make str2sa_range() optionally return the FQDN

The function does a bunch of things among which resolving environment
variables, skipping address family specifiers and trimming port ranges.
It is the only one which sees the complete host name before trying to
resolve it. The DNS resolving code needs to know the original hostname,
so we modify this function to optionally provide it to the caller.

Note that the function itself doesn't know if the host part was a host
or an address, but str2ip() knows that and can be asked not to try to
resolve. So we first try to parse the address without resolving and
try again with resolving enabled. This way we know if the address is
explicit or needs some kind of resolution.

9 years agoMINOR: DNS client query type failover management
Baptiste Assmann [Wed, 2 Sep 2015 20:20:56 +0000 (22:20 +0200)] 
MINOR: DNS client query type failover management

In the first version of the DNS resolver, HAProxy sends an ANY query
type and in case of issue fails over to the type pointed by the
directive in 'resolve-prefer'.
This patch allows the following new failover management:
1. default query type is still ANY
2. if response is truncated or in error because ANY is not supported by
   the server, then a fail over to a new query type is performed. The
   new query type is the one pointed by the directive 'resolve-prefer'.
3. if no response or still some errors occurs, then a query type fail over
   is performed to the remaining IP address family.

9 years agoMEDIUM: dns: handling of truncated response
Baptiste Assmann [Wed, 2 Sep 2015 20:08:38 +0000 (22:08 +0200)] 
MEDIUM: dns: handling of truncated response

First dns client implementation simply ignored most of DNS response
flags.
This patch changes the way the flags are parsed, using bit masks and
also take care of truncated responses.
Such response are reported to the above layer which can handle it
properly.

9 years agoMINOR: dns: New DNS response analysis code: DNS_RESP_TRUNCATED
Baptiste Assmann [Wed, 2 Sep 2015 19:58:32 +0000 (21:58 +0200)] 
MINOR: dns: New DNS response analysis code: DNS_RESP_TRUNCATED

This patch introduces a new internal response state about the analysis
of a DNS response received by a server.
It is dedicated to report to above layer that the response is
'truncated'.

9 years agoMINOR: dns: dns_nameserver structure update: new counter for truncated response
Baptiste Assmann [Wed, 2 Sep 2015 19:56:05 +0000 (21:56 +0200)] 
MINOR: dns: dns_nameserver structure update: new counter for truncated response

This patch updates the dns_nameserver structure to integrate a counter
dedicated to 'truncated' response sent by servers.
Such response are important to track, since HAProxy is supposed to
replay its request.

9 years agoMINOR: dns: new bitmasks to use against DNS flags
Baptiste Assmann [Wed, 2 Sep 2015 19:52:37 +0000 (21:52 +0200)] 
MINOR: dns: new bitmasks to use against DNS flags

Current DNS client code implementation doesn't take care of response
flags setup by the server.
This patch introduces a couple of bitmasks one can use to retrieve the
truncated flag and the reply code available in the 2-bytes flag field.

9 years agoMINOR: dns: coding style update
Baptiste Assmann [Wed, 2 Sep 2015 20:05:24 +0000 (22:05 +0200)] 
MINOR: dns: coding style update

No affectation in a if condition.

9 years agoBUG/MAJOR: dns: dns client resolution infinite loop
Baptiste Assmann [Wed, 2 Sep 2015 20:15:58 +0000 (22:15 +0200)] 
BUG/MAJOR: dns: dns client resolution infinite loop

Under certain circonstance (a configuration with many servers relying on
DNS resolution and one of them triggering the replay of a request
because of a timeout or invalid response to an ANY query), HAProxy could
end up in an infinite loop over the currently supposed running DNS
queries.

This was caused because the FIFO list of running queries was improperly
updated in snr_resolution_error_cb. The head of the list was removed
instead of the resolution in error, when moving the resolution to the
end of the list.

In the mean time, a LIST_DEL statement is removed since useless. This
action is already performed by the dns_reset_resolution function.

9 years agoBUG/MEDIUM: dns: DNS resolution doesn't start
Baptiste Assmann [Thu, 3 Sep 2015 08:59:39 +0000 (10:59 +0200)] 
BUG/MEDIUM: dns: DNS resolution doesn't start

Patch f046f1156149d3d8563cc45d7608f2c42ef5b596 introduced a regression:
DNS resolution doesn't start anymore, while it was supposed to make it
start with first health check.

Current patch fix this issue by triggering a new DNS resolution if the
last_resolution time is not set.

9 years agoMINOR: dns: dns_resolution structure update: time_t to unsigned int
Baptiste Assmann [Thu, 3 Sep 2015 08:55:20 +0000 (10:55 +0200)] 
MINOR: dns: dns_resolution structure update: time_t to unsigned int

3 variables of the dns_resolution structure are set to 'time_t' type.
Since they are all set by 'now_ms' and used as 'ticks' in HAProxy's
internal, it is safer to set them to the same type than now_ms:
'unsigned int'.

9 years agoBUG/MAJOR: http: don't call http_send_name_header() after an error
Willy Tarreau [Mon, 7 Sep 2015 17:32:33 +0000 (19:32 +0200)] 
BUG/MAJOR: http: don't call http_send_name_header() after an error

A crash was reported when using the "famous" http-send-name-header
directive. This time it's a bit tricky, it requires a certain number of
conditions to be met including maxconn on a server, queuing, timeout in
the queue and cookie-based persistence.

The problem is that in stream.c, before calling http_send_name_header(),
we check a number of conditions to know if we have to replace the header
name. But prior to reaching this place, it's possible for
sess_update_stream_int() to fail and change the stream-int's state to
SI_ST_CLO, send an error 503 to the client, and flush all buffers. But
http_send_name_header() can only be called with valid buffer contents
matching the http_msg's description. So when it rewinds the stream to
modify the header, buf->o becomes negative by the size of the incoming
request and is used as the argument to memmove() which basically
displaces 4GB of memory off a few bytes to write the new name, resulting
in a core and a core file that's really not fun to play with.

The solution obviously consists in refraining from calling this nasty
function when the stream interface is already closed.

This bug also affects 1.5 and possibly 1.4, so the fix must be backported
there.

9 years agoBUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2 (bis)
Thierry FOURNIER [Fri, 4 Sep 2015 16:25:53 +0000 (18:25 +0200)] 
BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2 (bis)

See commit id bdc97a8795c52af94683db25a4984578e26f4857

Michael Ezzell reported that the following Lua code fails in
dev4 when the TCP is not established immediately (due to a little
bit of latency):

   function tricky_socket()
        local sock = core.tcp();
        sock:settimeout(3);
        core.log(core.alert,"calling connect()\n");
        local connected, con_err = sock:connect("x.x.x.x",80);
        core.log(core.alert,"returned from connect()\n");
        if con_err ~= nil then
          core.log(core.alert,"connect() failed with error: '" .. con_err .. "'\n");
        end

The problem is that the flags who want to wake up the applet are
resetted before each applet call, so the applet must set again the
flags if the connection is not established.

9 years agoBUG/MINOR: http: remove stupid HTTP_METH_NONE entry
Willy Tarreau [Thu, 3 Sep 2015 15:15:21 +0000 (17:15 +0200)] 
BUG/MINOR: http: remove stupid HTTP_METH_NONE entry

When converting the "method" fetch to a string, we used to get an empty
string if the first character was not an upper case. This was caused by
the lookup function which returns HTTP_METH_NONE when a lookup is not
possible, and this method being mapped to an empty string in the array.

This is a totally stupid mechanism, there's no reason for having the
result depend on the first char. In fact the message parser already
checks that the syntax matches an HTTP token so we can only land there
with a valid token, hence only HTTP_METH_OTHER should be returned.

This fix should be backported to all actively supported branches.

9 years agoMEDIUM: actions: remove ACTION_STOP
Thierry FOURNIER [Wed, 2 Sep 2015 15:17:33 +0000 (17:17 +0200)] 
MEDIUM: actions: remove ACTION_STOP

Before this patch, two type of custom actions exists: ACT_ACTION_CONT and
ACT_ACTION_STOP. ACT_ACTION_CONT is a non terminal action and ACT_ACTION_STOP is
a terminal action.

Note that ACT_ACTION_STOP is not used in HAProxy.

This patch remove this behavior. Only type type of custom action exists, and it
is called ACT_CUSTOM. Now, the custion action can return a code indicating the
required behavior. ACT_RET_CONT wants that HAProxy continue the current rule
list evaluation, and ACT_RET_STOP wants that HAPRoxy stops the the current rule
list evaluation.

9 years agoBUG/MAJOR: http: don't manipulate the server connection if it's killed
Willy Tarreau [Wed, 2 Sep 2015 08:40:43 +0000 (10:40 +0200)] 
BUG/MAJOR: http: don't manipulate the server connection if it's killed

Jesse Hathaway reported a crash that Cyril Bonté diagnosed as being
caused by the manipulation of srv_conn after setting it to NULL. This
happens in http-server-close mode when the server returns either a 401
or a 407, because the connection was previously closed then it's being
assigned the CO_FL_PRIVATE flag.

This bug only affects 1.6-dev as it was introduced by connection reuse code
with commit 387ebf8 ("MINOR: connection: add a new flag CO_FL_PRIVATE").

9 years ago[RELEASE] Released version 1.6-dev4 v1.6-dev4
Willy Tarreau [Sat, 29 Aug 2015 22:17:17 +0000 (00:17 +0200)] 
[RELEASE] Released version 1.6-dev4

Released version 1.6-dev4 with the following main changes :
    - MINOR: log: Add log-format variable %HQ, to log HTTP query strings
    - DOC: typo in 'redirect', 302 code meaning
    - DOC: typos in tcp-check expect examples
    - DOC: resolve-prefer default value and default-server update
    - MINOR: DNS counters: increment valid counter
    - BUG/MEDIUM: DNS resolution response parsing broken
    - MINOR: server: add new SRV_ADMF_CMAINT flag
    - MINOR: server SRV_ADMF_CMAINT flag doesn't imply SRV_ADMF_FMAINT
    - BUG/MEDIUM: dns: wrong first time DNS resolution
    - BUG/MEDIUM: lua: Lua tasks fail to start.
    - BUILD: add USE_LUA to BUILD_OPTIONS when it's used
    - DOC/MINOR: fix OpenBSD versions where haproxy works
    - MINOR: 51d: unable to start haproxy without "51degrees-data-file"
    - BUG/MEDIUM: peers: fix wrong message id on stick table updates acknowledgement.
    - BUG/MAJOR: peers: fix current table pointer not re-initialized on session release.
    - BUILD: ssl: Allow building against libssl without SSLv3.
    - DOC: clarify some points about SSL and the proxy protocol
    - DOC: mention support for RFC 5077 TLS Ticket extension in starter guide
    - BUG/MEDIUM: mailer: DATA part must be terminated with <CRLF>.<CRLF>
    - DOC: match several lua configuration option names to those implemented in code
    - MINOR cfgparse: Correct the mailer warning text to show the right names to the user
    - BUG/MINOR: ssl: TLS Ticket Key rotation broken via socket command
    - MINOR: stream: initialize the current_rule field to NULL on stream init
    - BUG/MEDIUM: lua: timeout error with converters, wrapper and actions.
    - CLEANUP: proto_http: remove useless initialisation
    - CLEANUP: http/tcp actions: remove the scope member
    - BUG/MINOR: proto_tcp: custom action continue is ignored
    - MINOR: proto_tcp: add session in the action prototype
    - MINOR: vars: reduce the code size of some wrappers
    - MINOR: Move http method enum from proto_http to sample
    - MINOR: sample: Add ipv6 to ipv4 and sint to ipv6 casts
    - MINOR: sample/proto_tcp: export "smp_fetch_src"
    - MEDIUM: cli: rely on the map's output type instead of the sample type
    - BUG/MEDIUM: stream: The stream doen't inherit SC from the session
    - BUG/MEDIUM: vars: segfault during the configuration parsing
    - BUG/MEDIUM: stick-tables: refcount error after copying SC for the session to the stream
    - BUG/MEDIUM: lua: bad error processing
    - MINOR: samples: rename a struct from sample_storage to sample_data
    - MINOR: samples: rename some struct member from "smp" to "data"
    - MEDIUM: samples: Use the "struct sample_data" in the "struct sample"
    - MINOR: samples: extract the anonymous union and create the union sample_value
    - MINOR: samples: rename union from "data" to "u"
    - MEDIUM: 51degrees: Adapt the 51Degrees library
    - MINOR: samples: data assignation simplification
    - MEDIUM: pattern/map: Maps can returns various types
    - MINOR: map: The map can return IPv4 and IPv6
    - MEDIUM: actions: Merge (http|tcp)-(request|reponse) action structs
    - MINOR: actions: Remove the data opaque pointer
    - MINOR: lua: use the hlua_rule type in place of opaque type
    - MINOR: vars: use the vars types as argument in place of opaque type
    - MINOR: proto_http: use an "expr" type in place of generic opaque type.
    - MINOR: proto_http: replace generic opaque types by real used types for the actions on thr request line
    - MINOR: proto_http: replace generic opaque types by real used types in "http_capture"
    - MINOR: proto_http: replace generic opaque types by real used types in "http_capture" by id
    - MEDIUM: track-sc: Move the track-sc configuration storage in the union
    - MEDIUM: capture: Move the capture configuration storage in the union
    - MINOR: actions: add "from" information
    - MINOR: actions: remove the mark indicating the last entry in enum
    - MINOR: actions: Declare all the embedded actions in the same header file
    - MINOR: actions: change actions names
    - MEDIUM: actions: Add standard return code for the action API
    - MEDIUM: actions: Merge (http|tcp)-(request|reponse) keywords structs
    - MINOR: proto_tcp: proto_tcp.h is now useles
    - MINOR: actions: mutualise the action keyword lookup
    - MEDIUM: actions: Normalize the return code of the configuration parsers
    - MINOR: actions: Remove wrappers
    - MAJOR: stick-tables: use sample types in place of dedicated types
    - MEDIUM: stick-tables: use the sample type names
    - MAJOR: stick-tables: remove key storage from the key struct
    - MEDIUM: stick-tables: Add GPT0 in the stick tables
    - MINOR: stick-tables: Add GPT0 access
    - MINOR: stick-tables: Add GPC0 actions
    - BUG/MEDIUM: lua: the lua fucntion Channel:close() causes a segfault
    - DOC: ssl: missing LF
    - MINOR: lua: add core.done() function
    - DOC: fix function name
    - BUG/MINOR: lua: in some case a sample may remain undefined
    - DOC: fix "http_action_set_req_line()" comments
    - MINOR: http: Action for manipulating the returned status code.
    - MEDIUM: lua: turns txn:close into txn:done
    - BUG/MEDIUM: lua: cannot process more Lua hooks after a "done()" function call
    - BUILD: link with libdl if needed for Lua support
    - CLEANUP: backend: factor out objt_server() in connect_server()
    - MEDIUM: backend: don't call si_alloc_conn() when we reuse a valid connection
    - MEDIUM: stream-int: simplify si_alloc_conn()
    - MINOR: stream-int: add new function si_detach_endpoint()
    - MINOR: server: add a list of private idle connections
    - MINOR: connection: add a new list member in the connection struct
    - MEDIUM: stream-int: queue idle connections at the server
    - MINOR: stream-int: make si_idle_conn() only accept valid connections
    - MINOR: server: add a list of already used idle connections
    - MINOR: connection: add a new flag CO_FL_PRIVATE
    - MINOR: config: add new setting "http-reuse"
    - MAJOR: backend: initial work towards connection reuse
    - MAJOR: backend: improve the connection reuse mechanism
    - MEDIUM: backend: implement "http-reuse safe"
    - MINOR: server: add a list of safe, already reused idle connections
    - MEDIUM: backend: add the "http-reuse aggressive" strategy
    - DOC: document the new http-reuse directive
    - DOC: internals: document next steps for HTTP connection reuse
    - DOC: mention that %ms is left-padded with zeroes.
    - MINOR: init: indicate to check 'bind' lines when no listeners were found.
    - MAJOR: http: remove references to appsession
    - CLEANUP: config: remove appsession initialization
    - CLEANUP: appsession: remove appsession.c and sessionhash.c
    - CLEANUP: tests: remove sessionhash_test.c and test-cookie-appsess.cfg
    - CLEANUP: proxy: remove last references to appsession
    - CLEANUP: appsession: remove the last include files
    - DOC: remove documentation about appsession
    - CLEANUP: .gitignore: ignore more test files
    - CLEANUP: .gitignore: finally ignore everything but what is known.
    - MEDIUM: config: emit a warning on a frontend without listener
    - DOC: add doc/internals/entities-v2.txt
    - DOC: add doc/linux-syn-cookies.txt
    - DOC: add design thoughts on HTTP/2
    - DOC: add some thoughts on connection sharing for HTTP/2
    - DOC: add design thoughts on dynamic buffer allocation
    - BUG/MEDIUM: counters: ensure that src_{inc,clr}_gpc0 creates a missing entry
    - DOC: add new file intro.txt
    - MAJOR: tproxy: remove support for cttproxy
    - BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2
    - DOC: lua: replace txn:close with txn:done in lua-api
    - DOC: intro: minor updates and fixes
    - DOC: intro: fix too long line.
    - DOC: fix example of http-request using ssl_fc_session_id
    - BUG/MEDIUM: lua: txn:done() still causes a segfault in TCP mode
    - CLEANUP: lua: fix some indent issues
    - BUG/MEDIUM: lua: fix a segfault in txn:done() if called twice
    - DOC: lua: mention than txn:close was renamed txn:done.

9 years agoBUG/MEDIUM: dns: wrong first time DNS resolution
Baptiste Assmann [Thu, 27 Aug 2015 20:12:46 +0000 (22:12 +0200)] 
BUG/MEDIUM: dns: wrong first time DNS resolution

First DNS resolution is supposed to be triggered by first health check,
which is not the case with current code.
This patch fixes this behavior by setting the
resolution->last_resolution time to 0 instead of now_ms when parsing
server's configuration at startup.

9 years agoDOC: lua: mention than txn:close was renamed txn:done.
Willy Tarreau [Fri, 28 Aug 2015 08:39:11 +0000 (10:39 +0200)] 
DOC: lua: mention than txn:close was renamed txn:done.

Also indicate that it's not limited to error processing.

9 years agoBUG/MEDIUM: lua: fix a segfault in txn:done() if called twice
Willy Tarreau [Fri, 28 Aug 2015 08:06:15 +0000 (10:06 +0200)] 
BUG/MEDIUM: lua: fix a segfault in txn:done() if called twice

When called from an http ruleset, txn:done() can still crash the process
because it closes the stream without consuming pending data resulting in
the transaction's buffer representation to differ from the real buffer.

This patch also adjusts the transaction's state to indicate that it's
closed to be consistent with what's already done in redirect rules.

9 years agoCLEANUP: lua: fix some indent issues
Willy Tarreau [Fri, 28 Aug 2015 08:14:59 +0000 (10:14 +0200)] 
CLEANUP: lua: fix some indent issues

Just the result from a few copy-pastes with different tab sizes.

9 years agoBUG/MEDIUM: lua: cannot process more Lua hooks after a "done()" function call
Thierry FOURNIER [Fri, 28 Aug 2015 07:54:13 +0000 (09:54 +0200)] 
BUG/MEDIUM: lua: cannot process more Lua hooks after a "done()" function call

When the Lua execution flow endswith the command done (core.done or txn.done())
an error is detourned, and the stack is no longer usable. This patch juste
reinitilize the stack if this case is detected.

9 years agoBUG/MEDIUM: lua: txn:done() still causes a segfault in TCP mode
Willy Tarreau [Fri, 28 Aug 2015 07:40:04 +0000 (09:40 +0200)] 
BUG/MEDIUM: lua: txn:done() still causes a segfault in TCP mode

We must not dereference s->txn to get the channel, as it doesn't
exist in TCP mode.

9 years agoDOC: fix example of http-request using ssl_fc_session_id
Willy Tarreau [Thu, 27 Aug 2015 15:15:05 +0000 (17:15 +0200)] 
DOC: fix example of http-request using ssl_fc_session_id

It was missing the ",hex" resulting in raw binary data being dumped in
the header or the logs. Now we know where these crazy logs originated
from!

9 years agoDOC: intro: fix too long line.
Willy Tarreau [Thu, 27 Aug 2015 14:30:53 +0000 (16:30 +0200)] 
DOC: intro: fix too long line.

dconv detected one line > 80 chars.

9 years agoDOC: intro: minor updates and fixes
Willy Tarreau [Thu, 27 Aug 2015 12:44:43 +0000 (14:44 +0200)] 
DOC: intro: minor updates and fixes

- temporarily remove reference to management.txt which doesn't exist yet
- minor update to the lb intro
- indicate that e-mails can be sent to notify about server state change

9 years agoDOC: lua: replace txn:close with txn:done in lua-api
Willy Tarreau [Thu, 27 Aug 2015 12:57:04 +0000 (14:57 +0200)] 
DOC: lua: replace txn:close with txn:done in lua-api

It was missed in the last patch.

9 years agoMEDIUM: lua: turns txn:close into txn:done
Thierry FOURNIER [Wed, 26 Aug 2015 06:42:21 +0000 (08:42 +0200)] 
MEDIUM: lua: turns txn:close into txn:done

The function txn:close() must be terminal because it demands the session
destruction. This patch renames this function to "done()" to be much
clearer about the fact that it is a final operation.

9 years agoMINOR: http: Action for manipulating the returned status code.
Thierry FOURNIER [Wed, 26 Aug 2015 14:21:56 +0000 (16:21 +0200)] 
MINOR: http: Action for manipulating the returned status code.

This patch is inspired by Bowen Ni's proposal and it is based on his first
implementation:

   With Lua integration in HAProxy 1.6, one can change the request method,
   path, uri, header, response header etc except response line.
   I'd like to contribute the following methods to allow modification of the
   response line.

   [...]

   There are two new keywords in 'http-response' that allows you to rewrite
   them in the native HAProxy config. There are also two new APIs in Lua that
   allows you to do the same rewriting in your Lua script.

   Example:
   Use it in HAProxy config:
   *http-response set-code 404*
   Or use it in Lua script:
   *txn.http:res_set_reason("Redirect")*

I dont take the full patch because the manipulation of the "reason" is useless.
standard reason are associated with each returned code, and unknown code can
take generic reason.

So, this patch can set the status code, and the reason is automatically adapted.

9 years agoDOC: fix "http_action_set_req_line()" comments
Thierry FOURNIER [Wed, 26 Aug 2015 14:23:34 +0000 (16:23 +0200)] 
DOC: fix "http_action_set_req_line()" comments

Bowen repports errors about http_action_set_req_line() comments.
Some other errors appears from the patches about "actions" reorganisation.

9 years agoBUG/MINOR: lua: in some case a sample may remain undefined
Thierry FOURNIER [Wed, 26 Aug 2015 12:19:03 +0000 (14:19 +0200)] 
BUG/MINOR: lua: in some case a sample may remain undefined

When we transform a top stack entry in sample, the empty stack case
is not handled. This patch fix this behavior.

9 years agoDOC: fix function name
Thierry FOURNIER [Wed, 26 Aug 2015 12:20:58 +0000 (14:20 +0200)] 
DOC: fix function name

Bowen repports this typo fix about one Lua function name.

Reported-By: Bowen
9 years agoMINOR: lua: add core.done() function
Thierry FOURNIER [Tue, 25 Aug 2015 22:14:17 +0000 (00:14 +0200)] 
MINOR: lua: add core.done() function

This function immediately give back the control to HAProxy core.

9 years agoDOC: ssl: missing LF
Thierry FOURNIER [Wed, 26 Aug 2015 06:21:26 +0000 (08:21 +0200)] 
DOC: ssl: missing LF

An error message miss LF

9 years agoBUG/MEDIUM: lua: the lua fucntion Channel:close() causes a segfault
Thierry FOURNIER [Mon, 24 Aug 2015 15:23:45 +0000 (17:23 +0200)] 
BUG/MEDIUM: lua: the lua fucntion Channel:close() causes a segfault

The function dont remove remaineing analysers and dont update response
channel timeout.

The fix is a copy of the behavior of the functions http_apply_redirect_rule()
and stream_int_retnclose().

9 years agoBUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2
Willy Tarreau [Mon, 24 Aug 2015 13:42:28 +0000 (15:42 +0200)] 
BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2

Tsvetan Tsvetanov reported that the following Lua code fails in
dev2 and dev3 :

function hello(txn)
    local request_msg = txn.req:dup()
    local tsm_sock = core.tcp()
    tsm_sock:connect("127.0.0.1", 7777)
    local res = tsm_sock:send(request_msg)
    local response = tsm_sock:receive('*l')
    txn.res:send(response)
    txn:close()
end

Thierry diagnosed that it was caused by commit 563cc37 ("MAJOR: stream:
use a regular ->update for all stream interfaces"). It broke lua's
ability to establish outgoing connections.

The reason is that the applet used to be notified about established
connections just after the stream analyser loop, and that's not the
case anymore. In peers, this issue didn't happen because peers use
a handshake so after sending data, the response is received and wakes
the applet up again. Here we have to indicate that we want to send or
receive data, this will cause the notification to happen as soon as
the connection is ready. This is similar to pretending that we're
working on a full buffer after all. In theory subscribing for reads
is not needed, but it's added here for completeness.

Reported-By: Tsvetan Tsvetanov <cpi.cecko@gmail.com>
9 years agoDOC: mention support for RFC 5077 TLS Ticket extension in starter guide
Pavlos Parissis [Mon, 24 Aug 2015 11:14:32 +0000 (13:14 +0200)] 
DOC: mention support for RFC 5077 TLS Ticket extension in starter guide

9 years agoMINOR cfgparse: Correct the mailer warning text to show the right names to the user
Pieter Baauw [Sun, 16 Aug 2015 22:45:05 +0000 (00:45 +0200)] 
MINOR cfgparse: Correct the mailer warning text to show the right names to the user

9 years agoDOC: clarify some points about SSL and the proxy protocol
Nikos Mavrogiannopoulos [Mon, 24 Aug 2015 13:53:18 +0000 (15:53 +0200)] 
DOC: clarify some points about SSL and the proxy protocol

Make it clearer that some fields are in fact sub-types of the SSL
field.

9 years agoBUG/MAJOR: peers: fix current table pointer not re-initialized on session release.
Emeric Brun [Fri, 21 Aug 2015 10:00:30 +0000 (12:00 +0200)] 
BUG/MAJOR: peers: fix current table pointer not re-initialized on session release.

This bug causes malfunctions after re-connect. For instance the re-sync fails.

9 years agoBUG/MEDIUM: peers: fix wrong message id on stick table updates acknowledgement.
Emeric Brun [Fri, 21 Aug 2015 09:48:54 +0000 (11:48 +0200)] 
BUG/MEDIUM: peers: fix wrong message id on stick table updates acknowledgement.

The table definition message id was used instead of the update acknowledgement id.

This bug causes a malformated message and a protocol error and breaks the
connection.

After that, the updates remain unacknowledged.

9 years agoMAJOR: tproxy: remove support for cttproxy
Willy Tarreau [Thu, 20 Aug 2015 17:35:14 +0000 (19:35 +0200)] 
MAJOR: tproxy: remove support for cttproxy

This was the first transparent proxy technology supported by haproxy
circa 2005 but it was obsoleted in 2007 by Tproxy 4.0 which removed a
lot of the earlier versions' shortcomings and was finally merged into
the kernel. Since nobody has been using cttproxy for many years now
and nobody has even just tried to compile the files, it's time to
remove it. The doc was updated as well.