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
diff --git a/include/proto/acl.h b/include/proto/acl.h
index 7cadfce..6b94296 100644
--- a/include/proto/acl.h
+++ b/include/proto/acl.h
@@ -99,7 +99,7 @@
* 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
diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h
index 361072e..4b64aca 100644
--- a/include/proto/proto_http.h
+++ b/include/proto/proto_http.h
@@ -126,10 +126,10 @@
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);
diff --git a/include/proto/sample.h b/include/proto/sample.h
index 2880d00..02ccc52 100644
--- a/include/proto/sample.h
+++ b/include/proto/sample.h
@@ -30,11 +30,12 @@
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);
diff --git a/include/proto/stick_table.h b/include/proto/stick_table.h
index 9beaa54..11b98df 100644
--- a/include/proto/stick_table.h
+++ b/include/proto/stick_table.h
@@ -47,7 +47,7 @@
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);
diff --git a/include/proto/stream.h b/include/proto/stream.h
index 4d23470..1cd506a 100644
--- a/include/proto/stream.h
+++ b/include/proto/stream.h
@@ -48,7 +48,7 @@
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,
diff --git a/include/types/sample.h b/include/types/sample.h
index ce03d9e..daab2a1 100644
--- a/include/types/sample.h
+++ b/include/types/sample.h
@@ -207,6 +207,7 @@
};
/* 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_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,
diff --git a/src/acl.c b/src/acl.c
index fe2e0ec..d51bd99 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1097,7 +1097,7 @@
* 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 @@
/* 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;
diff --git a/src/backend.c b/src/backend.c
index 4f0a654..0d18dd7 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1483,7 +1483,7 @@
* 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 @@
* 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 @@
* 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 @@
/* 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 @@
/* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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;
diff --git a/src/compression.c b/src/compression.c
index f3355fe..814c24f 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -838,7 +838,7 @@
/* 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 @@
/* 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)
diff --git a/src/frontend.c b/src/frontend.c
index c75fadd..4ef39d0 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -220,12 +220,12 @@
/* 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 @@
* 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 @@
* 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;
diff --git a/src/hlua.c b/src/hlua.c
index eebbc36..fc638ad 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -2768,7 +2768,7 @@
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 @@
* 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;
diff --git a/src/listener.c b/src/listener.c
index 5d459b6..86f5d5a 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -590,21 +590,21 @@
/* 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;
}
diff --git a/src/log.c b/src/log.c
index 65e50d4..866b110 100644
--- a/src/log.c
+++ b/src/log.c
@@ -971,9 +971,9 @@
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);
diff --git a/src/payload.c b/src/payload.c
index 638857c..7e254bc 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -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 @@
/* 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 @@
/* 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 @@
* 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 @@
* - 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 @@
* 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 @@
/* 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 @@
/* 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 @@
/* 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;
diff --git a/src/proto_http.c b/src/proto_http.c
index 7825d5c..1cb3063 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2876,7 +2876,7 @@
/* 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 @@
{
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 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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
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_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 @@
* 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_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 @@
* 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 @@
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 @@
* 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 @@
* 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 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 @@
}
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 @@
/* 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 @@
/* 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 @@
}
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 @@
}
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 @@
* 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 @@
* 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 @@
}
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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
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 @@
* 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 @@
* 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 @@
* 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 @@
}
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 @@
/* 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 @@
/* 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 @@
/* 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 @@
* 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 @@
* 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 @@
/* 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 @@
/* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
}
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 @@
* 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 @@
* 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 @@
* 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();
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index b7904e0..b49eddd 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1134,7 +1134,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
/* 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 @@
/* 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 @@
/* 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)
diff --git a/src/sample.c b/src/sample.c
index 9d53b81..77192be 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -1022,7 +1022,8 @@
* 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 @@
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 @@
* 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 @@
/* 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 @@
/* 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 @@
/* 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 @@
* 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 @@
/* 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 @@
/* 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 @@
* 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 @@
/* 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;
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index f39d973..42a71c9 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -3084,11 +3084,10 @@
/* 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 @@
* 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 @@
* 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 @@
* 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 @@
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 @@
* 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 @@
* 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 @@
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 @@
* 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 @@
* 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 @@
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 @@
/* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
/* 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 @@
* 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 @@
* 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 @@
* 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 @@
#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 @@
#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 @@
* 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 @@
* 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 @@
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 @@
}
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 @@
}
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 @@
/* 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 @@
/* 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 @@
/* 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 @@
/* 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);
diff --git a/src/stick_table.c b/src/stick_table.c
index 79ab4fa..4459f46 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -680,13 +680,13 @@
* 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;
diff --git a/src/stream.c b/src/stream.c
index 5833b07..91c2a0d 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1369,7 +1369,8 @@
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 @@
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 @@
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_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 @@
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_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 @@
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 @@
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_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 @@
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 @@
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 @@
* 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 @@
* 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 @@
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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* "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 @@
* 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 @@
* 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 @@
* "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 @@
* "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 @@
* 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 @@
* "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 @@
* "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 @@
* "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 @@
* "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 @@
* "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 @@
* "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 @@
* "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 @@
* "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 @@
* 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 @@
* 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 @@
* 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;