Commit Graph

2010 Commits

Author SHA1 Message Date
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
Willy Tarreau
74172757c7 [MINOR] standard: change arg type from const char* to char*
inetaddr_host_lim_ret() used to make use of const char** for some
args, but that make it impossible ot use char** due to the way
controls are made by gcc. So let's change that.
2010-10-30 19:04:37 +02:00
Willy Tarreau
4ec83cd939 [MINOR] standard: add read_uint() to parse a delimited unsigned integer
This function parses an integer and returns it along with the pointer to the
next char not part of the number.
2010-10-30 19:04:37 +02:00
Willy Tarreau
8a95691ae8 [MINOR] listener: add the "accept-proxy" option to the "bind" keyword
This option will enable the AN_REQ_DECODE_PROXY analyser on the requests
that come from those listeners.
2010-10-30 19:04:37 +02:00
Willy Tarreau
6e595772ad [MINOR] buffers: add a new request analyser flag for PROXY mode
Since it must be the first analyser, the other flags have been renumbered.
2010-10-30 19:04:37 +02:00
Willy Tarreau
24bcb4f2ff [CONTRIB] halog: minor speed improvement in timer parser
The timer parser looks for the next slash after the last timer, which is
very far away. Those 4 occurrences have been fixed to match the way it's
done in URL sorting, which is faster. Average speed gain is 5-6% on -srv
and -pct.
(cherry picked from commit 3555671c93695f48c02ef05c8bb228523f17ca20)
2010-10-30 19:04:37 +02:00
Willy Tarreau
abe45b6bb3 [CONTRIB] halog: report per-url counts, errors and times
Using -u{,c,e,t,a,to,ao} it is possible to get per-URL statistics, sorted by
URL, request count, error count, total time, avg time, total time on OK requests,
avg time on OK requests.

Since it has to parse URLs and store a number of fields, it's quite slower
than other methods, but still correct for production usage (typically 800000
lines or 270 MB per second on a 2 GHz system).

Results are sorted in reverse order so that it's easy to catch them by piping
the output to the "head" command.
(cherry picked from commit 15ce7f56d15f839ce824279b84ffe14c58e41fda)
2010-10-30 19:04:37 +02:00