]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: tcp/http: fix current_rule assignment when restarting over a ruleset
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Apr 2015 11:26:17 +0000 (13:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Apr 2015 11:46:20 +0000 (13:46 +0200)
commit152b81e7b2565862956af883820d4f79177d0651
treed33207a274a24ab9cdf736bd1958f1e3f19b4a92
parente759749b50417895632c4e4481434f947176f28c
BUG/MAJOR: tcp/http: fix current_rule assignment when restarting over a ruleset

Commit bc4c1ac ("MEDIUM: http/tcp: permit to resume http and tcp custom
actions") introduced the ability to interrupt and restart processing in
the middle of a TCP/HTTP ruleset. But it doesn't do it in a consistent
way : it checks current_rule_list, immediately dereferences current_rule,
which is only set in certain cases and never cleared. So that broke the
tcp-request content rules when the processing was interrupted due to
missing data, because current_rule was not yet set (segfault) or could
have been inherited from another ruleset if it was used in a backend
(random behaviour).

The proper way to do it is to always set current_rule before dereferencing
it. But we don't want to set it for all rules because we don't want any
action to provide a checkpointing mechanism. So current_rule is set to NULL
before entering the loop, and only used if not NULL and if current_rule_list
matches the current list. This way they both serve as a guard for the other
one. This fix also makes the current rule point to the rule instead of its
list element, as it's much easier to manipulate.

No backport is needed, this is 1.6-specific.
include/types/stream.h
src/proto_http.c
src/proto_tcp.c