]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
9 years agoMINOR: map: The map can return IPv4 and IPv6
Thierry FOURNIER [Tue, 4 Aug 2015 17:35:46 +0000 (19:35 +0200)] 
MINOR: map: The map can return IPv4 and IPv6

The maps can store both IPv4 and IPv6 as sample.

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

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

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

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

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

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

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

This patch is provided as-is in best effort.

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

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

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

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

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

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

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

This members contains data and not sample.

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

This a first step of sample reorganization.

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

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

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

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

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

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

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

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

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

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

Thanks to Thierry Fournier for helping diagnose the issue.

This fix must be backported to 1.5.

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

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

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

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

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

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

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

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

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

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

This patch fix this behavior.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This initialisation of the opaque array is useless.

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

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

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

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

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

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

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

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

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

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

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

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

       listen 1.2.3.4:8000
           server s1 127.0.0.1:8000

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

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

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

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

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

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

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

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

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

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

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

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

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

These won't be usable anymore.

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

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

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

Now it asks to check the documentation.

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

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

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

test conf:

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

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

lua test:

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

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

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

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

It used to still mention '<listen>'.

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

That's important to emit logs.

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

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

Using this configuration

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

backend shard_b
  server db01 mysql_shard_b:3306

backend shard_a
  server db01 mysql_shard_a:3306

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

And this lua function

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

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

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

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

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

  GET /foo?bar=baz HTTP/1.0

...would be logged as:

  ?bar=baz

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

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

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

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

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

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

Valid counter was never incremented.
Now it is.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

302 means a temprary move, not a permanent one

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

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

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

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

This was introduced by commit 152b81e7b2565862956af883820d4f79177d0651.

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

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

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

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

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

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

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

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

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

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

9 years agoBUG/MAJOR: dns: fix the length of the string to be copied
Willy Tarreau [Wed, 22 Jul 2015 14:45:36 +0000 (16:45 +0200)] 
BUG/MAJOR: dns: fix the length of the string to be copied

Jan A. Bruder reported that some very specific hostnames on server
lines were causing haproxy to crash on startup. Given that hist
backtrace showed some heap corruption, it was obvious there was an
overflow somewhere. The bug in fact is a typo in dns_str_to_dn_label()
which mistakenly copies one extra byte from the host name into the
output value, thus effectively corrupting the structure.

The bug triggers while parsing the next server of similar length
after the corruption, which generally triggers at config time but
could theorically crash at any moment during runtime depending on
what malloc sizes are needed next. This is why it's tagged major.

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

9 years agoCLEANUP/MINOR: dns: dns_str_to_dn_label() only needs a const char
Willy Tarreau [Wed, 22 Jul 2015 14:42:43 +0000 (16:42 +0200)] 
CLEANUP/MINOR: dns: dns_str_to_dn_label() only needs a const char

The string is an input, let's constify it.

9 years agoMEDIUM: vars/sample: operators can use variables as parameter
Thierry FOURNIER [Tue, 7 Jul 2015 19:10:16 +0000 (21:10 +0200)] 
MEDIUM: vars/sample: operators can use variables as parameter

This patch allow the existing operators to take a variable as parameter.
This is useful to add the content of two variables. This patch modify
the behavior of operators.

9 years agoMINOR: vars: returns variable content
Thierry FOURNIER [Tue, 7 Jul 2015 19:20:42 +0000 (21:20 +0200)] 
MINOR: vars: returns variable content

This patch copy the content of a variable in a sample. The function
returns 0 if the variable is not found.

9 years agoMEDIUM: sample: switch to saturated arithmetic
Thierry FOURNIER [Tue, 7 Jul 2015 23:10:21 +0000 (01:10 +0200)] 
MEDIUM: sample: switch to saturated arithmetic

This patch check calculus for overflow and returns capped values.
This permits to protect against integer overflow in certain operations
involving ratios, percentages, limits or anything. That can sometimes
be critically important with some operations (eg: content-length < X).

9 years agoMAJOR: arg: converts uint and sint in sint
Thierry FOURNIER [Mon, 20 Jul 2015 15:45:02 +0000 (17:45 +0200)] 
MAJOR: arg: converts uint and sint in sint

This patch removes the 32 bits unsigned integer and the 32 bit signed
integer. It replaces these types by a unique type 64 bit signed.

9 years agoMAJOR: sample: converts uint and sint in 64 bits signed integer
Thierry FOURNIER [Mon, 6 Jul 2015 21:43:03 +0000 (23:43 +0200)] 
MAJOR: sample: converts uint and sint in 64 bits signed integer

This patch removes the 32 bits unsigned integer and the 32 bit signed
integer. It replaces these types by a unique type 64 bit signed.

This makes easy the usage of integer and clarify signed and unsigned use.
With the previous version, signed and unsigned are used ones in place of
others, and sometimes the converter loose the sign. For example, divisions
are processed with "unsigned", if one entry is negative, the result is
wrong.

Note that the integer pattern matching and dotted version pattern matching
are already working with signed 64 bits integer values.

There is one user-visible change : the "uint()" and "sint()" sample fetch
functions which used to return a constant integer have been replaced with
a new more natural, unified "int()" function. These functions were only
introduced in the latest 1.6-dev2 so there's no impact on regular
deployments.

9 years agoMINOR: standard: provide htonll() and ntohll()
Willy Tarreau [Tue, 21 Jul 2015 21:47:18 +0000 (23:47 +0200)] 
MINOR: standard: provide htonll() and ntohll()

These are the 64-bit equivalent of htonl() and ntohl(). They're a bit
tricky in order to avoid expensive operations.

The principle consists in letting the compiler detect we're playing
with a union and simplify most or all operations. The asm-optimized
htonl() version involving bswap (x86) / rev (arm) / other is a single
operation on little endian, or a NOP on big-endian. In both cases,
this lets the compiler "see" that we're rebuilding a 64-bit word from
two 32-bit quantities that fit into a 32-bit register. In big endian,
the whole code is optimized out. In little endian, with a decent compiler,
a few bswap and 2 shifts are left, which is the minimum acceptable.

9 years agoMINOR: standard: add 64 bits conversion functions
Thierry FOURNIER [Mon, 6 Jul 2015 21:09:52 +0000 (23:09 +0200)] 
MINOR: standard: add 64 bits conversion functions

This patch adds 3 functions for 64 bit integer conversion.

 * lltoa_r : converts signed 64 bit integer to string
 * read_uint64 : converts from string to signed 64 bits integer with capping
 * read_int64 : converts from string to unsigned 64 bits integer with capping

9 years agoMINOR: server: server_find functions: id, name, best_match
Baptiste Assmann [Wed, 8 Jul 2015 20:03:56 +0000 (22:03 +0200)] 
MINOR: server: server_find functions: id, name, best_match

This patch introduces three new functions which can be used to find a
server in a farm using different server information:
- server unique id (srv->puid)
- server name
- find best match using either name or unique id

When performing best matching, the following applies:
 - use the server name first (if provided)
 - use the server id if provided
 in any case, the function can update the caller about mismatches
 encountered.

9 years agoMINOR: server: new server flag: SRV_F_FORCED_ID
Baptiste Assmann [Tue, 7 Jul 2015 20:02:20 +0000 (22:02 +0200)] 
MINOR: server: new server flag: SRV_F_FORCED_ID

This flag aims at reporting whether the server unique id (srv->puid) has
been forced by the administrator in HAProxy's configuration.
If not set, it means HAProxy has generated automatically the server's
unique id.

9 years agoMINOR: proxy: bit field for proxy_find_best_match diff status
Baptiste Assmann [Fri, 3 Jul 2015 09:03:33 +0000 (11:03 +0200)] 
MINOR: proxy: bit field for proxy_find_best_match diff status

function proxy_find_best_match can update the caller by updating an int
provided in argument.
For now, proxy_find_best_match hardcode bit values 0x01, 0x02 and 0x04,
which is not understandable when reading a code exploiting them.

This patch defines 3 macros with a more explicit wording, so further
reading of a code exploiting the magic bit values will be understandable
more easily.

9 years agoBUG/MINOR: http/sample: gmtime/localtime can fail
Thierry FOURNIER [Tue, 7 Jul 2015 22:15:20 +0000 (00:15 +0200)] 
BUG/MINOR: http/sample: gmtime/localtime can fail

The man said that gmtime() and localtime() can return a NULL value.
This is not tested. It appears that all the values of a 32 bit integer
are valid, but it is better to check the return of these functions.

However, if the integer move from 32 bits to 64 bits, some 64 values
can be unsupported.

9 years agoBUG/MINOR: payload: Add volatile flag to smp_fetch_req_ssl_ec_ext
Nenad Merdanovic [Wed, 15 Jul 2015 10:51:11 +0000 (12:51 +0200)] 
BUG/MINOR: payload: Add volatile flag to smp_fetch_req_ssl_ec_ext

This bug was introduced in 5fc7d7e. No backport to 1.5 needed.

Signed-off-by: Nenad Merdanovic <nmerdan@anine.io>
9 years agoMINOR: stream-int: only use si_release_endpoint() to release a connection
Willy Tarreau [Sun, 19 Jul 2015 17:14:10 +0000 (19:14 +0200)] 
MINOR: stream-int: only use si_release_endpoint() to release a connection

Change si_alloc_conn() to call si_release_endpoint() instead of
open-coding the connection releasing code when reuse is disabled.
This fuses the code with the one already dealing with applets, makes
it shorter and helps centralizing the connection freeing logic at a
single place.

9 years agoCLEANUP: stream-int: remove stream_int_unregister_handler() and si_detach()
Willy Tarreau [Sun, 19 Jul 2015 16:47:45 +0000 (18:47 +0200)] 
CLEANUP: stream-int: remove stream_int_unregister_handler() and si_detach()

The former was not used anymore and the latter was only used by the former.
They were only aliases to other existing functions anyway.

9 years agoCLEANUP: stream-int: fix a few outdated comments about stream_int_register_handler()
Willy Tarreau [Sun, 19 Jul 2015 16:46:30 +0000 (18:46 +0200)] 
CLEANUP: stream-int: fix a few outdated comments about stream_int_register_handler()

They were not updated after the infrastructure change.

9 years agoCLEANUP: stream: remove a useless call to si_detach()
Willy Tarreau [Sun, 19 Jul 2015 15:57:02 +0000 (17:57 +0200)] 
CLEANUP: stream: remove a useless call to si_detach()

It's pointless to call si_detach() after si_reset() since it does
nothing due to si->end being NULL.

9 years agoBUG/MINOR: dns: wrong time unit for some DNS default parameters
Baptiste Assmann [Tue, 14 Jul 2015 19:42:49 +0000 (21:42 +0200)] 
BUG/MINOR: dns: wrong time unit for some DNS default parameters

Madison May reported that the timeout applied by the default
configuration is inproperly set up.
This patch fix this:
 - hold valid default to 10s
 - timeout retry default to 1s

9 years agoDOC usesrc root privileges requirments
Baptiste Assmann [Fri, 17 Jul 2015 19:59:42 +0000 (21:59 +0200)] 
DOC usesrc root privileges requirments

The "usesrc" parameter of the source statement requires root privileges.

10 years agoCLEANUP: vars: remove unused struct
Thierry FOURNIER [Tue, 23 Jun 2015 20:11:04 +0000 (22:11 +0200)] 
CLEANUP: vars: remove unused struct

The commit "MEDIUM: vars: move the session variables to the session, not the stream" (ebcd4844e82a4198ea5d98fe491a46267da1d1ec")
moves the variables from the stream to the session. It forgot to remove
the stream definition of the "vars_sess".