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 :
7d081f02a43651d781a3a30a51ae19abdceb5683
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.
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. */
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. */
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. */