MAJOR: sample: pass a pointer to the session to each sample fetch function

Many such function need a session, and till now they used to dereference
the stream. Once we remove the stream from the embryonic session, this
will not be possible anymore.

So as of now, sample fetch functions will be called with this :

   - sess = NULL,  strm = NULL                     : never
   - sess = valid, strm = NULL                     : tcp-req connection
   - sess = valid, strm = valid, strm->txn = NULL  : tcp-req content
   - sess = valid, strm = valid, strm->txn = valid : http-req / http-res
This commit is contained in:
Willy Tarreau 2015-04-04 01:47:55 +02:00
parent fdcd2ae1f8
commit 192252e2d8
20 changed files with 230 additions and 240 deletions

View File

@ -99,7 +99,7 @@ struct acl_cond *build_acl_cond(const char *file, int line, struct proxy *px, co
* function only computes the condition, it does not apply the polarity required
* by IF/UNLESS, it's up to the caller to do this.
*/
enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct stream *strm, unsigned int opt);
enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt);
/* Returns a pointer to the first ACL conflicting with usage at place <where>
* which is one of the SMP_VAL_* bits indicating a check place, or NULL if

View File

@ -126,10 +126,10 @@ void free_http_res_rules(struct list *r);
struct chunk *http_error_message(struct stream *s, int msgnum);
struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy,
const char **args, char **errmsg, int use_fmt);
int smp_fetch_cookie(struct proxy *px, struct stream *strm, unsigned int opt,
int smp_fetch_cookie(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private);
int
smp_fetch_base32(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_base32(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private);
enum http_meth_t find_http_meth(const char *str, const int len);

View File

@ -30,11 +30,12 @@ extern const char *smp_to_type[SMP_TYPES];
struct sample_expr *sample_parse_expr(char **str, int *idx, const char *file, int line, char **err, struct arg_list *al);
struct sample_conv *find_sample_conv(const char *kw, int len);
struct sample *sample_process(struct proxy *px, struct stream *strm,
unsigned int dir, struct sample_expr *expr,
struct sample *p);
struct sample *sample_fetch_string(struct proxy *px, struct stream *strm,
unsigned int opt, struct sample_expr *expr);
struct sample *sample_process(struct proxy *px, struct session *sess,
struct stream *strm, unsigned int opt,
struct sample_expr *expr, struct sample *p);
struct sample *sample_fetch_string(struct proxy *px, struct session *sess,
struct stream *strm, unsigned int opt,
struct sample_expr *expr);
void sample_register_fetches(struct sample_fetch_kw_list *psl);
void sample_register_convs(struct sample_conv_kw_list *psl);
const char *sample_src_names(unsigned int use);

View File

@ -47,7 +47,7 @@ struct stksess *stktable_lookup(struct stktable *t, struct stksess *ts);
struct stksess *stktable_lookup_key(struct stktable *t, struct stktable_key *key);
struct stksess *stktable_update_key(struct stktable *table, struct stktable_key *key);
struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t);
struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px,
struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct session *sess,
struct stream *strm, unsigned int opt,
struct sample_expr *expr, struct sample *smp);
int stktable_compatible_sample(struct sample_expr *expr, unsigned long table_type);

View File

@ -48,7 +48,7 @@ void stream_process_counters(struct stream *s);
void sess_change_server(struct stream *sess, struct server *newsrv);
struct task *process_stream(struct task *t);
void default_srv_error(struct stream *s, struct stream_interface *si);
struct stkctr *smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw);
struct stkctr *smp_fetch_sc_stkctr(struct session *sess, struct stream *strm, const struct arg *args, const char *kw);
int parse_track_counters(char **args, int *arg,
int section_type, struct proxy *curpx,
struct track_ctr_prm *prm,

View File

@ -207,6 +207,7 @@ enum {
};
/* needed below */
struct session;
struct stream;
/* a sample context might be used by any sample fetch function in order to
@ -285,6 +286,7 @@ struct sample_conv_expr {
struct sample_fetch {
const char *kw; /* configuration keyword */
int (*process)(struct proxy *px,
struct session *sess,
struct stream *strm,
unsigned int opt, /* fetch options (SMP_OPT_*) */
const struct arg *arg_p,

View File

@ -1097,7 +1097,7 @@ struct acl_cond *build_acl_cond(const char *file, int line, struct proxy *px, co
* if (cond->pol == ACL_COND_UNLESS)
* res = !res;
*/
enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct stream *strm, unsigned int opt)
enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt)
{
__label__ fetch_next;
struct acl_term_suite *suite;
@ -1141,7 +1141,7 @@ enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct
/* we need to reset context and flags */
memset(&smp, 0, sizeof(smp));
fetch_next:
if (!sample_process(px, strm, opt, expr->smp, &smp)) {
if (!sample_process(px, sess, strm, opt, expr->smp, &smp)) {
/* maybe we could not fetch because of missing data */
if (smp.flags & SMP_F_MAY_CHANGE && !(opt & SMP_OPT_FINAL))
acl_res |= ACL_TEST_MISS;

View File

@ -1483,7 +1483,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
* undefined behaviour.
*/
static int
smp_fetch_nbsrv(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_nbsrv(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
@ -1506,7 +1506,7 @@ smp_fetch_nbsrv(struct proxy *px, struct stream *strm, unsigned int opt,
* undefined behaviour.
*/
static int
smp_fetch_srv_is_up(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_srv_is_up(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct server *srv = args->data.srv;
@ -1526,7 +1526,7 @@ smp_fetch_srv_is_up(struct proxy *px, struct stream *strm, unsigned int opt,
* undefined behaviour.
*/
static int
smp_fetch_connslots(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_connslots(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct server *iterator;
@ -1554,7 +1554,7 @@ smp_fetch_connslots(struct proxy *px, struct stream *strm, unsigned int opt,
/* set temp integer to the id of the backend */
static int
smp_fetch_be_id(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_be_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TXN;
@ -1565,7 +1565,7 @@ smp_fetch_be_id(struct proxy *px, struct stream *strm, unsigned int opt,
/* set temp integer to the id of the server */
static int
smp_fetch_srv_id(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_srv_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
if (!objt_server(strm->target))
@ -1582,7 +1582,7 @@ smp_fetch_srv_id(struct proxy *px, struct stream *strm, unsigned int opt,
* undefined behaviour.
*/
static int
smp_fetch_be_sess_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_be_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
@ -1596,7 +1596,7 @@ smp_fetch_be_sess_rate(struct proxy *px, struct stream *strm, unsigned int opt,
* undefined behaviour.
*/
static int
smp_fetch_be_conn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_be_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
@ -1610,7 +1610,7 @@ smp_fetch_be_conn(struct proxy *px, struct stream *strm, unsigned int opt,
* undefined behaviour.
*/
static int
smp_fetch_queue_size(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_queue_size(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
@ -1628,7 +1628,7 @@ smp_fetch_queue_size(struct proxy *px, struct stream *strm, unsigned int opt,
* undefined behaviour.
*/
static int
smp_fetch_avg_queue_size(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_avg_queue_size(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int nbsrv;
@ -1657,7 +1657,7 @@ smp_fetch_avg_queue_size(struct proxy *px, struct stream *strm, unsigned int opt
* undefined behaviour.
*/
static int
smp_fetch_srv_conn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_srv_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
@ -1671,7 +1671,7 @@ smp_fetch_srv_conn(struct proxy *px, struct stream *strm, unsigned int opt,
* undefined behaviour.
*/
static int
smp_fetch_srv_sess_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_srv_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;

View File

@ -838,7 +838,7 @@ static int deflate_end(struct comp_ctx **comp_ctx)
/* boolean, returns true if compression is used (either gzip or deflate) in the response */
static int
smp_fetch_res_comp(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_res_comp(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
@ -848,7 +848,7 @@ smp_fetch_res_comp(struct proxy *px, struct stream *strm, unsigned int opt,
/* string, returns algo */
static int
smp_fetch_res_comp_algo(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_res_comp_algo(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
if (!strm->comp_algo)

View File

@ -220,12 +220,12 @@ int frontend_accept(struct stream *s)
/* set temp integer to the id of the frontend */
static int
smp_fetch_fe_id(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_fe_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_SESS;
smp->type = SMP_T_UINT;
smp->data.uint = strm_sess(strm)->fe->uuid;
smp->data.uint = sess->fe->uuid;
return 1;
}
@ -234,7 +234,7 @@ smp_fetch_fe_id(struct proxy *px, struct stream *strm, unsigned int opt,
* an undefined behaviour.
*/
static int
smp_fetch_fe_sess_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_fe_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
@ -248,7 +248,7 @@ smp_fetch_fe_sess_rate(struct proxy *px, struct stream *strm, unsigned int opt,
* an undefined behaviour.
*/
static int
smp_fetch_fe_conn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_fe_conn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;

View File

@ -2768,7 +2768,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
memset(&smp, 0, sizeof(smp));
/* Run the sample fetch process. */
if (!f->process(hsmp->p, hsmp->s, 0, args, &smp, f->kw, f->private)) {
if (!f->process(hsmp->p, hsmp->s->sess, hsmp->s, 0, args, &smp, f->kw, f->private)) {
if (hsmp->stringsafe)
lua_pushstring(L, "");
else
@ -3905,8 +3905,9 @@ static int hlua_sample_conv_wrapper(struct stream *stream, const struct arg *arg
* doesn't allow "yield" functions because the HAProxy engine cannot
* resume sample-fetches.
*/
static int hlua_sample_fetch_wrapper(struct proxy *px, struct stream *s,
unsigned int opt, const struct arg *arg_p,
static int hlua_sample_fetch_wrapper(struct proxy *px, struct session *sess,
struct stream *s, unsigned int opt,
const struct arg *arg_p,
struct sample *smp, const char *kw, void *private)
{
struct hlua_function *fcn = (struct hlua_function *)private;

View File

@ -590,21 +590,21 @@ void bind_dump_kws(char **out)
/* set temp integer to the number of connexions to the same listening socket */
static int
smp_fetch_dconn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_dconn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_UINT;
smp->data.uint = strm_sess(strm)->listener->nbconn;
smp->data.uint = sess->listener->nbconn;
return 1;
}
/* set temp integer to the id of the socket (listener) */
static int
smp_fetch_so_id(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_so_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_UINT;
smp->data.uint = strm_sess(strm)->listener->luid;
smp->data.uint = sess->listener->luid;
return 1;
}

View File

@ -971,9 +971,9 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
case LOG_FMT_EXPR: // sample expression, may be request or response
key = NULL;
if (tmp->options & LOG_OPT_REQ_CAP)
key = sample_fetch_string(be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, tmp->expr);
key = sample_fetch_string(be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, tmp->expr);
if (!key && (tmp->options & LOG_OPT_RES_CAP))
key = sample_fetch_string(be, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, tmp->expr);
key = sample_fetch_string(be, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, tmp->expr);
if (tmp->options & LOG_OPT_HTTP)
ret = encode_chunk(tmplog, dst + maxsize,
'%', http_encode_map, key ? &key->data.str : &empty);

View File

@ -29,7 +29,7 @@
* used with content inspection.
*/
static int
smp_fetch_wait_end(struct proxy *px, struct stream *s, unsigned int opt,
smp_fetch_wait_end(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
if (!(opt & SMP_OPT_FINAL)) {
@ -43,7 +43,7 @@ smp_fetch_wait_end(struct proxy *px, struct stream *s, unsigned int opt,
/* return the number of bytes in the request buffer */
static int
smp_fetch_len(struct proxy *px, struct stream *s, unsigned int opt,
smp_fetch_len(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct channel *chn;
@ -60,7 +60,7 @@ smp_fetch_len(struct proxy *px, struct stream *s, unsigned int opt,
/* returns the type of SSL hello message (mainly used to detect an SSL hello) */
static int
smp_fetch_ssl_hello_type(struct proxy *px, struct stream *s, unsigned int opt,
smp_fetch_ssl_hello_type(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int hs_len;
@ -128,7 +128,7 @@ smp_fetch_ssl_hello_type(struct proxy *px, struct stream *s, unsigned int opt,
* Note: this decoder only works with non-wrapping data.
*/
static int
smp_fetch_req_ssl_ver(struct proxy *px, struct stream *s, unsigned int opt,
smp_fetch_req_ssl_ver(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int version, bleft, msg_len;
@ -264,7 +264,7 @@ smp_fetch_req_ssl_ver(struct proxy *px, struct stream *s, unsigned int opt,
* - opaque hostname[name_len bytes]
*/
static int
smp_fetch_ssl_hello_sni(struct proxy *px, struct stream *s, unsigned int opt,
smp_fetch_ssl_hello_sni(struct proxy *px, struct session *sess, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int hs_len, ext_len, bleft;
@ -493,7 +493,7 @@ fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, i
* returned sample has type SMP_T_CSTR.
*/
int
smp_fetch_rdp_cookie(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_rdp_cookie(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
return fetch_rdp_cookie_name(strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0);
@ -501,12 +501,12 @@ smp_fetch_rdp_cookie(struct proxy *px, struct stream *strm, unsigned int opt,
/* returns either 1 or 0 depending on whether an RDP cookie is found or not */
static int
smp_fetch_rdp_cookie_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_rdp_cookie_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int ret;
ret = smp_fetch_rdp_cookie(px, strm, opt, args, smp, kw, private);
ret = smp_fetch_rdp_cookie(px, sess, strm, opt, args, smp, kw, private);
if (smp->flags & SMP_F_MAY_CHANGE)
return 0;
@ -519,7 +519,7 @@ smp_fetch_rdp_cookie_cnt(struct proxy *px, struct stream *strm, unsigned int opt
/* extracts part of a payload with offset and length at a given position */
static int
smp_fetch_payload_lv(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_payload_lv(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
{
unsigned int len_offset = arg_p[0].data.uint;
@ -573,7 +573,7 @@ smp_fetch_payload_lv(struct proxy *px, struct stream *strm, unsigned int opt,
/* extracts some payload at a fixed position and length */
static int
smp_fetch_payload(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_payload(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
{
unsigned int buf_offset = arg_p[0].data.uint;

View File

@ -2876,7 +2876,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
/* Check if we want to fail this monitor request or not */
list_for_each_entry(cond, &sess->fe->mon_fail_cond, list) {
int ret = acl_exec_cond(cond, sess->fe, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
int ret = acl_exec_cond(cond, sess->fe, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (cond->pol == ACL_COND_UNLESS)
@ -3103,6 +3103,7 @@ int http_handle_stats(struct stream *s, struct channel *req)
{
struct stats_admin_rule *stats_admin_rule;
struct stream_interface *si = &s->si[1];
struct session *sess = s->sess;
struct http_txn *txn = s->txn;
struct http_msg *msg = &txn->req;
struct uri_auth *uri_auth = s->be->uri_auth;
@ -3197,7 +3198,7 @@ int http_handle_stats(struct stream *s, struct channel *req)
int ret = 1;
if (stats_admin_rule->cond) {
ret = acl_exec_cond(stats_admin_rule->cond, s->be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(stats_admin_rule->cond, s->be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (stats_admin_rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -3353,7 +3354,7 @@ http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
if (rule->cond) {
int ret;
ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
@ -3566,7 +3567,7 @@ resume_execution:
void *ptr;
t = rule->act_prm.trk_ctr.table.t;
key = stktable_fetch_key(t, s->be, s, SMP_OPT_DIR_REQ | SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL);
key = stktable_fetch_key(t, s->be, sess, s, SMP_OPT_DIR_REQ | SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL);
if (key && (ts = stktable_get_entry(t, key))) {
stream_track_stkctr(&s->stkctr[http_req_trk_idx(rule->action)], t, ts);
@ -3629,7 +3630,7 @@ http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
if (rule->cond) {
int ret;
ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, px, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
@ -4171,7 +4172,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
/* add request headers from the rule sets in the same order */
list_for_each_entry(wl, &px->req_add, list) {
if (wl->cond) {
int ret = acl_exec_cond(wl->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
int ret = acl_exec_cond(wl->cond, px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (((struct acl_cond *)wl->cond)->pol == ACL_COND_UNLESS)
ret = !ret;
@ -4209,7 +4210,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
if (rule->cond) {
int ret;
ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -6396,7 +6397,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
if (txn->status < 200 && txn->status != 101)
break;
if (wl->cond) {
int ret = acl_exec_cond(wl->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
int ret = acl_exec_cond(wl->cond, px, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (((struct acl_cond *)wl->cond)->pol == ACL_COND_UNLESS)
ret = !ret;
@ -7153,6 +7154,7 @@ int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_e
*/
int apply_filters_to_request(struct stream *s, struct channel *req, struct proxy *px)
{
struct session *sess = s->sess;
struct http_txn *txn = s->txn;
struct hdr_exp *exp;
@ -7177,7 +7179,7 @@ int apply_filters_to_request(struct stream *s, struct channel *req, struct proxy
* next filter if the condition does not match.
*/
if (exp->cond) {
ret = acl_exec_cond(exp->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(exp->cond, px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (((struct acl_cond *)exp->cond)->pol == ACL_COND_UNLESS)
ret = !ret;
@ -7977,6 +7979,7 @@ int apply_filter_to_sts_line(struct stream *s, struct channel *rtr, struct hdr_e
*/
int apply_filters_to_response(struct stream *s, struct channel *rtr, struct proxy *px)
{
struct session *sess = s->sess;
struct http_txn *txn = s->txn;
struct hdr_exp *exp;
@ -8003,7 +8006,7 @@ int apply_filters_to_response(struct stream *s, struct channel *rtr, struct prox
* next filter if the condition does not match.
*/
if (exp->cond) {
ret = acl_exec_cond(exp->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
ret = acl_exec_cond(exp->cond, px, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (((struct acl_cond *)exp->cond)->pol == ACL_COND_UNLESS)
ret = !ret;
@ -9908,8 +9911,8 @@ static int
smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
const struct arg *args, struct sample *smp, int req_vol)
{
struct http_txn *txn = s->txn;
struct http_msg *msg = &txn->req;
struct http_txn *txn;
struct http_msg *msg;
/* Note: this function may only be used from places where
* http_init_txn() has already been done, and implies that <s>,
@ -9917,8 +9920,13 @@ smp_prefetch_http(struct proxy *px, struct stream *s, unsigned int opt,
* against an eventual mistake in the fetch capability matrix.
*/
if (unlikely(!s || !txn))
if (!s)
return 0;
txn = s->txn;
if (!txn)
return 0;
msg = &txn->req;
/* Check for a dependency on a request */
smp->type = SMP_T_BOOL;
@ -10036,7 +10044,7 @@ static int pat_parse_meth(const char *text, struct pattern *pattern, int mflags,
* This is intended to be used with pat_match_meth() only.
*/
static int
smp_fetch_meth(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_meth(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int meth;
@ -10090,7 +10098,7 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e
}
static int
smp_fetch_rqver(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_rqver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
@ -10115,7 +10123,7 @@ smp_fetch_rqver(struct proxy *px, struct stream *strm, unsigned int opt,
}
static int
smp_fetch_stver(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_stver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10145,7 +10153,7 @@ smp_fetch_stver(struct proxy *px, struct stream *strm, unsigned int opt,
/* 3. Check on Status Code. We manipulate integers here. */
static int
smp_fetch_stcode(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_stcode(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10169,7 +10177,7 @@ smp_fetch_stcode(struct proxy *px, struct stream *strm, unsigned int opt,
/* 4. Check on URL/URI. A pointer to the URI is stored. */
static int
smp_fetch_url(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_url(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10185,7 +10193,7 @@ smp_fetch_url(struct proxy *px, struct stream *strm, unsigned int opt,
}
static int
smp_fetch_url_ip(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_url_ip(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10205,7 +10213,7 @@ smp_fetch_url_ip(struct proxy *px, struct stream *strm, unsigned int opt,
}
static int
smp_fetch_url_port(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_url_port(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10232,7 +10240,7 @@ smp_fetch_url_port(struct proxy *px, struct stream *strm, unsigned int opt,
* returns full lines instead (useful for User-Agent or Date for example).
*/
static int
smp_fetch_fhdr(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_fhdr(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct hdr_idx *idx;
@ -10290,7 +10298,7 @@ smp_fetch_fhdr(struct proxy *px, struct stream *strm, unsigned int opt,
* returns full lines instead (useful for User-Agent or Date for example).
*/
static int
smp_fetch_fhdr_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_fhdr_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct hdr_idx *idx;
@ -10322,7 +10330,7 @@ smp_fetch_fhdr_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
}
static int
smp_fetch_hdr_names(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_hdr_names(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct hdr_idx *idx;
@ -10363,7 +10371,7 @@ smp_fetch_hdr_names(struct proxy *px, struct stream *strm, unsigned int opt,
* headers are considered from the first one.
*/
static int
smp_fetch_hdr(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_hdr(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct hdr_idx *idx;
@ -10420,7 +10428,7 @@ smp_fetch_hdr(struct proxy *px, struct stream *strm, unsigned int opt,
* Accepts exactly 1 argument of type string.
*/
static int
smp_fetch_hdr_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_hdr_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct hdr_idx *idx;
@ -10457,10 +10465,10 @@ smp_fetch_hdr_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
* may or may not be appropriate for everything.
*/
static int
smp_fetch_hdr_val(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_hdr_val(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int ret = smp_fetch_hdr(px, strm, opt, args, smp, kw, private);
int ret = smp_fetch_hdr(px, sess, strm, opt, args, smp, kw, private);
if (ret > 0) {
smp->type = SMP_T_UINT;
@ -10475,12 +10483,12 @@ smp_fetch_hdr_val(struct proxy *px, struct stream *strm, unsigned int opt,
* It returns an IPv4 or IPv6 address.
*/
static int
smp_fetch_hdr_ip(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_hdr_ip(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int ret;
while ((ret = smp_fetch_hdr(px, strm, opt, args, smp, kw, private)) > 0) {
while ((ret = smp_fetch_hdr(px, sess, strm, opt, args, smp, kw, private)) > 0) {
if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4)) {
smp->type = SMP_T_IPV4;
break;
@ -10507,7 +10515,7 @@ smp_fetch_hdr_ip(struct proxy *px, struct stream *strm, unsigned int opt,
* the first '/' after the possible hostname, and ends before the possible '?'.
*/
static int
smp_fetch_path(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_path(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10541,7 +10549,7 @@ smp_fetch_path(struct proxy *px, struct stream *strm, unsigned int opt,
* The returned sample is of type string.
*/
static int
smp_fetch_base(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_base(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10554,7 +10562,7 @@ smp_fetch_base(struct proxy *px, struct stream *strm, unsigned int opt,
txn = strm->txn;
ctx.idx = 0;
if (!http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx) || !ctx.vlen)
return smp_fetch_path(px, strm, opt, args, smp, kw, private);
return smp_fetch_path(px, sess, strm, opt, args, smp, kw, private);
/* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
temp = get_trash_chunk();
@ -10589,7 +10597,7 @@ smp_fetch_base(struct proxy *px, struct stream *strm, unsigned int opt,
* high-traffic sites without having to store whole paths.
*/
int
smp_fetch_base32(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_base32(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10638,17 +10646,16 @@ smp_fetch_base32(struct proxy *px, struct stream *strm, unsigned int opt,
* 8 bytes would still work.
*/
static int
smp_fetch_base32_src(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_base32_src(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct chunk *temp;
struct session *sess = strm_sess(strm);
struct connection *cli_conn = objt_conn(sess->origin);
if (!cli_conn)
return 0;
if (!smp_fetch_base32(px, strm, opt, args, smp, kw, private))
if (!smp_fetch_base32(px, sess, strm, opt, args, smp, kw, private))
return 0;
temp = get_trash_chunk();
@ -10678,7 +10685,7 @@ smp_fetch_base32_src(struct proxy *px, struct stream *strm, unsigned int opt,
* of type string carrying the whole query string.
*/
static int
smp_fetch_query(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_query(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -10704,7 +10711,7 @@ smp_fetch_query(struct proxy *px, struct stream *strm, unsigned int opt,
}
static int
smp_fetch_proto_http(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_proto_http(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
/* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged
@ -10720,7 +10727,7 @@ smp_fetch_proto_http(struct proxy *px, struct stream *strm, unsigned int opt,
/* return a valid test if the current request is the first one on the connection */
static int
smp_fetch_http_first_req(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_http_first_req(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
@ -10730,7 +10737,7 @@ smp_fetch_http_first_req(struct proxy *px, struct stream *strm, unsigned int opt
/* Accepts exactly 1 argument of type userlist */
static int
smp_fetch_http_auth(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_http_auth(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
@ -10749,7 +10756,7 @@ smp_fetch_http_auth(struct proxy *px, struct stream *strm, unsigned int opt,
/* Accepts exactly 1 argument of type userlist */
static int
smp_fetch_http_auth_grp(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_http_auth_grp(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
if (!args || args->type != ARGT_USR)
@ -10877,7 +10884,7 @@ extract_cookie_value(char *hdr, const char *hdr_end,
* the "capture" option in the configuration file
*/
static int
smp_fetch_capture_header_req(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_capture_header_req(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct proxy *fe = strm_sess(strm)->fe;
@ -10903,7 +10910,7 @@ smp_fetch_capture_header_req(struct proxy *px, struct stream *strm, unsigned int
* the "capture" option in the configuration file
*/
static int
smp_fetch_capture_header_res(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_capture_header_res(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct proxy *fe = strm_sess(strm)->fe;
@ -10927,7 +10934,7 @@ smp_fetch_capture_header_res(struct proxy *px, struct stream *strm, unsigned int
/* Extracts the METHOD in the HTTP request, the txn->uri should be filled before the call */
static int
smp_fetch_capture_req_method(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_capture_req_method(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct chunk *temp;
@ -10955,7 +10962,7 @@ smp_fetch_capture_req_method(struct proxy *px, struct stream *strm, unsigned int
/* Extracts the path in the HTTP request, the txn->uri should be filled before the call */
static int
smp_fetch_capture_req_uri(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_capture_req_uri(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct chunk *temp;
@ -10994,7 +11001,7 @@ smp_fetch_capture_req_uri(struct proxy *px, struct stream *strm, unsigned int op
* as a string (either "HTTP/1.0" or "HTTP/1.1").
*/
static int
smp_fetch_capture_req_ver(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_capture_req_ver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
@ -11018,7 +11025,7 @@ smp_fetch_capture_req_ver(struct proxy *px, struct stream *strm, unsigned int op
* as a string (either "HTTP/1.0" or "HTTP/1.1").
*/
static int
smp_fetch_capture_res_ver(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_capture_res_ver(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn = strm->txn;
@ -11049,7 +11056,7 @@ smp_fetch_capture_res_ver(struct proxy *px, struct stream *strm, unsigned int op
* The returned sample is of type CSTR. Can be used to parse cookies in other
* files.
*/
int smp_fetch_cookie(struct proxy *px, struct stream *strm, unsigned int opt,
int smp_fetch_cookie(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -11151,7 +11158,7 @@ int smp_fetch_cookie(struct proxy *px, struct stream *strm, unsigned int opt,
* type UINT. Accepts exactly 1 argument of type string.
*/
static int
smp_fetch_cookie_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_cookie_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -11221,10 +11228,10 @@ smp_fetch_cookie_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
* takes a mandatory argument of type string. It relies on smp_fetch_cookie().
*/
static int
smp_fetch_cookie_val(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_cookie_val(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int ret = smp_fetch_cookie(px, strm, opt, args, smp, kw, private);
int ret = smp_fetch_cookie(px, sess, strm, opt, args, smp, kw, private);
if (ret > 0) {
smp->type = SMP_T_UINT;
@ -11326,7 +11333,7 @@ find_url_param_value(char* path, size_t path_l,
}
static int
smp_fetch_url_param(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_url_param(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
char delim = '?';
@ -11358,10 +11365,10 @@ smp_fetch_url_param(struct proxy *px, struct stream *strm, unsigned int opt,
* above).
*/
static int
smp_fetch_url_param_val(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_url_param_val(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int ret = smp_fetch_url_param(px, strm, opt, args, smp, kw, private);
int ret = smp_fetch_url_param(px, sess, strm, opt, args, smp, kw, private);
if (ret > 0) {
smp->type = SMP_T_UINT;
@ -11382,7 +11389,7 @@ smp_fetch_url_param_val(struct proxy *px, struct stream *strm, unsigned int opt,
* as well as the path
*/
static int
smp_fetch_url32(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_url32(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
@ -11431,14 +11438,13 @@ smp_fetch_url32(struct proxy *px, struct stream *strm, unsigned int opt,
* 8 bytes would still work.
*/
static int
smp_fetch_url32_src(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_url32_src(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct chunk *temp;
struct session *sess = strm_sess(strm);
struct connection *cli_conn = objt_conn(sess->origin);
if (!smp_fetch_url32(px, strm, opt, args, smp, kw, private))
if (!smp_fetch_url32(px, sess, strm, opt, args, smp, kw, private))
return 0;
temp = get_trash_chunk();

View File

@ -1134,7 +1134,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
enum acl_test_res ret = ACL_TEST_PASS;
if (rule->cond) {
ret = acl_exec_cond(rule->cond, s->be, s, SMP_OPT_DIR_REQ | partial);
ret = acl_exec_cond(rule->cond, s->be, sess, s, SMP_OPT_DIR_REQ | partial);
if (ret == ACL_TEST_MISS)
goto missing_data;
@ -1175,7 +1175,7 @@ resume_execution:
continue;
t = rule->act_prm.trk_ctr.table.t;
key = stktable_fetch_key(t, s->be, s, SMP_OPT_DIR_REQ | partial, rule->act_prm.trk_ctr.expr, &smp);
key = stktable_fetch_key(t, s->be, sess, s, SMP_OPT_DIR_REQ | partial, rule->act_prm.trk_ctr.expr, &smp);
if ((smp.flags & SMP_F_MAY_CHANGE) && !(partial & SMP_OPT_FINAL))
goto missing_data; /* key might appear later */
@ -1193,7 +1193,7 @@ resume_execution:
char **cap = s->req_cap;
int len;
key = sample_fetch_string(s->be, s, SMP_OPT_DIR_REQ | partial, rule->act_prm.cap.expr);
key = sample_fetch_string(s->be, sess, s, SMP_OPT_DIR_REQ | partial, rule->act_prm.cap.expr);
if (!key)
continue;
@ -1292,7 +1292,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
enum acl_test_res ret = ACL_TEST_PASS;
if (rule->cond) {
ret = acl_exec_cond(rule->cond, s->be, s, SMP_OPT_DIR_RES | partial);
ret = acl_exec_cond(rule->cond, s->be, sess, s, SMP_OPT_DIR_RES | partial);
if (ret == ACL_TEST_MISS) {
/* just set the analyser timeout once at the beginning of the response */
if (!tick_isset(rep->analyse_exp) && s->be->tcp_rep.inspect_delay)
@ -1377,7 +1377,7 @@ int tcp_exec_req_rules(struct stream *s)
ret = ACL_TEST_PASS;
if (rule->cond) {
ret = acl_exec_cond(rule->cond, sess->fe, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, sess->fe, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -1407,7 +1407,7 @@ int tcp_exec_req_rules(struct stream *s)
continue;
t = rule->act_prm.trk_ctr.table.t;
key = stktable_fetch_key(t, s->be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL);
key = stktable_fetch_key(t, s->be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL);
if (key && (ts = stktable_get_entry(t, key)))
stream_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts);
@ -1965,10 +1965,9 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
/* fetch the connection's source IPv4/IPv6 address */
static int
smp_fetch_src(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_src(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *cli_conn = objt_conn(sess->origin);
if (!cli_conn)
@ -1993,10 +1992,9 @@ smp_fetch_src(struct proxy *px, struct stream *strm, unsigned int opt,
/* set temp integer to the connection's source port */
static int
smp_fetch_sport(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sport(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *k, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *cli_conn = objt_conn(sess->origin);
if (!cli_conn)
@ -2012,10 +2010,9 @@ smp_fetch_sport(struct proxy *px, struct stream *strm, unsigned int opt,
/* fetch the connection's destination IPv4/IPv6 address */
static int
smp_fetch_dst(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_dst(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *cli_conn = objt_conn(sess->origin);
if (!cli_conn)
@ -2042,10 +2039,9 @@ smp_fetch_dst(struct proxy *px, struct stream *strm, unsigned int opt,
/* set temp integer to the frontend connexion's destination port */
static int
smp_fetch_dport(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_dport(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *cli_conn = objt_conn(sess->origin);
if (!cli_conn)

View File

@ -1022,7 +1022,8 @@ out_error:
* smp 1 0 Present, may change (eg: request length)
* smp 1 1 Present, last known value (eg: request length)
*/
struct sample *sample_process(struct proxy *px, struct stream *strm, unsigned int opt,
struct sample *sample_process(struct proxy *px, struct session *sess,
struct stream *strm, unsigned int opt,
struct sample_expr *expr, struct sample *p)
{
struct sample_conv_expr *conv_expr;
@ -1032,7 +1033,7 @@ struct sample *sample_process(struct proxy *px, struct stream *strm, unsigned in
memset(p, 0, sizeof(*p));
}
if (!expr->fetch->process(px, strm, opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
if (!expr->fetch->process(px, sess, strm, opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private))
return NULL;
list_for_each_entry(conv_expr, &expr->conv_exprs, list) {
@ -1330,14 +1331,15 @@ int smp_resolve_args(struct proxy *p)
* smp 1 0 Not present yet, may appear later (eg: header)
* smp 1 1 never happens (either flag is cleared on output)
*/
struct sample *sample_fetch_string(struct proxy *px, struct stream *strm,
unsigned int opt, struct sample_expr *expr)
struct sample *sample_fetch_string(struct proxy *px, struct session *sess,
struct stream *strm, unsigned int opt,
struct sample_expr *expr)
{
struct sample *smp = &temp_smp;
memset(smp, 0, sizeof(*smp));
if (!sample_process(px, strm, opt, expr, smp)) {
if (!sample_process(px, sess, strm, opt, expr, smp)) {
if ((smp->flags & SMP_F_MAY_CHANGE) && !(opt & SMP_OPT_FINAL))
return smp;
return NULL;
@ -2146,7 +2148,7 @@ static int sample_conv_arith_even(struct stream *stream, const struct arg *arg_p
/* force TRUE to be returned at the fetch level */
static int
smp_fetch_true(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_true(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
@ -2156,7 +2158,7 @@ smp_fetch_true(struct proxy *px, struct stream *strm, unsigned int opt,
/* force FALSE to be returned at the fetch level */
static int
smp_fetch_false(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_false(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_BOOL;
@ -2166,7 +2168,7 @@ smp_fetch_false(struct proxy *px, struct stream *strm, unsigned int opt,
/* retrieve environment variable $1 as a string */
static int
smp_fetch_env(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_env(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
char *env;
@ -2189,7 +2191,7 @@ smp_fetch_env(struct proxy *px, struct stream *strm, unsigned int opt,
* of args[0] seconds.
*/
static int
smp_fetch_date(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_date(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->data.uint = date.tv_sec;
@ -2205,7 +2207,7 @@ smp_fetch_date(struct proxy *px, struct stream *strm, unsigned int opt,
/* returns the number of processes */
static int
smp_fetch_nbproc(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_nbproc(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_UINT;
@ -2215,7 +2217,7 @@ smp_fetch_nbproc(struct proxy *px, struct stream *strm, unsigned int opt,
/* returns the number of the current process (between 1 and nbproc */
static int
smp_fetch_proc(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_proc(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_UINT;
@ -2227,7 +2229,7 @@ smp_fetch_proc(struct proxy *px, struct stream *strm, unsigned int opt,
* range specified in argument.
*/
static int
smp_fetch_rand(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_rand(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->data.uint = random();
@ -2243,7 +2245,7 @@ smp_fetch_rand(struct proxy *px, struct stream *strm, unsigned int opt,
/* returns true if the current process is stopping */
static int
smp_fetch_stopping(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_stopping(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->type = SMP_T_BOOL;

View File

@ -3084,11 +3084,10 @@ unsigned int ssl_sock_get_verify_result(struct connection *conn)
/* boolean, returns true if client cert was present */
static int
smp_fetch_ssl_fc_has_crt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_has_crt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct connection *conn;
struct session *sess = strm_sess(strm);
conn = objt_conn(sess->origin);
if (!conn || conn->xprt != &ssl_sock)
@ -3111,14 +3110,13 @@ smp_fetch_ssl_fc_has_crt(struct proxy *px, struct stream *strm, unsigned int opt
* should be use.
*/
static int
smp_fetch_ssl_x_der(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_der(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
struct chunk *smp_trash;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3157,14 +3155,13 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_serial(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_serial(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
struct chunk *smp_trash;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3203,7 +3200,7 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_sha1(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_sha1(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
@ -3211,7 +3208,6 @@ smp_fetch_ssl_x_sha1(struct proxy *px, struct stream *strm, unsigned int opt,
const EVP_MD *digest;
int ret = 0;
struct chunk *smp_trash;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3249,14 +3245,13 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_notafter(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_notafter(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
struct chunk *smp_trash;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3294,7 +3289,7 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_i_dn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_i_dn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
@ -3302,7 +3297,6 @@ smp_fetch_ssl_x_i_dn(struct proxy *px, struct stream *strm, unsigned int opt,
X509_NAME *name;
int ret = 0;
struct chunk *smp_trash;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3355,14 +3349,13 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_notbefore(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_notbefore(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
struct chunk *smp_trash;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3400,7 +3393,7 @@ out:
* should be use.
*/
static int
smp_fetch_ssl_x_s_dn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_s_dn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
@ -3408,7 +3401,6 @@ smp_fetch_ssl_x_s_dn(struct proxy *px, struct stream *strm, unsigned int opt,
X509_NAME *name;
int ret = 0;
struct chunk *smp_trash;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3458,11 +3450,10 @@ out:
/* integer, returns true if current session use a client certificate */
static int
smp_fetch_ssl_c_used(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_c_used(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
X509 *crt;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3490,12 +3481,11 @@ smp_fetch_ssl_c_used(struct proxy *px, struct stream *strm, unsigned int opt,
* should be use.
*/
static int
smp_fetch_ssl_x_version(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_version(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3528,13 +3518,12 @@ smp_fetch_ssl_x_version(struct proxy *px, struct stream *strm, unsigned int opt,
* should be use.
*/
static int
smp_fetch_ssl_x_sig_alg(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_sig_alg(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt;
int nid;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3578,13 +3567,12 @@ smp_fetch_ssl_x_sig_alg(struct proxy *px, struct stream *strm, unsigned int opt,
* should be use.
*/
static int
smp_fetch_ssl_x_key_alg(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_x_key_alg(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt;
int nid;
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3627,7 +3615,7 @@ smp_fetch_ssl_x_key_alg(struct proxy *px, struct stream *strm, unsigned int opt,
* char is 'b'.
*/
static int
smp_fetch_ssl_fc(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
@ -3640,11 +3628,10 @@ smp_fetch_ssl_fc(struct proxy *px, struct stream *strm, unsigned int opt,
/* boolean, returns true if client present a SNI */
static int
smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_has_sni(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
struct session *sess = strm_sess(l4);
struct connection *conn = objt_conn(sess->origin);
smp->type = SMP_T_BOOL;
@ -3662,7 +3649,7 @@ smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *strm, unsigned int opt
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_cipher(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_cipher(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
@ -3691,7 +3678,7 @@ smp_fetch_ssl_fc_cipher(struct proxy *px, struct stream *strm, unsigned int opt,
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
@ -3716,7 +3703,7 @@ smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct stream *strm, unsigned int
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
@ -3739,11 +3726,10 @@ smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct stream *strm, unsigned int
#ifdef OPENSSL_NPN_NEGOTIATED
static int
smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_npn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct connection *conn;
struct session *sess = strm_sess(l4);
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
@ -3765,11 +3751,10 @@ smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *strm, unsigned int opt,
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
static int
smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_alpn(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct connection *conn;
struct session *sess = strm_sess(l4);
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
@ -3794,7 +3779,7 @@ smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *strm, unsigned int opt,
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_protocol(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_protocol(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
int back_conn = (kw[4] == 'b') ? 1 : 0;
@ -3822,12 +3807,12 @@ smp_fetch_ssl_fc_protocol(struct proxy *px, struct stream *strm, unsigned int op
* char is 'b'.
*/
static int
smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_session_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
int back_conn = (kw[4] == 'b') ? 1 : 0;
SSL_SESSION *sess;
SSL_SESSION *ssl_sess;
struct connection *conn;
smp->flags = SMP_F_CONST;
@ -3837,11 +3822,11 @@ smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *strm, unsigned int
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
sess = SSL_get_session(conn->xprt_ctx);
if (!sess)
ssl_sess = SSL_get_session(conn->xprt_ctx);
if (!ssl_sess)
return 0;
smp->data.str.str = (char *)SSL_SESSION_get_id(sess, (unsigned int *)&smp->data.str.len);
smp->data.str.str = (char *)SSL_SESSION_get_id(ssl_sess, (unsigned int *)&smp->data.str.len);
if (!smp->data.str.str || !&smp->data.str.len)
return 0;
@ -3852,12 +3837,11 @@ smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *strm, unsigned int
}
static int
smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_sni(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
struct connection *conn;
struct session *sess = strm_sess(l4);
smp->flags = SMP_F_CONST;
smp->type = SMP_T_STR;
@ -3878,7 +3862,7 @@ smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *strm, unsigned int opt,
}
static int
smp_fetch_ssl_fc_unique_id(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_fc_unique_id(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
#if OPENSSL_VERSION_NUMBER > 0x0090800fL
@ -3919,10 +3903,9 @@ smp_fetch_ssl_fc_unique_id(struct proxy *px, struct stream *strm, unsigned int o
/* integer, returns the first verify error in CA chain of client certificate chain. */
static int
smp_fetch_ssl_c_ca_err(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_c_ca_err(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3943,10 +3926,9 @@ smp_fetch_ssl_c_ca_err(struct proxy *px, struct stream *strm, unsigned int opt,
/* integer, returns the depth of the first verify error in CA chain of client certificate chain. */
static int
smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3967,10 +3949,9 @@ smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct stream *strm, unsigned int
/* integer, returns the first verify error on client certificate */
static int
smp_fetch_ssl_c_err(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_c_err(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);
@ -3991,10 +3972,9 @@ smp_fetch_ssl_c_err(struct proxy *px, struct stream *strm, unsigned int opt,
/* integer, returns the verify result on client cert */
static int
smp_fetch_ssl_c_verify(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_ssl_c_verify(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *conn;
conn = objt_conn(sess->origin);

View File

@ -680,13 +680,13 @@ struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t)
* smp 1 0 not possible
* smp 1 1 Present, last known value (eg: request length)
*/
struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct stream *strm,
struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct session *sess, struct stream *strm,
unsigned int opt, struct sample_expr *expr, struct sample *smp)
{
if (smp)
memset(smp, 0, sizeof(*smp));
smp = sample_process(px, strm, opt, expr, smp);
smp = sample_process(px, sess, strm, opt, expr, smp);
if (!smp)
return NULL;

View File

@ -1369,7 +1369,8 @@ static void sess_prepare_conn_req(struct stream *s)
static int process_switching_rules(struct stream *s, struct channel *req, int an_bit)
{
struct persist_rule *prst_rule;
struct proxy *fe = strm_sess(s)->fe;
struct session *sess = s->sess;
struct proxy *fe = sess->fe;
req->analysers &= ~an_bit;
req->analyse_exp = TICK_ETERNITY;
@ -1391,7 +1392,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
int ret = 1;
if (rule->cond) {
ret = acl_exec_cond(rule->cond, fe, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, fe, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -1444,7 +1445,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
int ret = 1;
if (prst_rule->cond) {
ret = acl_exec_cond(prst_rule->cond, s->be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(prst_rule->cond, s->be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (prst_rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -1487,6 +1488,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
static int process_server_rules(struct stream *s, struct channel *req, int an_bit)
{
struct proxy *px = s->be;
struct session *sess = s->sess;
struct server_rule *rule;
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n",
@ -1502,7 +1504,7 @@ static int process_server_rules(struct stream *s, struct channel *req, int an_bi
list_for_each_entry(rule, &px->server_rules, list) {
int ret;
ret = acl_exec_cond(rule->cond, s->be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, s->be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -1536,6 +1538,7 @@ static int process_server_rules(struct stream *s, struct channel *req, int an_bi
static int process_sticking_rules(struct stream *s, struct channel *req, int an_bit)
{
struct proxy *px = s->be;
struct session *sess = s->sess;
struct sticking_rule *rule;
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
@ -1567,7 +1570,7 @@ static int process_sticking_rules(struct stream *s, struct channel *req, int an_
continue;
if (rule->cond) {
ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -1576,7 +1579,7 @@ static int process_sticking_rules(struct stream *s, struct channel *req, int an_
if (ret) {
struct stktable_key *key;
key = stktable_fetch_key(rule->table.t, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->expr, NULL);
key = stktable_fetch_key(rule->table.t, px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->expr, NULL);
if (!key)
continue;
@ -1632,6 +1635,7 @@ static int process_sticking_rules(struct stream *s, struct channel *req, int an_
static int process_store_rules(struct stream *s, struct channel *rep, int an_bit)
{
struct proxy *px = s->be;
struct session *sess = s->sess;
struct sticking_rule *rule;
int i;
int nbreq = s->store_count;
@ -1670,7 +1674,7 @@ static int process_store_rules(struct stream *s, struct channel *rep, int an_bit
continue;
if (rule->cond) {
ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
ret = acl_exec_cond(rule->cond, px, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
@ -1679,7 +1683,7 @@ static int process_store_rules(struct stream *s, struct channel *rep, int an_bit
if (ret) {
struct stktable_key *key;
key = stktable_fetch_key(rule->table.t, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, rule->expr, NULL);
key = stktable_fetch_key(rule->table.t, px, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, rule->expr, NULL);
if (!key)
continue;
@ -2899,9 +2903,8 @@ void stream_shutdown(struct stream *stream, int why)
* multiple tables).
*/
struct stkctr *
smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw)
smp_fetch_sc_stkctr(struct session *sess, struct stream *strm, const struct arg *args, const char *kw)
{
struct session *sess = strm_sess(l4);
static struct stkctr stkctr;
struct stksess *stksess;
unsigned int num = kw[2] - '0';
@ -2933,7 +2936,7 @@ smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw)
* the sc[0-9]_ form, or even higher using sc_(num) if needed.
* args[arg] is the first optional argument.
*/
stksess = stkctr_entry(&l4->stkctr[num]);
stksess = stkctr_entry(&strm->stkctr[num]);
if (!stksess)
return NULL;
@ -2943,7 +2946,7 @@ smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw)
stkctr_set_entry(&stkctr, stktable_lookup(stkctr.table, stksess));
return &stkctr;
}
return &l4->stkctr[num];
return &strm->stkctr[num];
}
/* set return a boolean indicating if the requested stream counter is
@ -2951,12 +2954,12 @@ smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw)
* Supports being called as "sc[0-9]_tracked" only.
*/
static int
smp_fetch_sc_tracked(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_tracked(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
smp->type = SMP_T_BOOL;
smp->data.uint = !!smp_fetch_sc_stkctr(strm, args, kw);
smp->data.uint = !!smp_fetch_sc_stkctr(sess, strm, args, kw);
return 1;
}
@ -2966,10 +2969,10 @@ smp_fetch_sc_tracked(struct proxy *px, struct stream *strm, unsigned int opt,
* zero is returned if the key is new.
*/
static int
smp_fetch_sc_get_gpc0(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_get_gpc0(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -2993,10 +2996,10 @@ smp_fetch_sc_get_gpc0(struct proxy *px, struct stream *strm, unsigned int opt,
* Value zero is returned if the key is new.
*/
static int
smp_fetch_sc_gpc0_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_gpc0_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3019,10 +3022,10 @@ smp_fetch_sc_gpc0_rate(struct proxy *px, struct stream *strm, unsigned int opt,
* Supports being called as "sc[0-9]_inc_gpc0" or "src_inc_gpc0" only.
*/
static int
smp_fetch_sc_inc_gpc0(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_inc_gpc0(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3056,10 +3059,10 @@ smp_fetch_sc_inc_gpc0(struct proxy *px, struct stream *strm, unsigned int opt,
* Supports being called as "sc[0-9]_clr_gpc0" or "src_clr_gpc0" only.
*/
static int
smp_fetch_sc_clr_gpc0(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_clr_gpc0(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3082,10 +3085,10 @@ smp_fetch_sc_clr_gpc0(struct proxy *px, struct stream *strm, unsigned int opt,
* "src_conn_cnt" only.
*/
static int
smp_fetch_sc_conn_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_conn_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3107,10 +3110,10 @@ smp_fetch_sc_conn_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
* only.
*/
static int
smp_fetch_sc_conn_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_conn_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3133,10 +3136,9 @@ smp_fetch_sc_conn_rate(struct proxy *px, struct stream *strm, unsigned int opt,
* Accepts exactly 1 argument of type table.
*/
static int
smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_src_updt_conn_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct session *sess = strm_sess(strm);
struct connection *conn = objt_conn(sess->origin);
struct stksess *ts;
struct stktable_key *key;
@ -3170,10 +3172,10 @@ smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *strm, unsigned int
* "src_conn_cur" only.
*/
static int
smp_fetch_sc_conn_cur(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_conn_cur(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3195,10 +3197,10 @@ smp_fetch_sc_conn_cur(struct proxy *px, struct stream *strm, unsigned int opt,
* "src_sess_cnt" only.
*/
static int
smp_fetch_sc_sess_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_sess_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3219,10 +3221,10 @@ smp_fetch_sc_sess_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
* Supports being called as "sc[0-9]_sess_rate" or "src_sess_rate" only.
*/
static int
smp_fetch_sc_sess_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_sess_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3245,10 +3247,10 @@ smp_fetch_sc_sess_rate(struct proxy *px, struct stream *strm, unsigned int opt,
* "src_http_req_cnt" only.
*/
static int
smp_fetch_sc_http_req_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_http_req_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3270,10 +3272,10 @@ smp_fetch_sc_http_req_cnt(struct proxy *px, struct stream *strm, unsigned int op
* "src_http_req_rate" only.
*/
static int
smp_fetch_sc_http_req_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_http_req_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3296,10 +3298,10 @@ smp_fetch_sc_http_req_rate(struct proxy *px, struct stream *strm, unsigned int o
* "src_http_err_cnt" only.
*/
static int
smp_fetch_sc_http_err_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_http_err_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3321,10 +3323,10 @@ smp_fetch_sc_http_err_cnt(struct proxy *px, struct stream *strm, unsigned int op
* "src_http_err_rate" only.
*/
static int
smp_fetch_sc_http_err_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_http_err_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3347,10 +3349,10 @@ smp_fetch_sc_http_err_rate(struct proxy *px, struct stream *strm, unsigned int o
* "sc[0-9]_kbytes_in" or "src_kbytes_in" only.
*/
static int
smp_fetch_sc_kbytes_in(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_kbytes_in(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3372,10 +3374,10 @@ smp_fetch_sc_kbytes_in(struct proxy *px, struct stream *strm, unsigned int opt,
* "sc[0-9]_bytes_in_rate" or "src_bytes_in_rate" only.
*/
static int
smp_fetch_sc_bytes_in_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_bytes_in_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3398,10 +3400,10 @@ smp_fetch_sc_bytes_in_rate(struct proxy *px, struct stream *strm, unsigned int o
* "sc[0-9]_kbytes_out" or "src_kbytes_out" only.
*/
static int
smp_fetch_sc_kbytes_out(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_kbytes_out(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3423,10 +3425,10 @@ smp_fetch_sc_kbytes_out(struct proxy *px, struct stream *strm, unsigned int opt,
* "sc[0-9]_bytes_out_rate" or "src_bytes_out_rate" only.
*/
static int
smp_fetch_sc_bytes_out_rate(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_bytes_out_rate(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3448,10 +3450,10 @@ smp_fetch_sc_bytes_out_rate(struct proxy *px, struct stream *strm, unsigned int
* tracked frontend counters. Supports being called as "sc[0-9]_trackers" only.
*/
static int
smp_fetch_sc_trackers(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_sc_trackers(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw);
struct stkctr *stkctr = smp_fetch_sc_stkctr(sess, strm, args, kw);
if (!stkctr)
return 0;
@ -3466,7 +3468,7 @@ smp_fetch_sc_trackers(struct proxy *px, struct stream *strm, unsigned int opt,
* Accepts exactly 1 argument of type table.
*/
static int
smp_fetch_table_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_table_cnt(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
smp->flags = SMP_F_VOL_TEST;
@ -3479,7 +3481,7 @@ smp_fetch_table_cnt(struct proxy *px, struct stream *strm, unsigned int opt,
* Accepts exactly 1 argument of type table.
*/
static int
smp_fetch_table_avl(struct proxy *px, struct stream *strm, unsigned int opt,
smp_fetch_table_avl(struct proxy *px, struct session *sess, struct stream *strm, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
px = args->data.prx;