mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-07 03:48:46 +00:00
BUG/MEDIUM: stick_table: fix crash when using tcp smp_fetch_src
Since the introduction of bc_src, smp_fetch_src from tcp_sample inspect
the kw argument to choose between the frontend or the backend source
address. However, for the stick tables, the argument is left to NULL.
This causes a segfault.
Fix the crash by explicitely set the kw argument to "src" to retrieve
the source address of the frontend side.
This bug was introduced by the following commit :
7d081f02a4
MINOR: tcp_samples: Add samples to get src/dst info of the backend connection
It does not need a backport as it is integrated in the current 2.4-dev
branch.
To reproduce the crash, I used the following config :
frontend fe
bind :20080
http-request track-sc0 src table foo
http-request reject if { src_conn_rate(foo) gt 10 }
use_backend h1
backend foo
stick-table type ip size 200k expire 30s store conn_rate(60s)
backend h1
server nginx 127.0.0.1:30080 check
This should fix the github issue #1247.
This commit is contained in:
parent
40a871f09d
commit
c460c70ab7
@ -2362,7 +2362,7 @@ smp_fetch_sc_stkctr(struct session *sess, struct stream *strm, const struct arg
|
||||
smp.px = NULL;
|
||||
smp.sess = sess;
|
||||
smp.strm = strm;
|
||||
if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, &smp, NULL, NULL))
|
||||
if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, &smp, "src", NULL))
|
||||
return NULL;
|
||||
|
||||
/* Converts into key. */
|
||||
@ -2427,7 +2427,7 @@ smp_create_src_stkctr(struct session *sess, struct stream *strm, const struct ar
|
||||
smp.px = NULL;
|
||||
smp.sess = sess;
|
||||
smp.strm = strm;
|
||||
if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, &smp, NULL, NULL))
|
||||
if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, &smp, "src", NULL))
|
||||
return NULL;
|
||||
|
||||
/* Converts into key. */
|
||||
@ -2959,7 +2959,7 @@ smp_fetch_src_updt_conn_cnt(const struct arg *args, struct sample *smp, const ch
|
||||
return 0;
|
||||
|
||||
/* Fetch source address in a sample. */
|
||||
if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, smp, NULL, NULL))
|
||||
if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, smp, "src", NULL))
|
||||
return 0;
|
||||
|
||||
/* Converts into key. */
|
||||
|
Loading…
Reference in New Issue
Block a user