Commit Graph

1866 Commits

Author SHA1 Message Date
Cyril Bonté
1f5848a460 [CLEANUP] unix sockets : move create_uxst_socket() in uxst_bind_listener()
The code of create_uxst_socket() is moved in uxst_bind_listener() so that we
don't need to pass a lot of parameters, as it was only called there.
2010-11-14 17:21:44 +01:00
Cyril Bonté
e4cbbe2a0e [MINOR] unix sockets : inherits the backlog size from the listener
Since unix sockets are supported for bind, the default backlog size was not
enough to accept the traffic. The size is now inherited from the listener
to behave like the tcp listeners.

This also affects the "stats socket" backlog, which is now determined by
"stats maxconn".
2010-11-14 17:21:31 +01:00
Willy Tarreau
48d84c10b5 [OPTIM] linux: add support for bypassing libc to force using vsyscalls
Some distros' libc are built for CPUs earlier than i686 and as such do
not offer support for Linux kernel's faster vsyscalls. This code adds
a new build option USE_VSYSCALLS to bypass libc for most commonly used
system calls. A net gain of about 10% can be observed with this change
alone.

It only works when /proc/sys/abi/vsyscall32 equals exactly 2. When it's
set to 1, the VDSO is randomized and cannot be used.
2010-11-14 17:09:33 +01:00
Willy Tarreau
b695a6e5fa [BUILD] pattern: use 'int' instead of 'int32_t'
Ross West reported that int32_t breaks compilation on FreeBSD. Since an
int is 32-bit on all supported platforms and we already rely on that,
change the type.
2010-11-14 14:24:27 +01:00
Willy Tarreau
0a6b1fda03 [DOC] update ROADMAP file
move what was done and add a few collected wishes.
2010-11-14 14:23:22 +01:00
Willy Tarreau
442e8349f1 [RELEASE] Released version 1.5-dev3
Released version 1.5-dev3 with the following main changes :
    - [DOC] fix http-request documentation
    - [MEDIUM] enable/disable servers from the stats web interface
    - [MEDIUM] stats: add an admin level
    - [DOC] stats: document the "stats admin" statement
    - [MINOR] startup: print the proxy socket which caused an error
    - [CLEANUP] Remove unneeded chars allocation
    - [MINOR] config: detect options not supported due to compilation options
    - [MINOR] Add pattern's fetchs payload and payload_lv
    - [MINOR] frontend: improve accept-proxy header parsing
    - [MINOR] frontend: add tcpv6 support on accept-proxy bind
    - [MEDIUM] Enhance message errors management on binds
    - [MINOR] Manage unix socket source field on logs
    - [MINOR] Manage unix socket source field on session dump on sock stats
    - [MINOR] Support of unix listener sockets for debug and log event messages on frontend.c
    - [MINOR] Add some tests on sockets family for port remapping and mode transparent.
    - [MINOR] Manage socket type unix for some logs
    - [MINOR] Enhance controls of socket's family on acls and pattern fetch
    - [MINOR] Support listener's sockets unix on http logs.
    - [MEDIUM] Add supports of bind on unix sockets.
    - [BUG] stick table purge failure if size less than 255
    - [BUG] stick table entries expire on counters updates/read or show table, even if there is no "expire" parameter
    - [MEDIUM] Implement tcp inspect response rules
    - [DOC] tcp-response content and inspect
    - [MINOR] new acls fetch req_ssl_hello_type and rep_ssl_hello_type
    - [DOC] acls rep_ssl_hello and req_ssl_hello
    - [MEDIUM] Create new protected pattern types CONSTSTRING and CONSTDATA to force memcpy if data from protected areas need to be manipulated.
    - [DOC] new type binary in stick-table
    - [DOC] stick store-response and new patterns payload and payload_lv
    - [MINOR] Manage all types (ip, integer, string, binary) on cli "show table" command
    - [MEDIUM] Create updates tree on stick table to manage sync.
    - [MAJOR] Add new files src/peer.c, include/proto/peers.h and include/types/peers.h for sync stick table management
    - [MEDIUM] Manage peers section parsing and stick table registration on peers.
    - [MEDIUM] Manage soft stop on peers proxy
    - [DOC] add documentation for peers section
    - [MINOR] checks: add support for LDAPv3 health checks
    - [MINOR] add better support to "mysql-check"
    - [BUG] Restore info about available active/backup servers
    - [CONTRIB] Update haproxy.pl
    - [CONTRIB] Update Cacti Tempates
    - [CONTRIB] add templates for Cacti.
    - [BUG] http: don't consider commas as a header delimitor within quotes
    - [MINOR] support a global jobs counter
    - [DOC] add a summary about cookie incompatibilities between specs and browsers
    - [DOC] fix description of cookie "insert" and "indirect" modes
    - [MEDIUM] http: fix space handling in the request cookie parser
    - [MEDIUM] http: fix space handling in the response cookie parser
    - [DOC] fix typo in the queue() definition (backend, not frontend)
    - [BUG] deinit: unbind listeners before freeing them
    - [BUG] stream_interface: only call si->release when both dirs are closed
    - [MEDIUM] buffers: rework the functions to exchange between SI and buffers
    - [DOC] fix typo in the avg_queue() and be_conn() definition (backend, not frontend)
    - [MINOR] halog: add '-tc' to sort by termination codes
    - [MINOR] halog: skip non-traffic logs for -st and -tc
    - [BUG] stream_sock: cleanly disable the listener in case of resource shortage
    - [BUILD] stream_sock: previous fix lacked the #include, causing a warning.
    - [DOC] bind option is "defer-accept", not "defer_accept"
    - [DOC] missing index entry for http-check send-state
    - [DOC] tcp-request inspect-delay is for backends too
    - [BUG] ebtree: string_equal_bits() could return garbage on identical strings
    - [BUG] stream_sock: try to flush any extra pending request data after a POST
    - [BUILD] proto_http: eliminate some build warnings with gcc-2.95
    - [MEDIUM] make it possible to combine http-pretend-keepalived with httpclose
    - [MEDIUM] tcp-request : don't wait for inspect-delay to expire when the buffer is full
    - [MEDIUM] checks: add support for HTTP contents lookup
    - [TESTS] add test-check-expect to test various http-check methods
    - [MINOR] global: add "tune.chksize" to change the default check buffer size
    - [MINOR] cookie: add options "maxidle" and "maxlife"
    - [MEDIUM] cookie: support client cookies with some contents appended to their value
    - [MINOR] http: make some room in the transaction flags to extend cookies
    - [MINOR] cookie: add the expired (E) and old (O) flags for request cookies
    - [MEDIUM] cookie: reassign set-cookie status flags to store more states
    - [MINOR] add encode/decode function for 30-bit integers from/to base64
    - [MEDIUM] cookie: check for maxidle and maxlife for incoming dated cookies
    - [MEDIUM] cookie: set the date in the cookie if needed
    - [DOC] document the cookie maxidle and maxlife parameters
    - [BUG] checks: don't log backend down for all zero-weight servers
    - [MEDIUM] checks: set server state to one state from failure when leaving maintenance
    - [BUG] config: report correct keywords for "observe"
    - [MINOR] checks: ensure that we can inherit binary checks from the defaults section
    - [MINOR] acl: add the http_req_first match
    - [DOC] fix typos about bind-process syntax
    - [BUG] cookie: correctly unset default cookie parameters
    - [MINOR] cookie: add support for the "preserve" option
    - [BUG] ebtree: fix duplicate strings insertion
    - [CONTRIB] halog: report per-url counts, errors and times
    - [CONTRIB] halog: minor speed improvement in timer parser
    - [MINOR] buffers: add a new request analyser flag for PROXY mode
    - [MINOR] listener: add the "accept-proxy" option to the "bind" keyword
    - [MINOR] standard: add read_uint() to parse a delimited unsigned integer
    - [MINOR] standard: change arg type from const char* to char*
    - [MINOR] frontend: add a new analyser to parse a proxied connection
    - [MEDIUM] session: call the frontend_decode_proxy analyser on proxied connections
    - [DOC] add the proxy protocol's specifications
    - [DOC] document the 'accept-proxy' bind option
    - [MINOR] cfgparse: report support of <path> for the 'bind' statements
    - [DOC] add references to unix socket handling
    - [MINOR] move MAXPATHLEN definition to compat.h
    - [MEDIUM] unix sockets: cleanup the error reporting path
    - [BUG] session: don't stop forwarding of data upon last packet
    - [CLEANUP] accept: replace some inappropriate Alert() calls with send_log()
    - [BUILD] peers: shut a printf format warning (key_size is a size_t)
    - [BUG] accept: don't close twice upon error
    - [OPTIM] session: don't recheck analysers when buffer flags have not changed
    - [OPTIM] stream_sock: don't clear FDs that are already cleared
    - [BUG] proto_tcp: potential bug on pattern fetch dst and dport
2010-11-11 23:29:35 +01:00
Willy Tarreau
11f49408f2 [OPTIM] stream_sock: don't clear FDs that are already cleared
We can on average two calls to __fd_clr() per session by avoiding to
call it unnecessarily.
2010-11-11 23:08:17 +01:00
Willy Tarreau
2f976e18b8 [OPTIM] session: don't recheck analysers when buffer flags have not changed
Analysers were re-evaluated when some flags were still present in the
buffers, even if they had not changed since previous pass, resulting
in a waste of CPU cycles.

Ensuring that the flags have changed has saved some useless calls :

  function            min calls per session (before -> after)

  http_request_forward_body       5 -> 4
  http_response_forward_body      3 -> 2
  http_sync_req_state            10 -> 8
  http_sync_res_state             8 -> 6
  http_resync_states              8 -> 6
2010-11-11 14:28:47 +01:00
Willy Tarreau
abe8ea5c1d [BUG] accept: don't close twice upon error
The stream_sock's accept() used to close the FD upon error, but this
was also sometimes performed by the frontend's accept() called via the
session's accept(). Those interlaced calls were also responsible for the
spaghetti-looking error unrolling code in session.c and stream_sock.c.

Now the frontend must not close the FD anymore, the session is responsible
for that. It also takes care of just closing the FD or also removing from
the FD lists, depending on its state. The socket-level accept() does not
have to care about that anymore.
2010-11-11 11:05:20 +01:00
Willy Tarreau
bd55e3167b [BUILD] peers: shut a printf format warning (key_size is a size_t)
Also fix a few misleading comments.
2010-11-11 11:05:04 +01:00
Willy Tarreau
fffe1325df [CLEANUP] accept: replace some inappropriate Alert() calls with send_log()
Some Alert() messages were remaining in the accept() path, which they
would have no chance to be detected. Remove some of them (the impossible
ones) and replace the relevant ones with send_log() so that the admin
has a chance to catch them.
2010-11-11 09:51:38 +01:00
Emeric Brun
f099e7906d [DOC] add documentation for peers section 2010-11-11 09:29:08 +01:00
Emeric Brun
5a8c0a9f52 [MEDIUM] Manage soft stop on peers proxy 2010-11-11 09:29:08 +01:00
Emeric Brun
32da3c40db [MEDIUM] Manage peers section parsing and stick table registration on peers. 2010-11-11 09:29:08 +01:00
Emeric Brun
2b920a1af1 [MAJOR] Add new files src/peer.c, include/proto/peers.h and include/types/peers.h for sync stick table management
Add cmdline option -L to configure local peer name
2010-11-11 09:29:08 +01:00
Emeric Brun
85e77c7f0d [MEDIUM] Create updates tree on stick table to manage sync. 2010-11-11 09:29:08 +01:00
Emeric Brun
1e029aa965 [MINOR] Manage all types (ip, integer, string, binary) on cli "show table" command 2010-11-11 09:29:07 +01:00
Emeric Brun
6a1cefacad [DOC] stick store-response and new patterns payload and payload_lv 2010-11-11 09:29:07 +01:00
Emeric
f2d7caedd1 [MINOR] Add pattern's fetchs payload and payload_lv 2010-11-11 09:29:07 +01:00
Emeric Brun
7c6b82ee43 [DOC] new type binary in stick-table 2010-11-11 09:29:07 +01:00
Emeric Brun
485479d8e9 [MEDIUM] Create new protected pattern types CONSTSTRING and CONSTDATA to force memcpy if data from protected areas need to be manipulated.
Enhance pattern convs and fetch argument parsing, now fetchs and convs callbacks used typed args.
Add more details on error messages on parsing pattern expression function.
Update existing pattern convs and fetchs to new proto.
Create stick table key type "binary".
Manage Truncation and padding if pattern's fetch-converted result don't match table key size.
2010-11-11 09:29:07 +01:00
Emeric Brun
392d1d8b89 [DOC] acls rep_ssl_hello and req_ssl_hello 2010-11-11 09:29:01 +01:00
Emeric Brun
38e7176961 [MINOR] new acls fetch req_ssl_hello_type and rep_ssl_hello_type 2010-11-11 09:28:55 +01:00
Emeric Brun
0a3b67fbd4 [DOC] tcp-response content and inspect 2010-11-11 09:28:48 +01:00
Emeric Brun
97679e7901 [MEDIUM] Implement tcp inspect response rules 2010-11-11 09:28:18 +01:00
Emeric Brun
c89a57284a [BUG] stick table entries expire on counters updates/read or show table, even if there is no "expire" parameter 2010-11-11 09:28:18 +01:00
Emeric Brun
fbce6d0215 [BUG] stick table purge failure if size less than 255
If table size is lower than 256, we can't force to purge old entries.
This patch should be backported to 1.4.
2010-11-11 09:28:18 +01:00
Willy Tarreau
da4d9fe5a4 [BUG] session: don't stop forwarding of data upon last packet
If a read shutdown is encountered on the first packet of a connection
right after the data and the last analyser is unplugged at the same
time, then that last data chunk may never be forwarded. In practice,
right now it cannot happen on requests due to the way they're scheduled,
nor can it happen on responses due to the way their analysers work.

But this behaviour has been observed with new response analysers being
developped.

The reason is that when the read shutdown is encountered and an analyser
is present, data cannot be forwarded but the BF_SHUTW_NOW flag is set.
After that, the analyser gets called and unplugs itself, hoping that
process_session() will automatically forward the data. This does not
happen due to BF_SHUTW_NOW.

Simply removing the test on this flag is not enough because then aborted
requests still get forwarded, due to the forwarding code undoing the
abort.

The solution here consists in checking BF_SHUTR_NOW instead of BF_SHUTW_NOW.
BF_SHUTR_NOW is only set on aborts and remains set until ->shutr() is called.
This is enough to catch recent aborts but not prevent forwarding in other
cases. Maybe a new special buffer flag "BF_ABORT" might be desirable in the
future.

This patch does not need to be backported because older versions don't
have the analyser which make the problem appear.
2010-11-11 09:26:29 +01:00
Cyril Bonté
62846b2674 [MINOR] config: detect options not supported due to compilation options
Some options depends on the target architecture or compilation options.
When such an option is used on a compiled version that doesn't support it,
it's probably better to identify it as an unsupported option due to
compilation options instead of an unknown option.

Edit: better check on the empty capability than on the option bits. -Willy
2010-11-11 09:26:28 +01:00
Cyril Bonté
acd7d63ff9 [CLEANUP] Remove unneeded chars allocation
Some arrays used to log addresses add some more bytes for ports but this space
is never used.
2010-11-11 09:26:28 +01:00
Willy Tarreau
b40dc94a9a [MEDIUM] unix sockets: cleanup the error reporting path
There were a lot of snprintf() everywhere in the UNIX bind code. Now we
proceed as for tcp and indicate the socket path at the end between square
brackets. The code is smaller and more readable.
2010-11-11 09:26:28 +01:00
Cyril Bonté
43ba1b331c [MINOR] startup: print the proxy socket which caused an error
Add the address and port to the error message of the proxy socket that caused
the error. This can be helpful when several listening addresses are used in a
proxy.

Edit: since we now also support unix sockets (which already report their
      path), better move the address reporting to proto_tcp.c by analogy.
      -Willy
2010-11-11 09:26:28 +01:00
Willy Tarreau
17f449b214 [MINOR] move MAXPATHLEN definition to compat.h
MAXPATHLEN may be used at other places, it's unconvenient to have it
redefined in a few files. Also, since checking it requires including
sys/param.h, some versions of it cause a macro declaration conflict
with MIN/MAX which are defined in tools.h. The solution consists in
including sys/param.h in both files so that we ensure it's loaded
before the macros are defined and MAXPATHLEN is checked.
2010-11-11 09:21:53 +01:00
Willy Tarreau
ceb24bc7b4 [DOC] add references to unix socket handling
UNIX listening sockets have some additional options and may log slightly
differently.
2010-11-09 15:59:42 +01:00
Willy Tarreau
d55c3feca6 [MINOR] cfgparse: report support of <path> for the 'bind' statements
"bind" now supports unix sockets, so report that in the error message.
2010-11-09 15:59:42 +01:00
Emeric Brun
ed76092e10 [MEDIUM] Add supports of bind on unix sockets. 2010-11-09 15:59:42 +01:00
Emeric Brun
5bd86a8ff5 [MINOR] Support listener's sockets unix on http logs.
Enhance controls of sockets family on X-Forwarded-For and X-Original-To insert
2010-11-09 15:59:42 +01:00
Emeric Brun
f769f51af6 [MINOR] Enhance controls of socket's family on acls and pattern fetch 2010-11-09 15:59:42 +01:00
Emeric Brun
0aaccf88f9 [MINOR] Manage socket type unix for some logs 2010-11-09 15:59:41 +01:00
Emeric Brun
ec810d1dc7 [MINOR] Add some tests on sockets family for port remapping and mode transparent. 2010-11-09 15:59:41 +01:00
Emeric Brun
ab844ea9e1 [MINOR] Support of unix listener sockets for debug and log event messages on frontend.c 2010-11-09 15:57:37 +01:00
Emeric Brun
837ca52de3 [MINOR] Manage unix socket source field on session dump on sock stats 2010-11-05 10:34:07 +01:00
Emeric Brun
4ab9262894 [MINOR] Manage unix socket source field on logs 2010-11-05 10:34:07 +01:00
Emeric Brun
cf20bf1c1c [MEDIUM] Enhance message errors management on binds 2010-11-05 10:34:07 +01:00
Willy Tarreau
71c814efcb [DOC] document the 'accept-proxy' bind option
This option enables the PROXY protocol over incoming connections.
2010-10-30 19:04:39 +02:00
Willy Tarreau
640cf22b9a [DOC] add the proxy protocol's specifications 2010-10-30 19:04:38 +02:00
Emeric Brun
861ccff9ca [MINOR] frontend: add tcpv6 support on accept-proxy bind 2010-10-30 19:04:38 +02:00
Emeric Brun
f4711a3221 [MINOR] frontend: improve accept-proxy header parsing
The accept-proxy now automatically fails as soon as a character does not
match the expected syntax.
2010-10-30 19:04:38 +02:00
Willy Tarreau
3041b9fcc3 [MEDIUM] session: call the frontend_decode_proxy analyser on proxied connections
This analyser must absolutely be the earliest one to process contents, given
the nature of the protocol.
2010-10-30 19:04:38 +02:00
Willy Tarreau
8b0cbf9969 [MINOR] frontend: add a new analyser to parse a proxied connection
The introduction of a new PROXY protocol for proxied connections requires
an early analyser to decode the incoming connection and set the session
flags accordingly.

Some more work is needed, among which setting a flag on the session to
indicate it's proxied, and copying the original parameters for later
comparisons with new ACLs (eg: real_src, ...).
2010-10-30 19:04:38 +02:00