]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
13 years agoMINOR: stats admin: reduce memcmp()/strcmp() calls on status codes
Cyril Bonté [Wed, 4 Apr 2012 10:57:21 +0000 (12:57 +0200)] 
MINOR: stats admin: reduce memcmp()/strcmp() calls on status codes

memcmp()/strcmp() calls were needed in different parts of code to determine
the status code. Each new status code introduces new calls, which can become
inefficient and source of bugs.
This patch reorganizes the code to rely on a numeric status code internally
and to be hopefully more generic.

13 years agoMINOR: stats admin: use the backend id instead of its name in the form
Cyril Bonté [Wed, 4 Apr 2012 10:57:20 +0000 (12:57 +0200)] 
MINOR: stats admin: use the backend id instead of its name in the form

Proxy ids are unique whereas names can be used several times in the
configuration. In order to prevent the ambiguity, the HTML form now provides
the backend id instead of its name (the name can still be provided in the POST
data).

13 years agoCLEANUP: fix typo in findserver() log message
Cyril Bonté [Wed, 4 Apr 2012 10:57:19 +0000 (12:57 +0200)] 
CLEANUP: fix typo in findserver() log message

There was a typo in the findserver() log message :
"found" was written "fould".

13 years agoMINOR: stats admin: allow unordered parameters in POST requests
Cyril Bonté [Wed, 4 Apr 2012 10:57:18 +0000 (12:57 +0200)] 
MINOR: stats admin: allow unordered parameters in POST requests

Previously, the stats admin page required POST parameters to be provided
exactly in the same order as the HTML form.
This patch allows to handle those parameters in any orders.

Also, note that haproxy won't alter server states anymore if backend or server
names are ambiguous (duplicated names in the configuration) to prevent
unexpected results (the same should probably be applied to the stats socket).

13 years agoMINOR: contrib/iprange: add a network IP range to mask converter
Willy Tarreau [Mon, 2 Apr 2012 19:44:05 +0000 (21:44 +0200)] 
MINOR: contrib/iprange: add a network IP range to mask converter

This tool has remained uncommitted in my development tree for almost a year.
Just minor polish and commit.

It can be used to convert some geolocation IP lists to ACLs.

13 years agoBUG/MEDIUM: balance source did not properly hash IPv6 addresses
Willy Tarreau [Sat, 31 Mar 2012 17:53:37 +0000 (19:53 +0200)] 
BUG/MEDIUM: balance source did not properly hash IPv6 addresses

The hash of IPv6 addresses was not properly aligned and resulted in the
last quarter of the address not being hashed. In practice, this is rarely
detected since MAC addresses are used in the second half. But this becomes
very visible with IPv6-mapped IPv4 addresses such as ::FFFF:1.2.3.4 where
the IPv4 part is never hashed.

This bug has been there forever, since introduction of "balance source" in
v1.2.11. The fix must then be backported to all stable versions.

Thanks to Alex Markham for reporting this issue to the list !

13 years agoBUG/MAJOR: log: possible segfault with logformat
William Lallemand [Mon, 26 Mar 2012 15:52:55 +0000 (17:52 +0200)] 
BUG/MAJOR: log: possible segfault with logformat

Possible zero-pointer deference in sess_log().
Checks of return values in sess_log() fix the issue.

Fix bad computation in logformat_write_string().

This issue is 1.5-specific and was introduced just before 1.5-dev8.
No backport is needed.

13 years ago[RELEASE] Released version 1.5-dev8 v1.5-dev8
Willy Tarreau [Mon, 26 Mar 2012 04:15:29 +0000 (06:15 +0200)] 
[RELEASE] Released version 1.5-dev8

Released version 1.5-dev8 with the following main changes :
    - MINOR: patch for minor typo (ressources/resources)
    - MEDIUM: http: add support for sending the server's name in the outgoing request
    - DOC: mention that default checks are TCP connections
    - BUG/MINOR: fix options forwardfor if-none when an alternative header name is specified
    - CLEANUP: Make check_statuses, analyze_statuses and process_chk static
    - CLEANUP: Fix HCHK spelling errors
    - BUG/MINOR: fix typo in processing of http-send-name-header
    - MEDIUM: log: Use linked lists for loggers
    - BUILD: fix declaration inside a scope block
    - REORG: log: split send_log function
    - MINOR: config: Parse the string of the log-format config keyword
    - MINOR: add ultoa, ulltoa, ltoa, lltoa implementations
    - MINOR: Date and time fonctions that don't use snprintf
    - MEDIUM: log: make http_sess_log use log_format
    - DOC: log-format documentation
    - MEDIUM: log: use log_format for mode tcplog
    - MEDIUM: log-format: backend source address %Bi %Bp
    - BUG/MINOR: log-format: fix %o flag
    - BUG/MEDIUM: bad length in log_format and __send_log
    - MINOR: logformat %st is signed
    - BUILD/MINOR: fix the source URL in the spec file
    - DOC: acl is http_first_req, not http_req_first
    - BUG/MEDIUM: don't trim last spaces from headers consisting only of spaces
    - MINOR: acl: add new matches for header/path/url length
    - BUILD: halog: make halog build on solaris
    - BUG/MINOR: don't use a wrong port when connecting to a server with mapped ports
    - MINOR: remove the client/server side distinction in SI addresses
    - MINOR: halog: add support for matching queued requests
    - DOC: indicate that cookie "prefix" and "indirect" should not be mixed
    - OPTIM/MINOR: move struct sockaddr_storage to the tail of structs
    - OPTIM/MINOR: make it possible to change pipe size (tune.pipesize)
    - BUILD/MINOR: silent a build warning in src/pipe.c (fcntl)
    - OPTIM/MINOR: move the hdr_idx pools out of the proxy struct
    - MEDIUM: tune.http.maxhdr makes it possible to configure the maximum number of HTTP headers
    - BUG/MINOR: fix a segfault when parsing a config with undeclared peers
    - CLEANUP: rename possibly confusing struct field "tracked"
    - BUG/MEDIUM: checks: fix slowstart behaviour when server tracking is in use
    - MINOR: config: tolerate server "cookie" setting in non-HTTP mode
    - MEDIUM: buffers: add some new primitives and rework existing ones
    - BUG: buffers: don't return a negative value on buffer_total_space_res()
    - MINOR: buffers: make buffer_pointer() support negative pointers too
    - CLEANUP: kill buffer_replace() and use an inline instead
    - BUG: tcp: option nolinger does not work on backends
    - CLEANUP: ebtree: remove a few annoying signedness warnings
    - CLEANUP: ebtree: clarify licence and update to 6.0.6
    - CLEANUP: ebtree: remove 4-year old harmless typo in duplicates insertion code
    - CLEANUP: ebtree: remove another typo, a wrong initialization in insertion code
    - BUG: ebtree: ebst_lookup() could return the wrong entry
    - OPTIM: stream_sock: reduce the amount of in-flight spliced data
    - OPTIM: stream_sock: save a failed recv syscall when splice returns EAGAIN
    - MINOR: acl: add support for TLS server name matching using SNI
    - BUG: http: re-enable TCP quick-ack upon incomplete HTTP requests
    - BUG: proto_tcp: don't try to bind to a foreign address if sin_family is unknown
    - MINOR: pattern: export the global temporary pattern
    - CLEANUP: patterns: get rid of pattern_data_setstring()
    - MEDIUM: acl: use temp_pattern to store fetched information in the "method" match
    - MINOR: acl: include pattern.h to make pattern migration more transparent
    - MEDIUM: pattern: change the pattern data integer from unsigned to signed
    - MEDIUM: acl: use temp_pattern to store any integer-type information
    - MEDIUM: acl: use temp_pattern to store any address-type information
    - CLEANUP: acl: integer part of acl_test is not used anymore
    - MEDIUM: acl: use temp_pattern to store any string-type information
    - CLEANUP: acl: remove last data fields from the acl_test struct
    - MEDIUM: http: replace get_ip_from_hdr2() with http_get_hdr()
    - MEDIUM: patterns: the hdr() pattern is now of type string
    - DOC: add minimal documentation on how ACLs work internally
    - DOC: add a coding-style file
    - OPTIM: halog: keep a fast path for the lines-count only
    - CLEANUP: silence a warning when building on sparc
    - BUG: http: tighten the list of allowed characters in a URI
    - MEDIUM: http: block non-ASCII characters in URIs by default
    - DOC: add some documentation from RFC3986 about URI format
    - BUG/MINOR: cli: correctly remove the whole table on "clear table"
    - BUG/MEDIUM: correctly disable servers tracking another disabled servers.
    - BUG/MEDIUM: zero-weight servers must not dequeue requests from the backend
    - MINOR: halog: add some help on the command line
    - BUILD: fix build error on FreeBSD
    - BUG: fix double free in peers config error path
    - MEDIUM: improve config check return codes
    - BUILD: make it possible to look for pcre in the default system paths
    - MINOR: config: emit a warning when 'default_backend' masks servers
    - MINOR: backend: rework the LC definition to support other connection-based algos
    - MEDIUM: backend: add the 'first' balancing algorithm
    - BUG: fix httplog trailing LF
    - MEDIUM: increase chunk-size limit to 2GB-1
    - BUG: queue: fix dequeueing sequence on HTTP keep-alive sessions
    - BUG: http: disable TCP delayed ACKs when forwarding content-length data
    - BUG: checks: fix server maintenance exit sequence
    - BUG/MINOR: stream_sock: don't remove BF_EXPECT_MORE and BF_SEND_DONTWAIT on partial writes
    - DOC: enumerate valid status codes for "observe layer7"
    - MINOR: buffer: switch a number of buffer args to const
    - CLEANUP: silence signedness warning in acl.c
    - BUG: stream_sock: si->release was not called upon shutw()
    - MINOR: log: use "%ts" to log term status only and "%tsc" to log with cookie
    - BUG/CRITICAL: log: fix risk of crash in development snapshot
    - BUG/MAJOR: possible crash when using capture headers on TCP frontends
    - MINOR: config: disable header captures in TCP mode and complain

13 years agoCLEANUP: Fix HCHK spelling errors
Simon Horman [Sun, 18 Mar 2012 22:25:28 +0000 (07:25 +0900)] 
CLEANUP: Fix HCHK spelling errors

13 years agoCLEANUP: Make check_statuses, analyze_statuses and process_chk static
Simon Horman [Sun, 18 Mar 2012 22:24:41 +0000 (07:24 +0900)] 
CLEANUP: Make check_statuses, analyze_statuses and process_chk static

These symbols are only used inside src/checks.c

13 years agoMINOR: config: disable header captures in TCP mode and complain
Willy Tarreau [Sat, 24 Mar 2012 07:33:05 +0000 (08:33 +0100)] 
MINOR: config: disable header captures in TCP mode and complain

In order to help users fix their configs, report a warning when a capture
has been set on a non-HTTP frontend.

This should be backported to 1.4.

13 years agoBUG/MAJOR: possible crash when using capture headers on TCP frontends
Willy Tarreau [Sat, 24 Mar 2012 07:28:09 +0000 (08:28 +0100)] 
BUG/MAJOR: possible crash when using capture headers on TCP frontends

Olufemi Omojola provided a config and a core showing a possible crash
when captures are configured on a TCP-mode frontend which branches to
an HTTP backend. The reason is that being in TCP mode, the frontend
does not allocate capture pools for the request, but the HTTP backend
tries to use them and dies on the NULL.

While such a config has long been unlikely to happen, it looks like
people using websocket tend to do this more often now.

Change the control to use the pointer instead of the number of captures
to know when to log.

This bug was reported in 1.4.20, so it must be backported there.

13 years agoMINOR: logformat %st is signed
William Lallemand [Thu, 22 Mar 2012 10:32:29 +0000 (11:32 +0100)] 
MINOR: logformat %st is signed

replace ultoa by ltoa for HTTP status code (can be -1)

13 years agoMINOR: patch for minor typo (ressources/resources)
Adrian Bridgett [Mon, 19 Mar 2012 23:36:42 +0000 (23:36 +0000)] 
MINOR: patch for minor typo (ressources/resources)

The main stats page says "ressources" (French spelling) rather than
"resources" (English spelling).

One little patch attached (against v1.4.20).

Many thanks,

Adrian

13 years agoBUG/MEDIUM: bad length in log_format and __send_log
William Lallemand [Mon, 19 Mar 2012 15:15:12 +0000 (16:15 +0100)] 
BUG/MEDIUM: bad length in log_format and __send_log

__send_log(): the size of the buffer sent is wrong when the facility
is lower than 3 digits.

logformat_write_string(): computation of size is wrong

Note: this was introduced after 1.5-dev7, no backport needed.

13 years agoBUG/CRITICAL: log: fix risk of crash in development snapshot
Willy Tarreau [Mon, 19 Mar 2012 15:51:53 +0000 (16:51 +0100)] 
BUG/CRITICAL: log: fix risk of crash in development snapshot

Commit a1cc38 introduced a regression which was easy to trigger till ad4cd58
(snapshots 20120222 to 20120311 included). The bug was still present after
that but harder to trigger.

The bug is caused by the use of two distinct log buffers due to intermediary
changes. The issue happens when an HTTP request is logged just after a TCP
request during the same second and the HTTP request is too large for the buffer.
In this case, it happens that the HTTP request is logged into the TCP buffer
instead and that length controls can't detect anything.

Starting with bddd4f, the issue is still possible when logging too large an
HTTP request just after a send_log() call (typically a server status change).

We owe a big thanks to Sander Klein for testing several snapshots and more
specifically for taking significant risks in production by letting the buggy
version crash several times in order to provide an exploitable core ! The bug
could not have been found without this precious help. Thank you Sander !

This fix does not need to be backported, it did not affect any released version.

13 years agoMINOR: log: use "%ts" to log term status only and "%tsc" to log with cookie
Willy Tarreau [Mon, 12 Mar 2012 14:09:42 +0000 (15:09 +0100)] 
MINOR: log: use "%ts" to log term status only and "%tsc" to log with cookie

The difference could be seen when logging a request in HTTP mode with option
tcplog, as it would keep emitting 4 chars. Better use two distinct flags to
clear the confusion.

13 years agoBUG/MINOR: log-format: fix %o flag
William Lallemand [Mon, 12 Mar 2012 10:03:47 +0000 (11:03 +0100)] 
BUG/MINOR: log-format: fix %o flag

The %o flag was not working at all.

13 years agoMEDIUM: log-format: backend source address %Bi %Bp
William Lallemand [Fri, 2 Mar 2012 13:35:21 +0000 (14:35 +0100)] 
MEDIUM: log-format: backend source address %Bi %Bp

%Bi return the backend source IP
%Bp return the backend source port

Add a function pointer in logformat_type to do additional configuration
during the log-format variable parsing.

13 years agoMEDIUM: log: use log_format for mode tcplog
William Lallemand [Mon, 27 Feb 2012 10:23:10 +0000 (11:23 +0100)] 
MEDIUM: log: use log_format for mode tcplog

Merge http_sess_log() and tcp_sess_log() to sess_log() and move it to
log.c

A new field in logformat_type define if you can use a logformat
variable in TCP or HTTP mode.

doc: log-format in tcp mode

Note that due to the way log buffer allocation currently works, trying to
log an HTTP request without "option httplog" is still not possible. This
will change in the near future.

13 years agoBUG: stream_sock: si->release was not called upon shutw()
Willy Tarreau [Sat, 10 Mar 2012 12:42:32 +0000 (13:42 +0100)] 
BUG: stream_sock: si->release was not called upon shutw()

The ->release function of the stream interface is never called upon
a shutw() because it's placed after a return statement. It is possible
that it has impacted inter-process stick-table replication by preventing
a full resync after certain sequences of connection breakage. Since this
bug has been present since the introduction of the ->release() callback,
it cannot have caused regressions, just possibly non-working situations.

This was detected at Exceliance by Emeric Brun during a code review. It
is 1.5-specific.

13 years agoCLEANUP: silence signedness warning in acl.c
Willy Tarreau [Sat, 10 Mar 2012 08:05:30 +0000 (09:05 +0100)] 
CLEANUP: silence signedness warning in acl.c

The recent SNI patch introduced a trivial warning in acl.c.

13 years agoMINOR: buffer: switch a number of buffer args to const
Willy Tarreau [Sat, 10 Mar 2012 07:55:07 +0000 (08:55 +0100)] 
MINOR: buffer: switch a number of buffer args to const

A number of offset computation functions use struct buffer* arguments
and return integers without modifying the input. Using consts helps
simplifying some operations in callers.

13 years agoDOC: enumerate valid status codes for "observe layer7"
Willy Tarreau [Sat, 10 Mar 2012 07:19:02 +0000 (08:19 +0100)] 
DOC: enumerate valid status codes for "observe layer7"

13 years agoBUG/MINOR: stream_sock: don't remove BF_EXPECT_MORE and BF_SEND_DONTWAIT on partial...
Willy Tarreau [Fri, 9 Mar 2012 17:10:44 +0000 (18:10 +0100)] 
BUG/MINOR: stream_sock: don't remove BF_EXPECT_MORE and BF_SEND_DONTWAIT on partial writes

The flags are one-shot but should be maintained over all send() operations
as long as send_max is not flushed. The flags were incidentely cleared once
a complete send() was performed, regardless of the fact that the send()
might have been on the first half of a buffer before a wrapping. The result
is that on wrapping data (eg: which happens often with chunked encoding),
many incomplete segments are transmitted instead of being aggregated.

The fix consists in only flushing the flags only once send_max is empty,
which was the expected behaviour.

This fix should be backported to 1.4 though it is not critical, just sub-optimal.

13 years agoBUG: checks: fix server maintenance exit sequence
Willy Tarreau [Fri, 9 Mar 2012 16:16:09 +0000 (17:16 +0100)] 
BUG: checks: fix server maintenance exit sequence

Recent commit 62c3be broke maintenance mode by fixing srv_is_usable().
Enabling a disabled server would not re-introduce it into the farm.
The reason is that in set_server_up(), the SRV_MAINTAIN flag is still
present when recounting the servers. The flag was removed late only to
adjust a log message. Keep a copy of the old flag instead and update
SRV_MAINTAIN earlier.

This fix must also be backported to 1.4 (but no release got the regression).

13 years agoBUG: http: disable TCP delayed ACKs when forwarding content-length data
Willy Tarreau [Mon, 5 Mar 2012 07:29:20 +0000 (08:29 +0100)] 
BUG: http: disable TCP delayed ACKs when forwarding content-length data

Commits 5c6209 and 072930 were aimed at avoiding undesirable PUSH flags
when forwarding chunked data, but had the undesired effect of causing
data advertised by content-length to be affected by the delayed ACK too.
This can happen when the data to be forwarded are small enough to fit into
a single send() call, otherwise the BF_EXPECT_MORE flag would be removed.

Content-length data don't need the BF_EXPECT_MORE flag since the low-level
forwarder already knows it can safely rely on bf->to_forward to set the
appropriate TCP flags.

Note that the issue is only observed in requests at the moment, though the
later introduction of server-side keep-alive could trigger the issue on the
response path too.

Special thanks to Randy Shults for reporting this issue with a lot of
details helping to reproduce it.

The fix must be backported to 1.4.

13 years agoBUG: queue: fix dequeueing sequence on HTTP keep-alive sessions
Willy Tarreau [Thu, 1 Mar 2012 22:34:37 +0000 (23:34 +0100)] 
BUG: queue: fix dequeueing sequence on HTTP keep-alive sessions

When a request completes on a server and the server connection is closed
while the client connection stays open, the HTTP engine releases all server
connection slots and scans the queues to offer the connection slot to
another pending request.

An issue happens when the released connection allows other requests to be
dequeued : may_dequeue_tasks() relies on srv->served which is only decremented
by sess_change_server() which itself is only called after may_dequeue_tasks().
This results in no connection being woken up until another connection terminates
so that may_dequeue_tasks() is called again.

This fix is minimalist and only moves sess_change_server() earlier (which is
safe). It should be reworked and the code factored out so that the same occurrence
in session.c shares the same code.

This bug has been there since the introduction of option-http-server-close and
the fix must be backported to 1.4.

13 years agoMEDIUM: increase chunk-size limit to 2GB-1
Willy Tarreau [Fri, 24 Feb 2012 18:20:12 +0000 (19:20 +0100)] 
MEDIUM: increase chunk-size limit to 2GB-1

Since commit 115acb97, chunk size was limited to 256MB. There is no reason for
such a limit and the comment on the code suggests a missing zero. However,
increasing the limit past 2 GB causes trouble due to some 32-bit subtracts
in various computations becoming negative (eg: buffer_max_len). So let's limit
the chunk size to 2 GB - 1 max.

13 years agoBUG: fix httplog trailing LF
Willy Tarreau [Fri, 24 Feb 2012 10:46:54 +0000 (11:46 +0100)] 
BUG: fix httplog trailing LF

commit a1cc3811 introduced an undesirable \0\n ending on HTTP log messages. This
is because of an extra character count passed to __send_log() which causes the LF
to be appended past the \0. Some syslog daemons thus log an extra empty line. The
fix is obvious. Fix the function comments to remind what they expect on their input.

This is past 1.5-dev7 regression so there's no backport needed.

13 years agoMEDIUM: backend: add the 'first' balancing algorithm
Willy Tarreau [Mon, 13 Feb 2012 16:12:08 +0000 (17:12 +0100)] 
MEDIUM: backend: add the 'first' balancing algorithm

The principle behind this load balancing algorithm was first imagined
and modeled by Steen Larsen then iteratively refined through several
work sessions until it would totally address its original goal.

The purpose of this algorithm is to always use the smallest number of
servers so that extra servers can be powered off during non-intensive
hours. Additional tools may be used to do that work, possibly by
locally monitoring the servers' activity.

The first server with available connection slots receives the connection.
The servers are choosen from the lowest numeric identifier to the highest
(see server parameter "id"), which defaults to the server's position in
the farm. Once a server reaches its maxconn value, the next server is used.
It does not make sense to use this algorithm without setting maxconn. Note
that it can however make sense to use minconn so that servers are not used
at full load before starting new servers, and so that introduction of new
servers requires a progressively increasing load (the number of servers
would more or less follow the square root of the load until maxconn is
reached). This algorithm ignores the server weight, and is more beneficial
to long sessions such as RDP or IMAP than HTTP, though it can be useful
there too.

13 years agoMINOR: backend: rework the LC definition to support other connection-based algos
Willy Tarreau [Mon, 13 Feb 2012 15:57:44 +0000 (16:57 +0100)] 
MINOR: backend: rework the LC definition to support other connection-based algos

The leastconn algorithm should be of kind "connection-based", not "leastconn"
if we want to later support other connection-based LB algos.

13 years agoMINOR: config: emit a warning when 'default_backend' masks servers
Willy Tarreau [Mon, 13 Feb 2012 13:32:34 +0000 (14:32 +0100)] 
MINOR: config: emit a warning when 'default_backend' masks servers

When a "listen" instance uses a "default_backned" rule and has servers,
the servers will never be used. Report it so that users don't get trapped.

13 years agoBUILD: make it possible to look for pcre in the default system paths
Willy Tarreau [Fri, 10 Feb 2012 18:46:59 +0000 (19:46 +0100)] 
BUILD: make it possible to look for pcre in the default system paths

If running "make PCREDIR=" will not force to add -I nor -L anymore.

13 years agoDOC: log-format documentation
William Lallemand [Mon, 30 Jan 2012 15:47:22 +0000 (16:47 +0100)] 
DOC: log-format documentation

13 years agoMEDIUM: log: make http_sess_log use log_format
William Lallemand [Wed, 8 Feb 2012 15:38:44 +0000 (16:38 +0100)] 
MEDIUM: log: make http_sess_log use log_format

http_sess_log now use the logformat linked list to make the log
string, snprintf is not used for speed issue.

CLF mode also uses logformat.

NOTE: as of now, empty fields in CLF now are "" not "-" anymore.

13 years agoMINOR: Date and time fonctions that don't use snprintf
William Lallemand [Mon, 6 Feb 2012 17:15:57 +0000 (18:15 +0100)] 
MINOR: Date and time fonctions that don't use snprintf

Also move human_time() to standard.c since it's not related to
timeval calculations.

13 years agoMINOR: add ultoa, ulltoa, ltoa, lltoa implementations
William Lallemand [Tue, 24 Jan 2012 10:15:39 +0000 (11:15 +0100)] 
MINOR: add ultoa, ulltoa, ltoa, lltoa implementations

Implementations that write result from left to right

13 years agoMINOR: config: Parse the string of the log-format config keyword
William Lallemand [Wed, 8 Feb 2012 15:37:49 +0000 (16:37 +0100)] 
MINOR: config: Parse the string of the log-format config keyword

parse_logformat_string: parse the string, detect the type: text,
        separator or variable

parse_logformat_var: dectect variable name

parse_logformat_var_args: parse arguments and flags

add_to_logformat_list: add to the logformat linked list

13 years agoREORG: log: split send_log function
William Lallemand [Mon, 6 Feb 2012 15:00:33 +0000 (16:00 +0100)] 
REORG: log: split send_log function

send_log function is now splited in 3 functions
* hdr_log: generate the syslog header
* send_log: send a syslog message with a printf format string
* __send_log: send a syslog message

13 years agoBUILD: fix declaration inside a scope block
William Lallemand [Mon, 30 Jan 2012 16:27:17 +0000 (17:27 +0100)] 
BUILD: fix declaration inside a scope block

13 years agoMEDIUM: improve config check return codes
Willy Tarreau [Thu, 2 Feb 2012 16:48:18 +0000 (17:48 +0100)] 
MEDIUM: improve config check return codes

When checking a configuration file using "-c -f xxx", sometimes it is
reported that a config is valid while it will later fail (eg: no enabled
listener). Instead, let's improve the return values :
  - return 0 if config is 100% OK
  - return 1 if config has errors
  - return 2 if config is OK but no listener nor peer is enabled

13 years agoBUG: fix double free in peers config error path
Willy Tarreau [Thu, 2 Feb 2012 16:06:13 +0000 (17:06 +0100)] 
BUG: fix double free in peers config error path

If the local host is not found as a peer in a "peers" section, we have a
double free, and possibly a use-after-free because the peers section is
freed since it's aliased as the table's name.

13 years agoDOC: mention that default checks are TCP connections
Patrick Mézard [Sun, 22 Jan 2012 15:01:22 +0000 (16:01 +0100)] 
DOC: mention that default checks are TCP connections

13 years agoBUILD: fix build error on FreeBSD
Willy Tarreau [Mon, 23 Jan 2012 14:35:52 +0000 (15:35 +0100)] 
BUILD: fix build error on FreeBSD

Marcello Gorlani reported that commit 5e205524ad24003ecc4dbb435066aebe7ed58d95
(BUG: http: re-enable TCP quick-ack upon incomplete HTTP requests) broke build
on FreeBSD.

Moving the include lower fixes the issue. This must be backported to 1.4 too.

13 years agoMINOR: halog: add some help on the command line
Willy Tarreau [Mon, 23 Jan 2012 07:15:51 +0000 (08:15 +0100)] 
MINOR: halog: add some help on the command line

13 years agoBUG/MEDIUM: zero-weight servers must not dequeue requests from the backend
Willy Tarreau [Fri, 20 Jan 2012 14:57:05 +0000 (15:57 +0100)] 
BUG/MEDIUM: zero-weight servers must not dequeue requests from the backend

It was reported that a server configured with a zero weight would
sometimes still take connections from the backend queue. This issue is
real, it happens this way :
  1) the disabled server accepts a request with a cookie
  2) many cookie-less requests accumulate in the backend queue
  3) when the disabled server completes its request, it checks its own
     queue and the backend's queue
  4) the server takes a pending request from the backend queue and
     processes it. In response, the server's cookie is assigned to
     the client, which ensures that some requests will continue to
     be served by this server, leading back to point 1 above.

The fix consists in preventing a zero-weight server from dequeuing pending
requests from the backend. Making use of srv_is_usable() in such tests makes
the tests more robust against future changes.

This fix must be backported to 1.4 and 1.3.

13 years agoBUG/MEDIUM: correctly disable servers tracking another disabled servers.
Willy Tarreau [Fri, 20 Jan 2012 12:12:32 +0000 (13:12 +0100)] 
BUG/MEDIUM: correctly disable servers tracking another disabled servers.

In a config where server "s1" is marked disabled and "s2" tracks "s1",
s2 appears disabled on the stats but is still inserted into the LB farm
because the tracking is resolved too late in the configuration process.

We now resolve tracked servers before building LB maps and we also mark
the tracking server in maintenance mode, which previously was not done,
causing half of the issue.

Last point is that we also protect srv_is_usable() against electing a
server marked for maintenance. This is not absolutely needed but is a
safe choice and makes a lot of sense.

This fix must be backported to 1.4.

13 years agoBUG/MINOR: fix typo in processing of http-send-name-header
Stathis Voukelatos [Mon, 9 Jan 2012 13:27:13 +0000 (14:27 +0100)] 
BUG/MINOR: fix typo in processing of http-send-name-header

I downloaded version 1.4.19 this morning. While merging the code changes
to a custom build that we have here for our project I noticed a typo in
'session.c', in the new code for inserting the server name in the HTTP
header. The fix that I did is shown in the patch below.

[WT: the bug is harmless, it is only suboptimal]

13 years agoBUG/MINOR: cli: correctly remove the whole table on "clear table"
Willy Tarreau [Mon, 9 Jan 2012 10:50:03 +0000 (11:50 +0100)] 
BUG/MINOR: cli: correctly remove the whole table on "clear table"

Joe Price reported that "clear table xxx" sent on the CLI would only clear
the last entry. This is true, some code was missing to remove an entry from
within the loop, and only the final condition was able to remove an entry.
The fix is obvious. No backport is needed.

13 years agoDOC: add some documentation from RFC3986 about URI format
Willy Tarreau [Sat, 7 Jan 2012 22:58:54 +0000 (23:58 +0100)] 
DOC: add some documentation from RFC3986 about URI format

13 years agoMEDIUM: http: block non-ASCII characters in URIs by default
Willy Tarreau [Sat, 7 Jan 2012 22:54:13 +0000 (23:54 +0100)] 
MEDIUM: http: block non-ASCII characters in URIs by default

These ones are invalid and blocked unless "option accept-invalid-http-request"
is specified in the frontend. In any case, the faulty request is logged.

Note that some of the remaining invalid chars are still not checked against,
those are the invalid ones between 32 and 127 :

    34 ('"'), 60 ('<'), 62 ('>'), 92 ('\'), 94 ('^'),
    96 ('`'), 123 ('{'), 124 ('|'), 125 ('}')

Using a lookup table might be better at some point.

13 years agoBUG: http: tighten the list of allowed characters in a URI
Willy Tarreau [Sat, 7 Jan 2012 22:22:31 +0000 (23:22 +0100)] 
BUG: http: tighten the list of allowed characters in a URI

The HTTP request parser was considering that any non-LWS char was
par of the URI. Unfortunately, this allows control chars to be sent
in the URI, sometimes resulting in backend servers misbehaving, for
instance when they interprete \0 as an end of string and respond
with plain HTTP/0.9 without headers, that haproxy blocks as invalid
responses.

RFC3986 clearly states the list of allowed characters in a URI. Even
non-ASCII chars are not allowed. Unfortunately, after having run 10
years with these chars allowed, we can't block them right now without
an optional workaround. So the first step consists in only blocking
control chars. A later patch will allow non-ASCII only when an appropriate
option is enabled in the frontend.

Control chars are 0..31 and 127, with the exception of 9, 10 and 13
(\t, \n, \r).

13 years agoCLEANUP: silence a warning when building on sparc
Willy Tarreau [Sat, 7 Jan 2012 21:52:12 +0000 (22:52 +0100)] 
CLEANUP: silence a warning when building on sparc

On Solaris/sparc, getpid() returns pid_t which is not an int :

  src/peers.c: In function `peer_io_handler':
  src/peers.c:508: warning: int format, pid_t arg (arg 6)

13 years agoMEDIUM: http: add support for sending the server's name in the outgoing request
Mark Lamourine [Wed, 4 Jan 2012 18:02:01 +0000 (13:02 -0500)] 
MEDIUM: http: add support for sending the server's name in the outgoing request

New option "http-send-name-header" specifies the name of a header which
will hold the server name in outgoing requests. This is the name of the
server the connection is really sent to, which means that upon redispatches,
the header's value is updated so that it always matches the server's name.

13 years agoOPTIM: halog: keep a fast path for the lines-count only
Willy Tarreau [Tue, 3 Jan 2012 08:23:03 +0000 (09:23 +0100)] 
OPTIM: halog: keep a fast path for the lines-count only

Using "halog -c" is still something quite common to perform on logs,
but unfortunately since the recent added controls, it was sensibly
slowed down due to the parsing of the accept date field.

Now we use a specific loop for the case where nothing is needed from
the input, and this sped up the line counting by 2.5x. A 2.4 GHz Xeon
now counts lines at a rate of 2 GB of logs per second.

13 years agoDOC: add a coding-style file
Willy Tarreau [Fri, 30 Dec 2011 16:16:22 +0000 (17:16 +0100)] 
DOC: add a coding-style file

This will help newcomers adapt to existing (or desired) style and will
save them some time.

13 years agoDOC: add minimal documentation on how ACLs work internally
Willy Tarreau [Fri, 16 Dec 2011 20:51:00 +0000 (21:51 +0100)] 
DOC: add minimal documentation on how ACLs work internally

This will help complete the ACL to pattern migration.

13 years agoMEDIUM: patterns: the hdr() pattern is now of type string
Willy Tarreau [Fri, 16 Dec 2011 20:50:30 +0000 (21:50 +0100)] 
MEDIUM: patterns: the hdr() pattern is now of type string

This pattern previously was limited to type IP. With the new header
extraction function, it becomes possible to extract strings, so that
the header can be returned as a string. This will not change anything
to existing configs, as string will automatically be converted to IP
when needed. However, new configs will be able to use IPv6 addresses
from headers in stick-tables, as well as stick on any non-IP header
(eg: host, user-agent, ...).

13 years agoMEDIUM: http: replace get_ip_from_hdr2() with http_get_hdr()
Willy Tarreau [Fri, 16 Dec 2011 20:35:50 +0000 (21:35 +0100)] 
MEDIUM: http: replace get_ip_from_hdr2() with http_get_hdr()

The new function does not return IP addresses but header values instead,
so that the caller is free to make what it want of them. The conversion
is not quite clean yet, as the previous test which considered that address
0.0.0.0 meant "no address" is still used. A different IP parsing function
should be used to take this into account.

13 years agoCLEANUP: acl: remove last data fields from the acl_test struct
Willy Tarreau [Fri, 16 Dec 2011 18:16:19 +0000 (19:16 +0100)] 
CLEANUP: acl: remove last data fields from the acl_test struct

acl_test doesn't hold ptr nor len anymore, since everything has moved to
the temporary pattern.

13 years agoMEDIUM: acl: use temp_pattern to store any string-type information
Willy Tarreau [Fri, 16 Dec 2011 18:11:42 +0000 (19:11 +0100)] 
MEDIUM: acl: use temp_pattern to store any string-type information

Now strings and data blocks are stored in the temp_pattern's chunk
and matched against this one.

The rdp_cookie currently makes extensive use of acl_fetch_rdp_cookie()
and will be a good candidate for the initial rework so that ACLs use
the patterns framework and not the other way around.

13 years agoCLEANUP: acl: integer part of acl_test is not used anymore
Willy Tarreau [Fri, 16 Dec 2011 17:03:44 +0000 (18:03 +0100)] 
CLEANUP: acl: integer part of acl_test is not used anymore

13 years agoMEDIUM: acl: use temp_pattern to store any address-type information
Willy Tarreau [Fri, 16 Dec 2011 16:49:52 +0000 (17:49 +0100)] 
MEDIUM: acl: use temp_pattern to store any address-type information

IPv4 and IPv6 addresses are now stored into temp_pattern instead of
the dirty hack consisting into storing them into the consumer's target
address.

Some refactoring should now be possible since the methods used to fetch
source and destination addresses are similar between patterns and ACLs.

13 years agoMEDIUM: acl: use temp_pattern to store any integer-type information
Willy Tarreau [Fri, 16 Dec 2011 16:06:15 +0000 (17:06 +0100)] 
MEDIUM: acl: use temp_pattern to store any integer-type information

All ACL fetches which return integer value now store the result into
the temporary pattern struct. All ACL matches which rely on integer
also get their value there.

Note: the pattern data types are not set right now.

13 years agoMEDIUM: pattern: change the pattern data integer from unsigned to signed
Willy Tarreau [Fri, 16 Dec 2011 15:44:06 +0000 (16:44 +0100)] 
MEDIUM: pattern: change the pattern data integer from unsigned to signed

Till now the pattern data integer type was unsigned without any
particular reason. In order to make ACLs use it, we must switch it
to signed int instead.

13 years agoMINOR: acl: include pattern.h to make pattern migration more transparent
Willy Tarreau [Fri, 16 Dec 2011 14:47:06 +0000 (15:47 +0100)] 
MINOR: acl: include pattern.h to make pattern migration more transparent

13 years agoMEDIUM: acl: use temp_pattern to store fetched information in the "method" match
Willy Tarreau [Fri, 16 Dec 2011 14:38:49 +0000 (15:38 +0100)] 
MEDIUM: acl: use temp_pattern to store fetched information in the "method" match

This match was using both the int and ptr part of the acl_test struct. Let's
change this to be able to store it into a chunk with a special encoding.

13 years agoCLEANUP: patterns: get rid of pattern_data_setstring()
Willy Tarreau [Fri, 16 Dec 2011 14:35:46 +0000 (15:35 +0100)] 
CLEANUP: patterns: get rid of pattern_data_setstring()

This function was only used to call chunk_init_len() from another chunk,
which in the end consists in simply assigning the source chunk to the
destination chunk. Let's remove this indirection to make the code clearer.
Anyway it was the only place such a function was used.

13 years agoMINOR: pattern: export the global temporary pattern
Willy Tarreau [Fri, 16 Dec 2011 14:23:14 +0000 (15:23 +0100)] 
MINOR: pattern: export the global temporary pattern

The global pattern is used for pattern conversions. Export it under the
name "temp_pattern" so that it can later be used by ACLs.

13 years agoBUG: proto_tcp: don't try to bind to a foreign address if sin_family is unknown
Willy Tarreau [Fri, 16 Dec 2011 20:25:11 +0000 (21:25 +0100)] 
BUG: proto_tcp: don't try to bind to a foreign address if sin_family is unknown

This is 1.5-specific. It causes issues with transparent source binding involving
hdr_ip. We must not try to bind() to a foreign address when the family is not set,
and we must set the family when an address is set.

13 years agoBUG: http: re-enable TCP quick-ack upon incomplete HTTP requests
Willy Tarreau [Sat, 17 Dec 2011 15:34:27 +0000 (16:34 +0100)] 
BUG: http: re-enable TCP quick-ack upon incomplete HTTP requests

By default we disable TCP quick-acking on HTTP requests so that we
avoid sending a pure ACK immediately followed by the HTTP response.
However, if the client sends an incomplete request in a short packet,
its TCP stack might wait for this packet to be ACKed before sending
the rest of the request, delaying incoming requests by up to 40-200ms.

We can detect this undesirable situation when parsing the request :
  - if an incomplete request is received
  - if a full request is received and uses chunked encoding or advertises
    a content-length larger than the data available in the buffer

In these situations, we re-enable TCP quick-ack if we had previously
disabled it.

13 years agoMINOR: acl: add support for TLS server name matching using SNI
Willy Tarreau [Mon, 12 Dec 2011 16:23:41 +0000 (17:23 +0100)] 
MINOR: acl: add support for TLS server name matching using SNI

Server Name Indication (SNI) is a TLS extension which makes a client
present the name of the server it is connecting to in the client hello.
It allows a transparent proxy to take a decision based on the beginning
of an SSL/TLS stream without deciphering it.

The new ACL "req_ssl_sni" matches the name extracted from the TLS
handshake against a list of names which may be loaded from a file if
needed.

13 years agoOPTIM: stream_sock: save a failed recv syscall when splice returns EAGAIN
Willy Tarreau [Sun, 11 Dec 2011 21:37:06 +0000 (22:37 +0100)] 
OPTIM: stream_sock: save a failed recv syscall when splice returns EAGAIN

When splice() returns EAGAIN, on old kernels it could be caused by a read
shutdown which was not detected. Due to this behaviour, we had to fall
back to recv(), which in turn says if it's a real EAGAIN or a shutdown.
Since this behaviour was fixed in 2.6.27.14, on more recent kernels we'd
prefer to avoid the fallback to recv() when possible. For this, we set a
variable the first time splice() detects a shutdown, to indicate that it
works. We can then rely on this variable to adjust our behaviour.

Doing this alone increased the overall performance by about 1% on medium
sized objects.

13 years agoOPTIM: stream_sock: reduce the amount of in-flight spliced data
Willy Tarreau [Sun, 11 Dec 2011 21:11:47 +0000 (22:11 +0100)] 
OPTIM: stream_sock: reduce the amount of in-flight spliced data

First, it's a waste not to call chk_snd() when spliced data are available,
because the pipe can almost always be transferred into the outgoing socket
buffers. Starting from now, when we splice data in, we immediately try to
send them. This results in less pipes used, and possibly less kernel memory
in use at once.

Second, if a pipe cannot be transferred into the outgoing socket buffers,
it means this buffer is full. There's no point trying again then, as space
will almost never be available, resulting in a useless syscall returning
EAGAIN.

13 years agoBUG: ebtree: ebst_lookup() could return the wrong entry
Willy Tarreau [Mon, 14 Nov 2011 13:09:27 +0000 (14:09 +0100)] 
BUG: ebtree: ebst_lookup() could return the wrong entry

(from ebtree 6.0.7)

Julien Thomas provided a reproducible test case where a string lookup
could return the wrong node. The issue is caused by the jump to a node
which contains less bit in common than the previous node, making the
string_equal_bits() function return -1. We must not remember more bits
than the number on the node, otherwise we can be tempted to trust them
while they can change while running down.

For a valid test case, enter : "0", "WW", "W", "S", and lookup "W".
Previously, "S" was returned.

Note: string-based ebtrees are used in haproxy in ACL, peers and
stick-tables. ACLs are not affected because all patterns are
interchangeable. stick-tables are not affected because lookups are
performed using ebmb_lookup(). Only peers might be affected though
it is not easy to infirm or confirm the issue.

(cherry picked from commit dd47a54103597458887d3cc8414853a541aee9c1)

13 years agoCLEANUP: ebtree: remove another typo, a wrong initialization in insertion code
Willy Tarreau [Mon, 19 Sep 2011 18:48:00 +0000 (20:48 +0200)] 
CLEANUP: ebtree: remove another typo, a wrong initialization in insertion code

(from ebtree 6.0.7)

root_right was wrongly initialized first to <root> which is not the same
type, to be later initialized to root->b[EB_RGHT].

Let's simply remove the wrong and useless initialization.
(cherry picked from commit e63a0c2f56369b52c4d00221d83c2c4569605c06)

13 years agoCLEANUP: ebtree: remove 4-year old harmless typo in duplicates insertion code
Willy Tarreau [Mon, 19 Sep 2011 18:36:45 +0000 (20:36 +0200)] 
CLEANUP: ebtree: remove 4-year old harmless typo in duplicates insertion code

(from ebtree 6.0.7)

This typo has been there since we introduced duplicates. A "struct eb_troot *"
which apparently the compiler doesn't complain about while it is never declared
anywhere. Amazing...

(cherry picked from commit 2879648db5d32cf009ae571cb0e8e1df75152281)

13 years agoCLEANUP: ebtree: clarify licence and update to 6.0.6
Willy Tarreau [Mon, 25 Jul 2011 09:38:17 +0000 (11:38 +0200)] 
CLEANUP: ebtree: clarify licence and update to 6.0.6

(from ebtree 6.0.6)

This version is mainly aimed at clarifying the fact that the ebtree license
is LGPL. Some files used to indicate LGPL and other ones GPL, while the goal
clearly is to have it LGPL. A LICENSE file has also been added.

No code is affected, but it's better to have the local tree in sync anyway.

(cherry picked from commit 24dc7cca051f081600fe8232f33e55ed30e88425)

13 years agoCLEANUP: ebtree: remove a few annoying signedness warnings
Willy Tarreau [Mon, 25 Jul 2011 10:22:44 +0000 (12:22 +0200)] 
CLEANUP: ebtree: remove a few annoying signedness warnings

(from ebtree 6.0.6)

Care has been taken not to make the code bigger (it even got smaller
due to a possible simplification).
(cherry picked from commit 7a2c1df646049c7daac52677ec11ed63048cd150)

13 years agoBUG: tcp: option nolinger does not work on backends
Willy Tarreau [Wed, 30 Nov 2011 17:02:24 +0000 (18:02 +0100)] 
BUG: tcp: option nolinger does not work on backends

Daniel Rankov reported that "option nolinger" is inefficient on backends.
The reason is that it is set on the file descriptor only, which does not
prevent haproxy from performing a clean shutdown() before closing. We must
set the flag on the stream_interface instead if we want an RST to be emitted
upon active close.

13 years agoCLEANUP: kill buffer_replace() and use an inline instead
Willy Tarreau [Mon, 28 Nov 2011 09:36:13 +0000 (10:36 +0100)] 
CLEANUP: kill buffer_replace() and use an inline instead

This function is never used, only its buffer_replace2() alternative
is used. Replace the former with an inline which calls the later.

13 years agoMINOR: buffers: make buffer_pointer() support negative pointers too
Willy Tarreau [Mon, 28 Nov 2011 15:04:29 +0000 (16:04 +0100)] 
MINOR: buffers: make buffer_pointer() support negative pointers too

It's more handy if the buffer_pointer() function also handles negative pointers.

13 years agoBUG: buffers: don't return a negative value on buffer_total_space_res()
Willy Tarreau [Mon, 28 Nov 2011 12:40:49 +0000 (13:40 +0100)] 
BUG: buffers: don't return a negative value on buffer_total_space_res()

In commit 4b517ca93aaaead8aa6143aa2836dc96417653c6 (MEDIUM: buffers:
add some new primitives and rework existing ones), we forgot to check
if buffer_max_len() < l.

No backport is needed.

13 years agoMEDIUM: buffers: add some new primitives and rework existing ones
Willy Tarreau [Fri, 25 Nov 2011 19:33:58 +0000 (20:33 +0100)] 
MEDIUM: buffers: add some new primitives and rework existing ones

A number of primitives were missing for buffer management, and some
of them were particularly awkward to use. Specifically, the functions
used to compute free space could not always be used depending what was
wrapping in the buffers. Some documentation has been added about how
the buffers work and their properties. Some functions are still missing
such as a buffer replacement which would support wrapping buffers.

13 years agoMEDIUM: log: Use linked lists for loggers
William Lallemand [Wed, 12 Oct 2011 15:50:54 +0000 (17:50 +0200)] 
MEDIUM: log: Use linked lists for loggers

This patch settles the 2 loggers limitation.
Loggers are now stored in linked lists.

Using "global log", the global loggers list content is added at the end
of the current proxy list. Each "log" entries are added at the end of
the proxy list.

"no log" flush a logger list.

13 years agoMINOR: config: tolerate server "cookie" setting in non-HTTP mode
Willy Tarreau [Mon, 31 Oct 2011 12:49:26 +0000 (13:49 +0100)] 
MINOR: config: tolerate server "cookie" setting in non-HTTP mode

Up to now, if a cookie value was specified on a server when the proxy was
in TCP mode, it would cause a fatal error. Now we only report a warning,
since the cookie will be ignored. This makes it easier to generate configs
from scripts.

13 years agoBUG/MEDIUM: checks: fix slowstart behaviour when server tracking is in use
Willy Tarreau [Mon, 31 Oct 2011 10:53:20 +0000 (11:53 +0100)] 
BUG/MEDIUM: checks: fix slowstart behaviour when server tracking is in use

Ludovic Levesque reported and diagnosed an annoying bug. When a server is
configured to track another one and has a slowstart interval set, it's
assigned a minimal weight when the tracked server goes back up but keeps
this weight forever.

This is because the throttling during the warmup phase is only computed
in the health checking function.

After several attempts to resolve the issue, the only real solution is to
split the check processing task in two tasks, one for the checks and one
for the warmup. Each server with a slowstart setting has a warmum task
which is responsible for updating the server's weight after a down to up
transition. The task does not run in othe situations.

In the end, the fix is neither complex nor long and should be backported
to 1.4 since the issue was detected there first.

13 years agoCLEANUP: rename possibly confusing struct field "tracked"
Willy Tarreau [Fri, 28 Oct 2011 13:35:33 +0000 (15:35 +0200)] 
CLEANUP: rename possibly confusing struct field "tracked"

When reading the code, the "tracked" member of a server makes one
think the server is tracked while it's the opposite, it's a pointer
to the server being tracked. This is particularly true in constructs
such as :

if (srv->tracked) {

Since it's the second time I get caught misunderstanding it, let's
rename it to "track" to avoid the confusion.

13 years agoBUG/MINOR: fix a segfault when parsing a config with undeclared peers
Willy Tarreau [Fri, 28 Oct 2011 12:16:49 +0000 (14:16 +0200)] 
BUG/MINOR: fix a segfault when parsing a config with undeclared peers

Baptiste Assmann reported that a config where a non-existing peers
section is referenced by a stick-table causes a segfault after displaying
the error. This is caused by the freeing of the peers. Setting it to NULL
after displaying the error fixes the issue.

13 years agoMEDIUM: tune.http.maxhdr makes it possible to configure the maximum number of HTTP...
Willy Tarreau [Mon, 24 Oct 2011 17:14:41 +0000 (19:14 +0200)] 
MEDIUM: tune.http.maxhdr makes it possible to configure the maximum number of HTTP headers

For a long time, the max number of headers was taken as a part of the buffer
size. Since the header size can be configured at runtime, it does not make
much sense anymore.

Nothing was making it necessary to have a static value, so let's turn this into
a tunable with a default value of 101 which equals what was previously used.

13 years agoOPTIM/MINOR: move the hdr_idx pools out of the proxy struct
Willy Tarreau [Mon, 24 Oct 2011 16:15:04 +0000 (18:15 +0200)] 
OPTIM/MINOR: move the hdr_idx pools out of the proxy struct

It makes no sense to have one pointer to the hdr_idx pool in each proxy
struct since these pools do not depend on the proxy. Let's have a common
pool instead as it is already the case for other types.

13 years agoBUILD/MINOR: silent a build warning in src/pipe.c (fcntl)
Willy Tarreau [Mon, 24 Oct 2011 15:09:22 +0000 (17:09 +0200)] 
BUILD/MINOR: silent a build warning in src/pipe.c (fcntl)

13 years agoOPTIM/MINOR: make it possible to change pipe size (tune.pipesize)
Willy Tarreau [Sun, 23 Oct 2011 19:14:29 +0000 (21:14 +0200)] 
OPTIM/MINOR: make it possible to change pipe size (tune.pipesize)

By default, pipes are the default size for the system. But sometimes when
using TCP splicing, it can improve performance to increase pipe sizes,
especially if it is suspected that pipes are not filled and that many
calls to splice() are performed. This has an impact on the kernel's
memory footprint, so this must not be changed if impacts are not understood.

13 years agoOPTIM/MINOR: move struct sockaddr_storage to the tail of structs
Willy Tarreau [Fri, 21 Oct 2011 16:51:57 +0000 (18:51 +0200)] 
OPTIM/MINOR: move struct sockaddr_storage to the tail of structs

Struct sockaddr_storage is huge (128 bytes) and severely impacts the
cache. It also displaces other struct members, causing them to have
larger relative offsets. By moving these few occurrences to the end
of the structs which host them, we can reduce the code size by no less
than 2 kB !

13 years agoDOC: indicate that cookie "prefix" and "indirect" should not be mixed
Willy Tarreau [Mon, 17 Oct 2011 10:24:55 +0000 (12:24 +0200)] 
DOC: indicate that cookie "prefix" and "indirect" should not be mixed

When prefix and indirect are used together, a client which connects to
a server with a cookie will never get any cookie update from this server,
which will be removed by the "indirect" option.

13 years agoMINOR: halog: add support for matching queued requests
Willy Tarreau [Thu, 13 Oct 2011 11:28:36 +0000 (13:28 +0200)] 
MINOR: halog: add support for matching queued requests

-Q outputs all requests which went through at least one queue.
-QS outputs all requests which went through a server queue.

13 years agoBUG/MINOR: fix options forwardfor if-none when an alternative header name is specified
Sagi Bashari [Sat, 8 Oct 2011 20:48:48 +0000 (22:48 +0200)] 
BUG/MINOR: fix options forwardfor if-none when an alternative header name is specified

13 years agoMINOR: remove the client/server side distinction in SI addresses
Willy Tarreau [Fri, 23 Sep 2011 08:54:59 +0000 (10:54 +0200)] 
MINOR: remove the client/server side distinction in SI addresses

Stream interfaces used to distinguish between client and server addresses
because they were previously of different types (sockaddr_storage for the
client, sockaddr_in for the server). This is not the case anymore, and this
distinction is confusing at best and has caused a number of regressions to
be introduced in the process of converting everything to full-ipv6. We can
now remove this and have a much cleaner code.

13 years agoBUG/MINOR: don't use a wrong port when connecting to a server with mapped ports
Willy Tarreau [Fri, 23 Sep 2011 08:27:12 +0000 (10:27 +0200)] 
BUG/MINOR: don't use a wrong port when connecting to a server with mapped ports

Nick Chalk reported that a connection to a server which has no port specified
used twice the port number. The reason is that the port number was taken from
the wrong part of the address, the client's destination address was used as the
base port instead of the server's configured address.

Thanks to Nick for his helpful diagnostic.