diff --git a/include/proto/acl.h b/include/proto/acl.h index ee5b14be1..7cadfcebc 100644 --- a/include/proto/acl.h +++ b/include/proto/acl.h @@ -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 *l4, void *l7, unsigned int opt); +enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct stream *strm, unsigned int opt); /* Returns a pointer to the first ACL conflicting with usage at place * 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 a8056af88..97b309662 100644 --- a/include/proto/proto_http.h +++ b/include/proto/proto_http.h @@ -127,10 +127,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 *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private); +int smp_fetch_cookie(struct proxy *px, 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 *l4, void *l7, unsigned int opt, +smp_fetch_base32(struct proxy *px, 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 e9f9e2512..2880d00e2 100644 --- a/include/proto/sample.h +++ b/include/proto/sample.h @@ -30,10 +30,10 @@ 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 *l4, - void *l7, unsigned int dir, struct sample_expr *expr, - struct sample *p); -struct sample *sample_fetch_string(struct proxy *px, struct stream *l4, void *l7, +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); void sample_register_fetches(struct sample_fetch_kw_list *psl); void sample_register_convs(struct sample_conv_kw_list *psl); diff --git a/include/proto/stick_table.h b/include/proto/stick_table.h index 93204303a..9beaa54dc 100644 --- a/include/proto/stick_table.h +++ b/include/proto/stick_table.h @@ -48,8 +48,8 @@ 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 stream *l4, void *l7, unsigned int opt, - struct sample_expr *expr, struct sample *smp); + 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); int stktable_register_data_store(int idx, const char *name, int std_type, int arg_type); int stktable_get_data_type(char *name); diff --git a/include/types/sample.h b/include/types/sample.h index e054c27f8..ce03d9e60 100644 --- a/include/types/sample.h +++ b/include/types/sample.h @@ -285,8 +285,7 @@ struct sample_conv_expr { struct sample_fetch { const char *kw; /* configuration keyword */ int (*process)(struct proxy *px, - struct stream *l4, - void *l7, + struct stream *strm, unsigned int opt, /* fetch options (SMP_OPT_*) */ const struct arg *arg_p, struct sample *smp, diff --git a/src/acl.c b/src/acl.c index edf133970..fe2e0ec83 100644 --- a/src/acl.c +++ b/src/acl.c @@ -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 *l4, void *l7, unsigned int opt) +enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, 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, l4, l7, opt, expr->smp, &smp)) { + if (!sample_process(px, 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 a8cf644c0..4f0a654b8 100644 --- a/src/backend.c +++ b/src/backend.c @@ -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 *l4, void *l7, unsigned int opt, +smp_fetch_nbsrv(struct proxy *px, 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 *l4, void *l7, unsigned int opt, * undefined behaviour. */ static int -smp_fetch_srv_is_up(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_srv_is_up(struct proxy *px, 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 *l4, void *l7, unsigned int * undefined behaviour. */ static int -smp_fetch_connslots(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_connslots(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct server *iterator; @@ -1554,25 +1554,25 @@ smp_fetch_connslots(struct proxy *px, struct stream *l4, void *l7, unsigned int /* set temp integer to the id of the backend */ static int -smp_fetch_be_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_be_id(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TXN; smp->type = SMP_T_UINT; - smp->data.uint = l4->be->uuid; + smp->data.uint = strm->be->uuid; return 1; } /* set temp integer to the id of the server */ static int -smp_fetch_srv_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_srv_id(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - if (!objt_server(l4->target)) + if (!objt_server(strm->target)) return 0; smp->type = SMP_T_UINT; - smp->data.uint = objt_server(l4->target)->puid; + smp->data.uint = objt_server(strm->target)->puid; return 1; } @@ -1582,7 +1582,7 @@ smp_fetch_srv_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt * undefined behaviour. */ static int -smp_fetch_be_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_be_sess_rate(struct proxy *px, 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 *l4, void *l7, unsigned i * undefined behaviour. */ static int -smp_fetch_be_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_be_conn(struct proxy *px, 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 *l4, void *l7, unsigned int op * undefined behaviour. */ static int -smp_fetch_queue_size(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_queue_size(struct proxy *px, 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 *l4, void *l7, unsigned int * undefined behaviour. */ static int -smp_fetch_avg_queue_size(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_avg_queue_size(struct proxy *px, 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 *l4, void *l7, unsigned * undefined behaviour. */ static int -smp_fetch_srv_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_srv_conn(struct proxy *px, 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 *l4, void *l7, unsigned int o * undefined behaviour. */ static int -smp_fetch_srv_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_srv_sess_rate(struct proxy *px, 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 50d41c119..f3355fe93 100644 --- a/src/compression.c +++ b/src/compression.c @@ -838,26 +838,26 @@ 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 *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_res_comp(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; - smp->data.uint = (l4->comp_algo != NULL); + smp->data.uint = (strm->comp_algo != NULL); return 1; } /* string, returns algo */ static int -smp_fetch_res_comp_algo(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_res_comp_algo(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { - if (!l4->comp_algo) + if (!strm->comp_algo) return 0; smp->type = SMP_T_STR; smp->flags = SMP_F_CONST; - smp->data.str.str = l4->comp_algo->cfg_name; - smp->data.str.len = l4->comp_algo->cfg_name_len; + smp->data.str.str = strm->comp_algo->cfg_name; + smp->data.str.len = strm->comp_algo->cfg_name_len; return 1; } diff --git a/src/frontend.c b/src/frontend.c index 3a28d6fd4..c75faddf4 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -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 *l4, void *l7, unsigned int opt, +smp_fetch_fe_id(struct proxy *px, 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(l4)->fe->uuid; + smp->data.uint = strm_sess(strm)->fe->uuid; return 1; } @@ -234,7 +234,7 @@ smp_fetch_fe_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, * an undefined behaviour. */ static int -smp_fetch_fe_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_fe_sess_rate(struct proxy *px, 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 *l4, void *l7, unsigned i * an undefined behaviour. */ static int -smp_fetch_fe_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_fe_conn(struct proxy *px, 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 43d9c1b36..320a0bf60 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2769,7 +2769,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, hsmp->l7, 0, args, &smp, f->kw, f->private)) { + if (!f->process(hsmp->p, hsmp->s, 0, args, &smp, f->kw, f->private)) { if (hsmp->stringsafe) lua_pushstring(L, ""); else @@ -3323,7 +3323,7 @@ __LJMP static int hlua_get_priv(lua_State *L) * return 0 if the stack does not contains free slots, * otherwise it returns 1. */ -static int hlua_txn_new(lua_State *L, struct stream *s, struct proxy *p, void *l7) +static int hlua_txn_new(lua_State *L, struct stream *s, struct proxy *p) { struct hlua_txn *htxn; @@ -3342,7 +3342,7 @@ static int hlua_txn_new(lua_State *L, struct stream *s, struct proxy *p, void *l htxn->s = s; htxn->p = p; - htxn->l7 = l7; + htxn->l7 = s->txn; /* Create the "f" field that contains a list of fetches. */ lua_pushstring(L, "f"); @@ -3914,7 +3914,7 @@ 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, void *l7, +static int hlua_sample_fetch_wrapper(struct proxy *px, struct stream *s, unsigned int opt, const struct arg *arg_p, struct sample *smp, const char *kw, void *private) { @@ -3946,7 +3946,7 @@ static int hlua_sample_fetch_wrapper(struct proxy *px, struct stream *s, void *l lua_rawgeti(s->hlua.T, LUA_REGISTRYINDEX, fcn->function_ref); /* push arguments in the stack. */ - if (!hlua_txn_new(s->hlua.T, s, px, l7)) { + if (!hlua_txn_new(s->hlua.T, s, px)) { send_log(px, LOG_ERR, "Lua sample-fetch '%s': full stack.", fcn->name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua sample-fetch '%s': full stack.\n", fcn->name); @@ -4226,7 +4226,7 @@ static int hlua_request_act_wrapper(struct hlua_rule *rule, struct proxy *px, lua_rawgeti(s->hlua.T, LUA_REGISTRYINDEX, rule->fcn.function_ref); /* Create and and push object stream in the stack. */ - if (!hlua_txn_new(s->hlua.T, s, px, http_txn)) { + if (!hlua_txn_new(s->hlua.T, s, px)) { send_log(px, LOG_ERR, "Lua function '%s': full stack.", rule->fcn.name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua function '%s': full stack.\n", rule->fcn.name); diff --git a/src/listener.c b/src/listener.c index af8a5240d..5d459b6a8 100644 --- a/src/listener.c +++ b/src/listener.c @@ -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 *l4, void *l7, unsigned int opt, +smp_fetch_dconn(struct proxy *px, 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(l4)->listener->nbconn; + smp->data.uint = strm_sess(strm)->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 *l4, void *l7, unsigned int opt, +smp_fetch_so_id(struct proxy *px, 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(l4)->listener->luid; + smp->data.uint = strm_sess(strm)->listener->luid; return 1; } diff --git a/src/log.c b/src/log.c index 97a20807f..65e50d443 100644 --- a/src/log.c +++ b/src/log.c @@ -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, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, tmp->expr); + key = sample_fetch_string(be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, tmp->expr); if (!key && (tmp->options & LOG_OPT_RES_CAP)) - key = sample_fetch_string(be, s, txn, SMP_OPT_DIR_RES|SMP_OPT_FINAL, tmp->expr); + key = sample_fetch_string(be, 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 9d7774c28..638857c7b 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, void *l7, unsigned int opt, +smp_fetch_wait_end(struct proxy *px, struct stream *s, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { if (!(opt & SMP_OPT_FINAL)) { @@ -43,8 +43,8 @@ smp_fetch_wait_end(struct proxy *px, struct stream *s, void *l7, unsigned int op /* return the number of bytes in the request buffer */ static int -smp_fetch_len(struct proxy *px, struct stream *s, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_len(struct proxy *px, 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, void *l7, 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, void *l7, unsigned int opt, +smp_fetch_ssl_hello_type(struct proxy *px, 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, void *l7, unsigned * Note: this decoder only works with non-wrapping data. */ static int -smp_fetch_req_ssl_ver(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_req_ssl_ver(struct proxy *px, 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, void *l7, unsigned int * - opaque hostname[name_len bytes] */ static int -smp_fetch_ssl_hello_sni(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_ssl_hello_sni(struct proxy *px, 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,20 +493,20 @@ 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 *s, void *l7, unsigned int opt, +smp_fetch_rdp_cookie(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - return fetch_rdp_cookie_name(s, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0); + return fetch_rdp_cookie_name(strm, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0); } /* 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 *s, void *l7, unsigned int opt, +smp_fetch_rdp_cookie_cnt(struct proxy *px, 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, s, l7, opt, args, smp, kw, private); + ret = smp_fetch_rdp_cookie(px, 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 *s, void *l7, unsigned /* extracts part of a payload with offset and length at a given position */ static int -smp_fetch_payload_lv(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_payload_lv(struct proxy *px, 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; @@ -533,7 +533,7 @@ smp_fetch_payload_lv(struct proxy *px, struct stream *s, void *l7, unsigned int /* by default buf offset == len offset + len size */ /* buf offset could be absolute or relative to len offset + len size if prefixed by + or - */ - chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req; + chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &strm->res : &strm->req; if (!chn->buf) return 0; @@ -573,14 +573,14 @@ smp_fetch_payload_lv(struct proxy *px, struct stream *s, void *l7, unsigned int /* extracts some payload at a fixed position and length */ static int -smp_fetch_payload(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_payload(struct proxy *px, 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; unsigned int buf_size = arg_p[1].data.uint; struct channel *chn; - chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &s->res : &s->req; + chn = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &strm->res : &strm->req; if (!chn->buf) return 0; diff --git a/src/proto_http.c b/src/proto_http.c index 9b682702f..61b29a1ed 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + int ret = acl_exec_cond(cond, sess->fe, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (cond->pol == ACL_COND_UNLESS) @@ -3197,7 +3197,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, s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(stats_admin_rule->cond, s->be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (stats_admin_rule->cond->pol == ACL_COND_UNLESS) ret = !ret; @@ -3352,7 +3352,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, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) @@ -3565,7 +3565,7 @@ resume_execution: void *ptr; t = rule->act_prm.trk_ctr.table.t; - key = stktable_fetch_key(t, s->be, s, s->txn, SMP_OPT_DIR_REQ | SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL); + key = stktable_fetch_key(t, s->be, 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); @@ -3627,7 +3627,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, txn, SMP_OPT_DIR_RES|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) @@ -4169,7 +4169,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, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + int ret = acl_exec_cond(wl->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (((struct acl_cond *)wl->cond)->pol == ACL_COND_UNLESS) ret = !ret; @@ -4207,7 +4207,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, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) ret = !ret; @@ -6394,7 +6394,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, txn, SMP_OPT_DIR_RES|SMP_OPT_FINAL); + int ret = acl_exec_cond(wl->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL); ret = acl_pass(ret); if (((struct acl_cond *)wl->cond)->pol == ACL_COND_UNLESS) ret = !ret; @@ -7175,7 +7175,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, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(exp->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (((struct acl_cond *)exp->cond)->pol == ACL_COND_UNLESS) ret = !ret; @@ -8001,7 +8001,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, txn, SMP_OPT_DIR_RES|SMP_OPT_FINAL); + ret = acl_exec_cond(exp->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL); ret = acl_pass(ret); if (((struct acl_cond *)exp->cond)->pol == ACL_COND_UNLESS) ret = !ret; @@ -9903,10 +9903,10 @@ struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, st * 1 if an HTTP message is ready */ static int -smp_prefetch_http(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +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 = l7; + struct http_txn *txn = s->txn; struct http_msg *msg = &txn->req; /* Note: this function may only be used from places where @@ -9996,10 +9996,10 @@ smp_prefetch_http(struct proxy *px, struct stream *s, void *l7, unsigned int opt * least the type and uint value are modified. */ #define CHECK_HTTP_MESSAGE_FIRST() \ - do { int r = smp_prefetch_http(px, l4, l7, opt, args, smp, 1); if (r <= 0) return r; } while (0) + do { int r = smp_prefetch_http(px, strm, opt, args, smp, 1); if (r <= 0) return r; } while (0) #define CHECK_HTTP_MESSAGE_FIRST_PERM() \ - do { int r = smp_prefetch_http(px, l4, l7, opt, args, smp, 0); if (r <= 0) return r; } while (0) + do { int r = smp_prefetch_http(px, strm, opt, args, smp, 0); if (r <= 0) return r; } while (0) /* 1. Check on METHOD @@ -10034,11 +10034,11 @@ 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 *l4, void *l7, unsigned int opt, +smp_fetch_meth(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int meth; - struct http_txn *txn = l7; + struct http_txn *txn = strm->txn; CHECK_HTTP_MESSAGE_FIRST_PERM(); @@ -10088,10 +10088,10 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e } static int -smp_fetch_rqver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_rqver(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn = strm->txn; char *ptr; int len; @@ -10113,15 +10113,16 @@ smp_fetch_rqver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, } static int -smp_fetch_stver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_stver(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; char *ptr; int len; CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; if (txn->rsp.msg_state < HTTP_MSG_BODY) return 0; @@ -10142,15 +10143,16 @@ smp_fetch_stver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, /* 3. Check on Status Code. We manipulate integers here. */ static int -smp_fetch_stcode(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_stcode(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; char *ptr; int len; CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; if (txn->rsp.msg_state < HTTP_MSG_BODY) return 0; @@ -10165,13 +10167,14 @@ smp_fetch_stcode(struct proxy *px, struct stream *l4, void *l7, 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 *l4, void *l7, unsigned int opt, +smp_fetch_url(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; smp->type = SMP_T_STR; smp->data.str.len = txn->req.sl.rq.u_l; smp->data.str.str = txn->req.chn->buf->p + txn->req.sl.rq.u; @@ -10180,14 +10183,15 @@ smp_fetch_url(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, } static int -smp_fetch_url_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_url_ip(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; struct sockaddr_storage addr; CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; url2sa(txn->req.chn->buf->p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &addr, NULL); if (((struct sockaddr_in *)&addr)->sin_family != AF_INET) return 0; @@ -10199,14 +10203,15 @@ smp_fetch_url_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt } static int -smp_fetch_url_port(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_url_port(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; struct sockaddr_storage addr; CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; url2sa(txn->req.chn->buf->p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &addr, NULL); if (((struct sockaddr_in *)&addr)->sin_family != AF_INET) return 0; @@ -10225,13 +10230,12 @@ smp_fetch_url_port(struct proxy *px, struct stream *l4, void *l7, unsigned int o * returns full lines instead (useful for User-Agent or Date for example). */ static int -smp_fetch_fhdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_fhdr(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; - struct hdr_idx *idx = &txn->hdr_idx; + struct hdr_idx *idx; struct hdr_ctx *ctx = smp->ctx.a[0]; - const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; + const struct http_msg *msg; int occ = 0; const char *name_str = NULL; int name_len = 0; @@ -10255,6 +10259,9 @@ smp_fetch_fhdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, CHECK_HTTP_MESSAGE_FIRST(); + idx = &strm->txn->hdr_idx; + msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp; + if (ctx && !(smp->flags & SMP_F_NOT_LAST)) /* search for header from the beginning */ ctx->idx = 0; @@ -10281,13 +10288,12 @@ smp_fetch_fhdr(struct proxy *px, struct stream *l4, void *l7, 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 *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_fhdr_cnt(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; - struct hdr_idx *idx = &txn->hdr_idx; + struct hdr_idx *idx; struct hdr_ctx ctx; - const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; + const struct http_msg *msg; int cnt; const char *name = NULL; int len = 0; @@ -10299,6 +10305,9 @@ smp_fetch_fhdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int o CHECK_HTTP_MESSAGE_FIRST(); + idx = &strm->txn->hdr_idx; + msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp; + ctx.idx = 0; cnt = 0; while (http_find_full_header2(name, len, msg->chn->buf->p, idx, &ctx)) @@ -10311,13 +10320,12 @@ smp_fetch_fhdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int o } static int -smp_fetch_hdr_names(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_hdr_names(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; - struct hdr_idx *idx = &txn->hdr_idx; + struct hdr_idx *idx; struct hdr_ctx ctx; - const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; + const struct http_msg *msg; struct chunk *temp; char del = ','; @@ -10326,6 +10334,9 @@ smp_fetch_hdr_names(struct proxy *px, struct stream *l4, void *l7, unsigned int CHECK_HTTP_MESSAGE_FIRST(); + idx = &strm->txn->hdr_idx; + msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp; + temp = get_trash_chunk(); ctx.idx = 0; @@ -10350,13 +10361,12 @@ smp_fetch_hdr_names(struct proxy *px, struct stream *l4, void *l7, unsigned int * headers are considered from the first one. */ static int -smp_fetch_hdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_hdr(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; - struct hdr_idx *idx = &txn->hdr_idx; + struct hdr_idx *idx; struct hdr_ctx *ctx = smp->ctx.a[0]; - const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; + const struct http_msg *msg; int occ = 0; const char *name_str = NULL; int name_len = 0; @@ -10380,6 +10390,9 @@ smp_fetch_hdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, CHECK_HTTP_MESSAGE_FIRST(); + idx = &strm->txn->hdr_idx; + msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp; + if (ctx && !(smp->flags & SMP_F_NOT_LAST)) /* search for header from the beginning */ ctx->idx = 0; @@ -10405,13 +10418,12 @@ smp_fetch_hdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, * Accepts exactly 1 argument of type string. */ static int -smp_fetch_hdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_hdr_cnt(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; - struct hdr_idx *idx = &txn->hdr_idx; + struct hdr_idx *idx; struct hdr_ctx ctx; - const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; + const struct http_msg *msg; int cnt; const char *name = NULL; int len = 0; @@ -10423,6 +10435,9 @@ smp_fetch_hdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int op CHECK_HTTP_MESSAGE_FIRST(); + idx = &strm->txn->hdr_idx; + msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &strm->txn->req : &strm->txn->rsp; + ctx.idx = 0; cnt = 0; while (http_find_header2(name, len, msg->chn->buf->p, idx, &ctx)) @@ -10440,10 +10455,10 @@ smp_fetch_hdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int op * may or may not be appropriate for everything. */ static int -smp_fetch_hdr_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_hdr_val(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - int ret = smp_fetch_hdr(px, l4, l7, opt, args, smp, kw, private); + int ret = smp_fetch_hdr(px, strm, opt, args, smp, kw, private); if (ret > 0) { smp->type = SMP_T_UINT; @@ -10458,12 +10473,12 @@ smp_fetch_hdr_val(struct proxy *px, struct stream *l4, void *l7, unsigned int op * It returns an IPv4 or IPv6 address. */ static int -smp_fetch_hdr_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_hdr_ip(struct proxy *px, 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, l4, l7, opt, args, smp, kw, private)) > 0) { + while ((ret = smp_fetch_hdr(px, strm, opt, args, smp, kw, private)) > 0) { if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4)) { smp->type = SMP_T_IPV4; break; @@ -10490,14 +10505,15 @@ smp_fetch_hdr_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt * the first '/' after the possible hostname, and ends before the possible '?'. */ static int -smp_fetch_path(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_path(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; char *ptr, *end; CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; end = txn->req.chn->buf->p + txn->req.sl.rq.u + txn->req.sl.rq.u_l; ptr = http_get_path(txn); if (!ptr) @@ -10523,19 +10539,20 @@ smp_fetch_path(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, * The returned sample is of type string. */ static int -smp_fetch_base(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_base(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; char *ptr, *end, *beg; struct hdr_ctx ctx; struct chunk *temp; CHECK_HTTP_MESSAGE_FIRST(); + 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, l4, l7, opt, args, smp, kw, private); + return smp_fetch_path(px, 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(); @@ -10570,10 +10587,10 @@ smp_fetch_base(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, * high-traffic sites without having to store whole paths. */ int -smp_fetch_base32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_base32(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; struct hdr_ctx ctx; unsigned int hash = 0; char *ptr, *beg, *end; @@ -10581,6 +10598,7 @@ smp_fetch_base32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; ctx.idx = 0; if (http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx)) { /* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */ @@ -10618,17 +10636,17 @@ smp_fetch_base32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt * 8 bytes would still work. */ static int -smp_fetch_base32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_base32_src(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *cli_conn = objt_conn(sess->origin); if (!cli_conn) return 0; - if (!smp_fetch_base32(px, l4, l7, opt, args, smp, kw, private)) + if (!smp_fetch_base32(px, strm, opt, args, smp, kw, private)) return 0; temp = get_trash_chunk(); @@ -10658,14 +10676,15 @@ smp_fetch_base32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int * of type string carrying the whole query string. */ static int -smp_fetch_query(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_query(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; char *ptr, *end; CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; ptr = txn->req.chn->buf->p + txn->req.sl.rq.u; end = ptr + txn->req.sl.rq.u_l; @@ -10683,7 +10702,7 @@ smp_fetch_query(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, } static int -smp_fetch_proto_http(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_proto_http(struct proxy *px, 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 @@ -10699,17 +10718,17 @@ smp_fetch_proto_http(struct proxy *px, struct stream *l4, void *l7, unsigned int /* 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 *s, void *l7, unsigned int opt, +smp_fetch_http_first_req(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; - smp->data.uint = !(s->txn->flags & TX_NOT_FIRST); + smp->data.uint = !(strm->txn->flags & TX_NOT_FIRST); return 1; } /* Accepts exactly 1 argument of type userlist */ static int -smp_fetch_http_auth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_http_auth(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { @@ -10718,33 +10737,32 @@ smp_fetch_http_auth(struct proxy *px, struct stream *l4, void *l7, unsigned int CHECK_HTTP_MESSAGE_FIRST(); - if (!get_http_auth(l4)) + if (!get_http_auth(strm)) return 0; smp->type = SMP_T_BOOL; - smp->data.uint = check_user(args->data.usr, l4->txn->auth.user, l4->txn->auth.pass); + smp->data.uint = check_user(args->data.usr, strm->txn->auth.user, strm->txn->auth.pass); return 1; } /* Accepts exactly 1 argument of type userlist */ static int -smp_fetch_http_auth_grp(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_http_auth_grp(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - if (!args || args->type != ARGT_USR) return 0; CHECK_HTTP_MESSAGE_FIRST(); - if (!get_http_auth(l4)) + if (!get_http_auth(strm)) return 0; /* if the user does not belong to the userlist or has a wrong password, * report that it unconditionally does not match. Otherwise we return * a string containing the username. */ - if (!check_user(args->data.usr, l4->txn->auth.user, l4->txn->auth.pass)) + if (!check_user(args->data.usr, strm->txn->auth.user, strm->txn->auth.pass)) return 0; /* pat_match_auth() will need the user list */ @@ -10752,8 +10770,8 @@ smp_fetch_http_auth_grp(struct proxy *px, struct stream *l4, void *l7, unsigned smp->type = SMP_T_STR; smp->flags = SMP_F_CONST; - smp->data.str.str = l4->txn->auth.user; - smp->data.str.len = strlen(l4->txn->auth.user); + smp->data.str.str = strm->txn->auth.user; + smp->data.str.len = strlen(strm->txn->auth.user); return 1; } @@ -10857,10 +10875,10 @@ 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 *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_capture_header_req(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct proxy *fe = strm_sess(l4)->fe; + struct proxy *fe = strm_sess(strm)->fe; int idx; if (!args || args->type != ARGT_UINT) @@ -10868,13 +10886,13 @@ smp_fetch_capture_header_req(struct proxy *px, struct stream *l4, void *l7, unsi idx = args->data.uint; - if (idx > (fe->nb_req_cap - 1) || l4->req_cap == NULL || l4->req_cap[idx] == NULL) + if (idx > (fe->nb_req_cap - 1) || strm->req_cap == NULL || strm->req_cap[idx] == NULL) return 0; smp->type = SMP_T_STR; smp->flags |= SMP_F_CONST; - smp->data.str.str = l4->req_cap[idx]; - smp->data.str.len = strlen(l4->req_cap[idx]); + smp->data.str.str = strm->req_cap[idx]; + smp->data.str.len = strlen(strm->req_cap[idx]); return 1; } @@ -10883,10 +10901,10 @@ smp_fetch_capture_header_req(struct proxy *px, struct stream *l4, void *l7, unsi * the "capture" option in the configuration file */ static int -smp_fetch_capture_header_res(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_capture_header_res(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct proxy *fe = strm_sess(l4)->fe; + struct proxy *fe = strm_sess(strm)->fe; int idx; if (!args || args->type != ARGT_UINT) @@ -10894,27 +10912,27 @@ smp_fetch_capture_header_res(struct proxy *px, struct stream *l4, void *l7, unsi idx = args->data.uint; - if (idx > (fe->nb_rsp_cap - 1) || l4->res_cap == NULL || l4->res_cap[idx] == NULL) + if (idx > (fe->nb_rsp_cap - 1) || strm->res_cap == NULL || strm->res_cap[idx] == NULL) return 0; smp->type = SMP_T_STR; smp->flags |= SMP_F_CONST; - smp->data.str.str = l4->res_cap[idx]; - smp->data.str.len = strlen(l4->res_cap[idx]); + smp->data.str.str = strm->res_cap[idx]; + smp->data.str.len = strlen(strm->res_cap[idx]); return 1; } /* 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 *l4, void *l7, unsigned int opt, +smp_fetch_capture_req_method(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct chunk *temp; - struct http_txn *txn = l7; + struct http_txn *txn = strm->txn; char *ptr; - if (!txn->uri) + if (!txn || !txn->uri) return 0; ptr = txn->uri; @@ -10935,14 +10953,14 @@ smp_fetch_capture_req_method(struct proxy *px, struct stream *l4, void *l7, unsi /* 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 *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_capture_req_uri(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { struct chunk *temp; - struct http_txn *txn = l7; + struct http_txn *txn = strm->txn; char *ptr; - if (!txn->uri) + if (!txn || !txn->uri) return 0; ptr = txn->uri; @@ -10974,12 +10992,12 @@ smp_fetch_capture_req_uri(struct proxy *px, struct stream *l4, void *l7, unsigne * as a string (either "HTTP/1.0" or "HTTP/1.1"). */ static int -smp_fetch_capture_req_ver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_capture_req_ver(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn = strm->txn; - if (txn->req.msg_state < HTTP_MSG_HDR_FIRST) + if (!txn || txn->req.msg_state < HTTP_MSG_HDR_FIRST) return 0; if (txn->req.flags & HTTP_MSGF_VER_11) @@ -10998,12 +11016,12 @@ smp_fetch_capture_req_ver(struct proxy *px, struct stream *l4, void *l7, unsigne * as a string (either "HTTP/1.0" or "HTTP/1.1"). */ static int -smp_fetch_capture_res_ver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_capture_res_ver(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn = strm->txn; - if (txn->rsp.msg_state < HTTP_MSG_HDR_FIRST) + if (!txn || txn->rsp.msg_state < HTTP_MSG_HDR_FIRST) return 0; if (txn->rsp.flags & HTTP_MSGF_VER_11) @@ -11029,11 +11047,11 @@ smp_fetch_capture_res_ver(struct proxy *px, struct stream *l4, void *l7, unsigne * 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 *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +int smp_fetch_cookie(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; - struct hdr_idx *idx = &txn->hdr_idx; + struct http_txn *txn; + struct hdr_idx *idx; struct hdr_ctx *ctx = smp->ctx.a[2]; const struct http_msg *msg; const char *hdr_name; @@ -11054,6 +11072,9 @@ int smp_fetch_cookie(struct proxy *px, struct stream *l4, void *l7, unsigned int CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; + idx = &strm->txn->hdr_idx; + if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) { msg = &txn->req; hdr_name = "Cookie"; @@ -11128,11 +11149,11 @@ int smp_fetch_cookie(struct proxy *px, struct stream *l4, void *l7, unsigned int * type UINT. Accepts exactly 1 argument of type string. */ static int -smp_fetch_cookie_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_cookie_cnt(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; - struct hdr_idx *idx = &txn->hdr_idx; + struct http_txn *txn; + struct hdr_idx *idx; struct hdr_ctx ctx; const struct http_msg *msg; const char *hdr_name; @@ -11146,6 +11167,9 @@ smp_fetch_cookie_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; + idx = &strm->txn->hdr_idx; + if ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) { msg = &txn->req; hdr_name = "Cookie"; @@ -11195,10 +11219,10 @@ smp_fetch_cookie_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int * takes a mandatory argument of type string. It relies on smp_fetch_cookie(). */ static int -smp_fetch_cookie_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_cookie_val(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - int ret = smp_fetch_cookie(px, l4, l7, opt, args, smp, kw, private); + int ret = smp_fetch_cookie(px, strm, opt, args, smp, kw, private); if (ret > 0) { smp->type = SMP_T_UINT; @@ -11300,12 +11324,11 @@ find_url_param_value(char* path, size_t path_l, } static int -smp_fetch_url_param(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_url_param(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { char delim = '?'; - struct http_txn *txn = l7; - struct http_msg *msg = &txn->req; + struct http_msg *msg; if (!args || args[0].type != ARGT_STR || (args[1].type && args[1].type != ARGT_STR)) @@ -11313,6 +11336,8 @@ smp_fetch_url_param(struct proxy *px, struct stream *l4, void *l7, unsigned int CHECK_HTTP_MESSAGE_FIRST(); + msg = &strm->txn->req; + if (args[1].type) delim = *args[1].data.str.str; @@ -11331,10 +11356,10 @@ smp_fetch_url_param(struct proxy *px, struct stream *l4, void *l7, unsigned int * above). */ static int -smp_fetch_url_param_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_url_param_val(struct proxy *px, 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, l4, l7, opt, args, smp, kw, private); + int ret = smp_fetch_url_param(px, strm, opt, args, smp, kw, private); if (ret > 0) { smp->type = SMP_T_UINT; @@ -11355,10 +11380,10 @@ smp_fetch_url_param_val(struct proxy *px, struct stream *l4, void *l7, unsigned * as well as the path */ static int -smp_fetch_url32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_url32(struct proxy *px, struct stream *strm, unsigned int opt, + const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct http_txn *txn = l7; + struct http_txn *txn; struct hdr_ctx ctx; unsigned int hash = 0; char *ptr, *beg, *end; @@ -11366,6 +11391,7 @@ smp_fetch_url32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, CHECK_HTTP_MESSAGE_FIRST(); + txn = strm->txn; ctx.idx = 0; if (http_find_header2("Host", 4, txn->req.chn->buf->p, &txn->hdr_idx, &ctx)) { /* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */ @@ -11403,14 +11429,14 @@ smp_fetch_url32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, * 8 bytes would still work. */ static int -smp_fetch_url32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_url32_src(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *cli_conn = objt_conn(sess->origin); - if (!smp_fetch_url32(px, l4, l7, opt, args, smp, kw, private)) + if (!smp_fetch_url32(px, 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 af61c54dc..b7904e02e 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -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, s->txn, SMP_OPT_DIR_REQ | partial); + ret = acl_exec_cond(rule->cond, s->be, 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, s->txn, SMP_OPT_DIR_REQ | partial, rule->act_prm.trk_ctr.expr, &smp); + key = stktable_fetch_key(t, s->be, 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, s->txn, SMP_OPT_DIR_REQ | partial, rule->act_prm.cap.expr); + key = sample_fetch_string(s->be, 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, s->txn, SMP_OPT_DIR_RES | partial); + ret = acl_exec_cond(rule->cond, s->be, 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, NULL, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, sess->fe, 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, s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL); + key = stktable_fetch_key(t, s->be, 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,10 @@ 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 *l4, void *l7, unsigned int opt, +smp_fetch_src(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *cli_conn = objt_conn(sess->origin); if (!cli_conn) @@ -1993,10 +1993,10 @@ smp_fetch_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, /* set temp integer to the connection's source port */ static int -smp_fetch_sport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sport(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *k, void *private) { - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *cli_conn = objt_conn(sess->origin); if (!cli_conn) @@ -2012,10 +2012,10 @@ smp_fetch_sport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, /* fetch the connection's destination IPv4/IPv6 address */ static int -smp_fetch_dst(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_dst(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *cli_conn = objt_conn(sess->origin); if (!cli_conn) @@ -2042,10 +2042,10 @@ smp_fetch_dst(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, /* set temp integer to the frontend connexion's destination port */ static int -smp_fetch_dport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_dport(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + 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 c5f5b1694..9d53b8108 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1022,8 +1022,7 @@ 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 *l4, void *l7, - unsigned int opt, +struct sample *sample_process(struct proxy *px, struct stream *strm, unsigned int opt, struct sample_expr *expr, struct sample *p) { struct sample_conv_expr *conv_expr; @@ -1033,7 +1032,7 @@ struct sample *sample_process(struct proxy *px, struct stream *l4, void *l7, memset(p, 0, sizeof(*p)); } - if (!expr->fetch->process(px, l4, l7, opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private)) + if (!expr->fetch->process(px, strm, opt, expr->arg_p, p, expr->fetch->kw, expr->fetch->private)) return NULL; list_for_each_entry(conv_expr, &expr->conv_exprs, list) { @@ -1052,7 +1051,7 @@ struct sample *sample_process(struct proxy *px, struct stream *l4, void *l7, /* OK cast succeeded */ - if (!conv_expr->conv->process(l4, conv_expr->arg_p, p, conv_expr->conv->private)) + if (!conv_expr->conv->process(strm, conv_expr->arg_p, p, conv_expr->conv->private)) return NULL; } return p; @@ -1331,14 +1330,14 @@ 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 *l4, void *l7, +struct sample *sample_fetch_string(struct proxy *px, struct stream *strm, unsigned int opt, struct sample_expr *expr) { struct sample *smp = &temp_smp; memset(smp, 0, sizeof(*smp)); - if (!sample_process(px, l4, l7, opt, expr, smp)) { + if (!sample_process(px, strm, opt, expr, smp)) { if ((smp->flags & SMP_F_MAY_CHANGE) && !(opt & SMP_OPT_FINAL)) return smp; return NULL; @@ -2147,7 +2146,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 *s, void *l7, unsigned int opt, +smp_fetch_true(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; @@ -2157,7 +2156,7 @@ smp_fetch_true(struct proxy *px, struct stream *s, void *l7, unsigned int opt, /* force FALSE to be returned at the fetch level */ static int -smp_fetch_false(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_false(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; @@ -2167,7 +2166,7 @@ smp_fetch_false(struct proxy *px, struct stream *s, void *l7, unsigned int opt, /* retrieve environment variable $1 as a string */ static int -smp_fetch_env(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_env(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { char *env; @@ -2190,7 +2189,7 @@ smp_fetch_env(struct proxy *px, struct stream *s, void *l7, unsigned int opt, * of args[0] seconds. */ static int -smp_fetch_date(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_date(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->data.uint = date.tv_sec; @@ -2206,7 +2205,7 @@ smp_fetch_date(struct proxy *px, struct stream *s, void *l7, unsigned int opt, /* returns the number of processes */ static int -smp_fetch_nbproc(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_nbproc(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_UINT; @@ -2216,7 +2215,7 @@ smp_fetch_nbproc(struct proxy *px, struct stream *s, void *l7, unsigned int opt, /* returns the number of the current process (between 1 and nbproc */ static int -smp_fetch_proc(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_proc(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_UINT; @@ -2228,7 +2227,7 @@ smp_fetch_proc(struct proxy *px, struct stream *s, void *l7, unsigned int opt, * range specified in argument. */ static int -smp_fetch_rand(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_rand(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->data.uint = random(); @@ -2244,7 +2243,7 @@ smp_fetch_rand(struct proxy *px, struct stream *s, void *l7, unsigned int opt, /* returns true if the current process is stopping */ static int -smp_fetch_stopping(struct proxy *px, struct stream *s, void *l7, unsigned int opt, +smp_fetch_stopping(struct proxy *px, 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 e06e96d97..f39d97352 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -3084,11 +3084,11 @@ 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 *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_has_crt(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; - struct session *sess = l4->sess; + struct session *sess = strm_sess(strm); conn = objt_conn(sess->origin); if (!conn || conn->xprt != &ssl_sock) @@ -3111,14 +3111,14 @@ smp_fetch_ssl_fc_has_crt(struct proxy *px, struct stream *l4, void *l7, unsigned * should be use. */ static int -smp_fetch_ssl_x_der(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_der(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3157,14 +3157,14 @@ out: * should be use. */ static int -smp_fetch_ssl_x_serial(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_serial(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3203,7 +3203,7 @@ out: * should be use. */ static int -smp_fetch_ssl_x_sha1(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_sha1(struct proxy *px, 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 +3211,7 @@ smp_fetch_ssl_x_sha1(struct proxy *px, struct stream *l4, void *l7, unsigned int const EVP_MD *digest; int ret = 0; struct chunk *smp_trash; - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3249,14 +3249,14 @@ out: * should be use. */ static int -smp_fetch_ssl_x_notafter(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_ssl_x_notafter(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3294,15 +3294,15 @@ out: * should be use. */ static int -smp_fetch_ssl_x_i_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_ssl_x_i_dn(struct proxy *px, 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; X509_NAME *name; int ret = 0; struct chunk *smp_trash; - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3355,14 +3355,14 @@ out: * should be use. */ static int -smp_fetch_ssl_x_notbefore(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_ssl_x_notbefore(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3400,15 +3400,15 @@ out: * should be use. */ static int -smp_fetch_ssl_x_s_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_ssl_x_s_dn(struct proxy *px, 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; X509_NAME *name; int ret = 0; struct chunk *smp_trash; - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3458,11 +3458,11 @@ out: /* integer, returns true if current session use a client certificate */ static int -smp_fetch_ssl_c_used(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_ssl_c_used(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3490,12 +3490,12 @@ smp_fetch_ssl_c_used(struct proxy *px, struct stream *l4, void *l7, unsigned int * should be use. */ static int -smp_fetch_ssl_x_version(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_version(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3528,13 +3528,13 @@ smp_fetch_ssl_x_version(struct proxy *px, struct stream *l4, void *l7, unsigned * should be use. */ static int -smp_fetch_ssl_x_sig_alg(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_sig_alg(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3578,13 +3578,13 @@ smp_fetch_ssl_x_sig_alg(struct proxy *px, struct stream *l4, void *l7, unsigned * should be use. */ static int -smp_fetch_ssl_x_key_alg(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_key_alg(struct proxy *px, 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(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3627,11 +3627,11 @@ smp_fetch_ssl_x_key_alg(struct proxy *px, struct stream *l4, void *l7, unsigned * char is 'b'. */ static int -smp_fetch_ssl_fc(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc(struct proxy *px, 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; - struct connection *conn = objt_conn(l4->si[back_conn].end); + struct connection *conn = objt_conn(strm->si[back_conn].end); smp->type = SMP_T_BOOL; smp->data.uint = (conn && conn->xprt == &ssl_sock); @@ -3640,7 +3640,7 @@ smp_fetch_ssl_fc(struct proxy *px, struct stream *l4, void *l7, unsigned int opt /* boolean, returns true if client present a SNI */ static int -smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME @@ -3662,7 +3662,7 @@ smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *l4, void *l7, unsigned * char is 'b'. */ static int -smp_fetch_ssl_fc_cipher(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_cipher(struct proxy *px, 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; @@ -3670,7 +3670,7 @@ smp_fetch_ssl_fc_cipher(struct proxy *px, struct stream *l4, void *l7, unsigned smp->flags = 0; - conn = objt_conn(l4->si[back_conn].end); + conn = objt_conn(strm->si[back_conn].end); if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) return 0; @@ -3691,7 +3691,7 @@ smp_fetch_ssl_fc_cipher(struct proxy *px, struct stream *l4, void *l7, unsigned * char is 'b'. */ static int -smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_alg_keysize(struct proxy *px, 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; @@ -3699,7 +3699,7 @@ smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct stream *l4, void *l7, unsi smp->flags = 0; - conn = objt_conn(l4->si[back_conn].end); + conn = objt_conn(strm->si[back_conn].end); if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) return 0; @@ -3716,7 +3716,7 @@ smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct stream *l4, void *l7, unsi * char is 'b'. */ static int -smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_use_keysize(struct proxy *px, 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; @@ -3724,7 +3724,7 @@ smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct stream *l4, void *l7, unsi smp->flags = 0; - conn = objt_conn(l4->si[back_conn].end); + conn = objt_conn(strm->si[back_conn].end); if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) return 0; @@ -3739,7 +3739,7 @@ smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct stream *l4, void *l7, unsi #ifdef OPENSSL_NPN_NEGOTIATED static int -smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -3765,7 +3765,7 @@ smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *l4, void *l7, unsigned int #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation static int -smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -3794,7 +3794,7 @@ smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *l4, void *l7, unsigned in * char is 'b'. */ static int -smp_fetch_ssl_fc_protocol(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_protocol(struct proxy *px, 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; @@ -3802,7 +3802,7 @@ smp_fetch_ssl_fc_protocol(struct proxy *px, struct stream *l4, void *l7, unsigne smp->flags = 0; - conn = objt_conn(l4->si[back_conn].end); + conn = objt_conn(strm->si[back_conn].end); if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) return 0; @@ -3822,7 +3822,7 @@ smp_fetch_ssl_fc_protocol(struct proxy *px, struct stream *l4, void *l7, unsigne * char is 'b'. */ static int -smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { #if OPENSSL_VERSION_NUMBER > 0x0090800fL @@ -3833,7 +3833,7 @@ smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *l4, void *l7, unsig smp->flags = SMP_F_CONST; smp->type = SMP_T_BIN; - conn = objt_conn(l4->si[back_conn].end); + conn = objt_conn(strm->si[back_conn].end); if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) return 0; @@ -3852,7 +3852,7 @@ smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *l4, void *l7, unsig } static int -smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME @@ -3878,8 +3878,8 @@ smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int } static int -smp_fetch_ssl_fc_unique_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_ssl_fc_unique_id(struct proxy *px, 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; @@ -3889,7 +3889,7 @@ smp_fetch_ssl_fc_unique_id(struct proxy *px, struct stream *l4, void *l7, unsign smp->flags = 0; - conn = objt_conn(l4->si[back_conn].end); + conn = objt_conn(strm->si[back_conn].end); if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) return 0; @@ -3919,10 +3919,10 @@ smp_fetch_ssl_fc_unique_id(struct proxy *px, struct stream *l4, void *l7, unsign /* 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 *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_ca_err(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3943,10 +3943,10 @@ smp_fetch_ssl_c_ca_err(struct proxy *px, struct stream *l4, void *l7, unsigned i /* 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 *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3967,10 +3967,10 @@ smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct stream *l4, void *l7, unsi /* integer, returns the first verify error on client certificate */ static int -smp_fetch_ssl_c_err(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_err(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *conn; conn = objt_conn(sess->origin); @@ -3991,10 +3991,10 @@ smp_fetch_ssl_c_err(struct proxy *px, struct stream *l4, void *l7, unsigned int /* integer, returns the verify result on client cert */ static int -smp_fetch_ssl_c_verify(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_verify(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + 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 f0f780841..79ab4fa29 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -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 *l4, void *l7, +struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct stream *strm, unsigned int opt, struct sample_expr *expr, struct sample *smp) { if (smp) memset(smp, 0, sizeof(*smp)); - smp = sample_process(px, l4, l7, opt, expr, smp); + smp = sample_process(px, strm, opt, expr, smp); if (!smp) return NULL; diff --git a/src/stream.c b/src/stream.c index f12b2c36a..5833b07e0 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1391,7 +1391,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, s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, fe, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) ret = !ret; @@ -1444,7 +1444,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, s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(prst_rule->cond, s->be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (prst_rule->cond->pol == ACL_COND_UNLESS) ret = !ret; @@ -1502,7 +1502,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, s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, s->be, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) ret = !ret; @@ -1567,7 +1567,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, s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) ret = !ret; @@ -1576,7 +1576,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, s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->expr, NULL); + key = stktable_fetch_key(rule->table.t, px, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->expr, NULL); if (!key) continue; @@ -1670,7 +1670,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, s->txn, SMP_OPT_DIR_RES|SMP_OPT_FINAL); + ret = acl_exec_cond(rule->cond, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) ret = !ret; @@ -1679,7 +1679,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, s->txn, SMP_OPT_DIR_RES|SMP_OPT_FINAL, rule->expr, NULL); + key = stktable_fetch_key(rule->table.t, px, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, rule->expr, NULL); if (!key) continue; @@ -2951,12 +2951,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 *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_sc_tracked(struct proxy *px, 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(l4, args, kw); + smp->data.uint = !!smp_fetch_sc_stkctr(strm, args, kw); return 1; } @@ -2966,10 +2966,10 @@ smp_fetch_sc_tracked(struct proxy *px, struct stream *l4, void *l7, unsigned int * zero is returned if the key is new. */ static int -smp_fetch_sc_get_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_get_gpc0(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -2993,10 +2993,10 @@ smp_fetch_sc_get_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned in * Value zero is returned if the key is new. */ static int -smp_fetch_sc_gpc0_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_gpc0_rate(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3019,10 +3019,10 @@ smp_fetch_sc_gpc0_rate(struct proxy *px, struct stream *l4, void *l7, unsigned i * 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 *l4, void *l7, unsigned int opt, +smp_fetch_sc_inc_gpc0(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3056,10 +3056,10 @@ smp_fetch_sc_inc_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned in * 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 *l4, void *l7, unsigned int opt, +smp_fetch_sc_clr_gpc0(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3082,10 +3082,10 @@ smp_fetch_sc_clr_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned in * "src_conn_cnt" only. */ static int -smp_fetch_sc_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_conn_cnt(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3107,10 +3107,10 @@ smp_fetch_sc_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned in * only. */ static int -smp_fetch_sc_conn_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_conn_rate(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3133,10 +3133,10 @@ smp_fetch_sc_conn_rate(struct proxy *px, struct stream *l4, void *l7, unsigned i * Accepts exactly 1 argument of type table. */ static int -smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { - struct session *sess = strm_sess(l4); + struct session *sess = strm_sess(strm); struct connection *conn = objt_conn(sess->origin); struct stksess *ts; struct stktable_key *key; @@ -3170,10 +3170,10 @@ smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsig * "src_conn_cur" only. */ static int -smp_fetch_sc_conn_cur(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_conn_cur(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3195,10 +3195,10 @@ smp_fetch_sc_conn_cur(struct proxy *px, struct stream *l4, void *l7, unsigned in * "src_sess_cnt" only. */ static int -smp_fetch_sc_sess_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_sess_cnt(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3219,10 +3219,10 @@ smp_fetch_sc_sess_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned in * 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 *l4, void *l7, unsigned int opt, +smp_fetch_sc_sess_rate(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3245,10 +3245,10 @@ smp_fetch_sc_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned i * "src_http_req_cnt" only. */ static int -smp_fetch_sc_http_req_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_req_cnt(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3270,10 +3270,10 @@ smp_fetch_sc_http_req_cnt(struct proxy *px, struct stream *l4, void *l7, unsigne * "src_http_req_rate" only. */ static int -smp_fetch_sc_http_req_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_req_rate(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3296,10 +3296,10 @@ smp_fetch_sc_http_req_rate(struct proxy *px, struct stream *l4, void *l7, unsign * "src_http_err_cnt" only. */ static int -smp_fetch_sc_http_err_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_err_cnt(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3321,10 +3321,10 @@ smp_fetch_sc_http_err_cnt(struct proxy *px, struct stream *l4, void *l7, unsigne * "src_http_err_rate" only. */ static int -smp_fetch_sc_http_err_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_err_rate(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3347,10 +3347,10 @@ smp_fetch_sc_http_err_rate(struct proxy *px, struct stream *l4, void *l7, unsign * "sc[0-9]_kbytes_in" or "src_kbytes_in" only. */ static int -smp_fetch_sc_kbytes_in(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_kbytes_in(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3372,10 +3372,10 @@ smp_fetch_sc_kbytes_in(struct proxy *px, struct stream *l4, void *l7, unsigned i * "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 *l4, void *l7, unsigned int opt, +smp_fetch_sc_bytes_in_rate(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3398,10 +3398,10 @@ smp_fetch_sc_bytes_in_rate(struct proxy *px, struct stream *l4, void *l7, unsign * "sc[0-9]_kbytes_out" or "src_kbytes_out" only. */ static int -smp_fetch_sc_kbytes_out(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, - const struct arg *args, struct sample *smp, const char *kw, void *private) +smp_fetch_sc_kbytes_out(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3423,10 +3423,10 @@ smp_fetch_sc_kbytes_out(struct proxy *px, struct stream *l4, void *l7, unsigned * "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 *l4, void *l7, unsigned int opt, +smp_fetch_sc_bytes_out_rate(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3448,10 +3448,10 @@ smp_fetch_sc_bytes_out_rate(struct proxy *px, struct stream *l4, void *l7, unsig * tracked frontend counters. Supports being called as "sc[0-9]_trackers" only. */ static int -smp_fetch_sc_trackers(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_sc_trackers(struct proxy *px, 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(l4, args, kw); + struct stkctr *stkctr = smp_fetch_sc_stkctr(strm, args, kw); if (!stkctr) return 0; @@ -3466,7 +3466,7 @@ smp_fetch_sc_trackers(struct proxy *px, struct stream *l4, void *l7, unsigned in * Accepts exactly 1 argument of type table. */ static int -smp_fetch_table_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_table_cnt(struct proxy *px, 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 +3479,7 @@ smp_fetch_table_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int * Accepts exactly 1 argument of type table. */ static int -smp_fetch_table_avl(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, +smp_fetch_table_avl(struct proxy *px, struct stream *strm, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { px = args->data.prx;