mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-02 10:12:03 +00:00
MEDIUM: acl: replace acl_expr with args in acl fetch_* functions
Having the args everywhere will make it easier to share fetch functions between patterns and ACLs. The only place where we could have needed the expr was in the http_prefetch function which can do well without.
This commit is contained in:
parent
32389b7d04
commit
24e32d8c6b
@ -172,7 +172,7 @@ int acl_parse_ip(const char **text, struct acl_pattern *pattern, int *opaque);
|
||||
|
||||
/* always fake a data retrieval */
|
||||
int acl_fetch_nothing(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp);
|
||||
const struct arg *args, struct sample *smp);
|
||||
|
||||
/* always return false */
|
||||
int acl_match_nothing(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
@ -239,7 +239,7 @@ struct acl_keyword {
|
||||
const char *kw;
|
||||
int (*parse)(const char **text, struct acl_pattern *pattern, int *opaque);
|
||||
int (*fetch)(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp);
|
||||
const struct arg *args, struct sample *smp);
|
||||
int (*match)(struct sample *smp, struct acl_pattern *pattern);
|
||||
unsigned int requires; /* bit mask of all ACL_USE_* required to evaluate this keyword */
|
||||
int arg_mask; /* mask describing up to 7 arg types */
|
||||
|
18
src/acl.c
18
src/acl.c
@ -66,7 +66,7 @@ static struct acl_kw_list acl_keywords = {
|
||||
/* force TRUE to be returned at the fetch level */
|
||||
static int
|
||||
acl_fetch_true(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->type = SMP_T_BOOL;
|
||||
smp->data.uint = 1;
|
||||
@ -78,7 +78,7 @@ acl_fetch_true(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_wait_end(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (dir & ACL_PARTIAL) {
|
||||
smp->flags |= SMP_F_MAY_CHANGE;
|
||||
@ -92,7 +92,7 @@ acl_fetch_wait_end(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* force FALSE to be returned at the fetch level */
|
||||
static int
|
||||
acl_fetch_false(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->type = SMP_T_BOOL;
|
||||
smp->data.uint = 0;
|
||||
@ -102,7 +102,7 @@ acl_fetch_false(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* return the number of bytes in the request buffer */
|
||||
static int
|
||||
acl_fetch_req_len(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4 || !l4->req)
|
||||
return 0;
|
||||
@ -116,7 +116,7 @@ acl_fetch_req_len(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
static int
|
||||
acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int hs_len;
|
||||
int hs_type, bleft;
|
||||
@ -185,7 +185,7 @@ acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_req_ssl_ver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int version, bleft, msg_len;
|
||||
const unsigned char *data;
|
||||
@ -321,7 +321,7 @@ acl_fetch_req_ssl_ver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_ssl_hello_sni(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int hs_len, ext_len, bleft;
|
||||
struct buffer *b;
|
||||
@ -465,7 +465,7 @@ int acl_parse_nothing(const char **text, struct acl_pattern *pattern, int *opaqu
|
||||
|
||||
/* always fake a data retrieval */
|
||||
int acl_fetch_nothing(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -1733,7 +1733,7 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v
|
||||
/* we need to reset context and flags */
|
||||
memset(&smp, 0, sizeof(smp));
|
||||
fetch_next:
|
||||
if (!expr->kw->fetch(px, l4, l7, dir, expr, &smp)) {
|
||||
if (!expr->kw->fetch(px, l4, l7, dir, expr->args, &smp)) {
|
||||
/* maybe we could not fetch because of missing data */
|
||||
if (smp.flags & SMP_F_MAY_CHANGE && dir & ACL_PARTIAL)
|
||||
acl_res |= ACL_PAT_MISS;
|
||||
|
@ -1375,11 +1375,11 @@ int backend_parse_balance(const char **args, char *err, int errlen, struct proxy
|
||||
*/
|
||||
static int
|
||||
acl_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
|
||||
if (px->srv_act)
|
||||
smp->data.uint = px->srv_act;
|
||||
@ -1398,9 +1398,9 @@ acl_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct server *srv = expr->args->data.srv;
|
||||
struct server *srv = args->data.srv;
|
||||
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_BOOL;
|
||||
@ -1418,7 +1418,7 @@ acl_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct server *iterator;
|
||||
|
||||
@ -1426,7 +1426,7 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = 0;
|
||||
|
||||
for (iterator = expr->args->data.prx->srv; iterator; iterator = iterator->next) {
|
||||
for (iterator = args->data.prx->srv; iterator; iterator = iterator->next) {
|
||||
if ((iterator->state & SRV_RUNNING) == 0)
|
||||
continue;
|
||||
|
||||
@ -1446,7 +1446,7 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the id of the backend */
|
||||
static int
|
||||
acl_fetch_be_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TXN;
|
||||
smp->type = SMP_T_UINT;
|
||||
@ -1457,7 +1457,7 @@ acl_fetch_be_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the id of the server */
|
||||
static int
|
||||
acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!target_srv(&l4->target))
|
||||
return 0;
|
||||
@ -1474,11 +1474,11 @@ acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = read_freq_ctr(&expr->args->data.prx->be_sess_per_sec);
|
||||
smp->data.uint = read_freq_ctr(&args->data.prx->be_sess_per_sec);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1488,11 +1488,11 @@ acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = expr->args->data.prx->beconn;
|
||||
smp->data.uint = args->data.prx->beconn;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1502,11 +1502,11 @@ acl_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = expr->args->data.prx->totpend;
|
||||
smp->data.uint = args->data.prx->totpend;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1520,13 +1520,13 @@ acl_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int nbsrv;
|
||||
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
|
||||
if (px->srv_act)
|
||||
nbsrv = px->srv_act;
|
||||
@ -1549,11 +1549,11 @@ acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = expr->args->data.srv->cur_sess;
|
||||
smp->data.uint = args->data.srv->cur_sess;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ int make_proxy_line(char *buf, int buf_len, struct sockaddr_storage *src, struct
|
||||
/* set temp integer to the id of the frontend */
|
||||
static int
|
||||
acl_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_SESS;
|
||||
smp->type = SMP_T_UINT;
|
||||
@ -514,11 +514,11 @@ acl_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = read_freq_ctr(&expr->args->data.prx->fe_sess_per_sec);
|
||||
smp->data.uint = read_freq_ctr(&args->data.prx->fe_sess_per_sec);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -528,11 +528,11 @@ acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = expr->args->data.prx->feconn;
|
||||
smp->data.uint = args->data.prx->feconn;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -7532,7 +7532,8 @@ req_error_parsing:
|
||||
/* This function ensures that the prerequisites for an L7 fetch are ready,
|
||||
* which means that a request or response is ready. If some data is missing,
|
||||
* a parsing attempt is made. This is useful in TCP-based ACLs which are able
|
||||
* to extract data from L7.
|
||||
* to extract data from L7. If <req_vol> is non-null during a request prefetch,
|
||||
* another test is made to ensure the required information is not gone.
|
||||
*
|
||||
* The function returns :
|
||||
* 0 if some data is missing or if the requested data cannot be fetched
|
||||
@ -7541,7 +7542,7 @@ req_error_parsing:
|
||||
*/
|
||||
static int
|
||||
acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp, int req_vol)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct http_msg *msg = &txn->req;
|
||||
@ -7556,7 +7557,7 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
/* Check for a dependency on a request */
|
||||
smp->type = SMP_T_BOOL;
|
||||
|
||||
if (expr->kw->requires & ACL_USE_L7REQ_ANY) {
|
||||
if ((dir & ACL_DIR_MASK) == ACL_DIR_REQ) {
|
||||
if (unlikely(!s->req))
|
||||
return 0;
|
||||
|
||||
@ -7595,15 +7596,13 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
}
|
||||
}
|
||||
|
||||
if ((expr->kw->requires & ACL_USE_L7REQ_VOLATILE) &&
|
||||
txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
|
||||
if (req_vol && txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
|
||||
return 0; /* data might have moved and indexes changed */
|
||||
|
||||
/* otherwise everything's ready for the request */
|
||||
}
|
||||
|
||||
/* Check for a dependency on a response */
|
||||
if (expr->kw->requires & ACL_USE_L7RTR_ANY) {
|
||||
else {
|
||||
/* Check for a dependency on a response */
|
||||
if (txn->rsp.msg_state < HTTP_MSG_BODY)
|
||||
return 0;
|
||||
}
|
||||
@ -7613,7 +7612,10 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
}
|
||||
|
||||
#define CHECK_HTTP_MESSAGE_FIRST() \
|
||||
do { int r = acl_prefetch_http(px, l4, l7, dir, expr, smp); if (r <= 0) return r; } while (0)
|
||||
do { int r = acl_prefetch_http(px, l4, l7, dir, args, smp, 1); if (r <= 0) return r; } while (0)
|
||||
|
||||
#define CHECK_HTTP_MESSAGE_FIRST_PERM() \
|
||||
do { int r = acl_prefetch_http(px, l4, l7, dir, args, smp, 0); if (r <= 0) return r; } while (0)
|
||||
|
||||
|
||||
/* 1. Check on METHOD
|
||||
@ -7647,12 +7649,12 @@ static int acl_parse_meth(const char **text, struct acl_pattern *pattern, int *o
|
||||
*/
|
||||
static int
|
||||
acl_fetch_meth(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int meth;
|
||||
struct http_txn *txn = l7;
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
CHECK_HTTP_MESSAGE_FIRST_PERM();
|
||||
|
||||
meth = txn->meth;
|
||||
smp->type = SMP_T_UINT;
|
||||
@ -7711,7 +7713,7 @@ static int acl_parse_ver(const char **text, struct acl_pattern *pattern, int *op
|
||||
|
||||
static int
|
||||
acl_fetch_rqver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr;
|
||||
@ -7736,7 +7738,7 @@ acl_fetch_rqver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
static int
|
||||
acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr;
|
||||
@ -7762,7 +7764,7 @@ acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* 3. Check on Status Code. We manipulate integers here. */
|
||||
static int
|
||||
acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr;
|
||||
@ -7782,7 +7784,7 @@ acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* 4. Check on URL/URI. A pointer to the URI is stored. */
|
||||
static int
|
||||
acl_fetch_url(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
|
||||
@ -7797,7 +7799,7 @@ acl_fetch_url(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
static int
|
||||
acl_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
|
||||
@ -7823,7 +7825,7 @@ acl_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
static int
|
||||
acl_fetch_url_port(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
|
||||
@ -7846,14 +7848,14 @@ acl_fetch_url_port(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
struct hdr_ctx *ctx = (struct hdr_ctx *)smp->ctx.a;
|
||||
const struct http_msg *msg = ((dir & ACL_DIR_MASK) == ACL_DIR_REQ) ? &txn->req : &txn->rsp;
|
||||
|
||||
if (!expr->args || expr->args->type != ARGT_STR)
|
||||
if (!args || args->type != ARGT_STR)
|
||||
return 0;
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
@ -7862,7 +7864,7 @@ acl_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* search for header from the beginning */
|
||||
ctx->idx = 0;
|
||||
|
||||
if (http_find_header2(expr->args->data.str.str, expr->args->data.str.len, msg->buf->p + msg->sol, idx, ctx)) {
|
||||
if (http_find_header2(args->data.str.str, args->data.str.len, msg->buf->p + msg->sol, idx, ctx)) {
|
||||
smp->flags |= SMP_F_NOT_LAST;
|
||||
smp->flags |= SMP_F_VOL_HDR;
|
||||
smp->type = SMP_T_CSTR;
|
||||
@ -7882,7 +7884,7 @@ acl_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
@ -7890,14 +7892,14 @@ acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
const struct http_msg *msg = ((dir & ACL_DIR_MASK) == ACL_DIR_REQ) ? &txn->req : &txn->rsp;
|
||||
int cnt;
|
||||
|
||||
if (!expr->args || expr->args->type != ARGT_STR)
|
||||
if (!args || args->type != ARGT_STR)
|
||||
return 0;
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
|
||||
ctx.idx = 0;
|
||||
cnt = 0;
|
||||
while (http_find_header2(expr->args->data.str.str, expr->args->data.str.len, msg->buf->p + msg->sol, idx, &ctx))
|
||||
while (http_find_header2(args->data.str.str, args->data.str.len, msg->buf->p + msg->sol, idx, &ctx))
|
||||
cnt++;
|
||||
|
||||
smp->type = SMP_T_UINT;
|
||||
@ -7911,9 +7913,9 @@ acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp);
|
||||
int ret = acl_fetch_hdr(px, l4, l7, dir, args, smp);
|
||||
|
||||
if (ret > 0) {
|
||||
smp->type = SMP_T_UINT;
|
||||
@ -7927,11 +7929,11 @@ acl_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
while ((ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp)) > 0) {
|
||||
while ((ret = acl_fetch_hdr(px, l4, l7, dir, args, smp)) > 0) {
|
||||
smp->type = SMP_T_IPV4;
|
||||
if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4))
|
||||
break;
|
||||
@ -7945,7 +7947,7 @@ acl_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_path(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr, *end;
|
||||
@ -7971,13 +7973,13 @@ acl_fetch_path(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
static int
|
||||
acl_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
/* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged
|
||||
* as a layer7 ACL, which involves automatic allocation of hdr_idx.
|
||||
*/
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
CHECK_HTTP_MESSAGE_FIRST_PERM();
|
||||
|
||||
smp->type = SMP_T_BOOL;
|
||||
smp->data.uint = 1;
|
||||
@ -7987,7 +7989,7 @@ acl_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* return a valid test if the current request is the first one on the connection */
|
||||
static int
|
||||
acl_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!s)
|
||||
return 0;
|
||||
@ -8000,10 +8002,10 @@ acl_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
/* Accepts exactly 1 argument of type userlist */
|
||||
static int
|
||||
acl_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
|
||||
if (!expr->args || expr->args->type != ARGT_USR)
|
||||
if (!args || args->type != ARGT_USR)
|
||||
return 0;
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
@ -8012,7 +8014,7 @@ acl_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
smp->type = SMP_T_BOOL;
|
||||
smp->data.uint = check_user(expr->args->data.usr, 0, l4->txn.auth.user, l4->txn.auth.pass);
|
||||
smp->data.uint = check_user(args->data.usr, 0, l4->txn.auth.user, l4->txn.auth.pass);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -8115,12 +8117,12 @@ extract_cookie_value(char *hdr, const char *hdr_end,
|
||||
* smp->ctx.a[0] for the in-header position, smp->ctx.a[1] for the
|
||||
* end-of-header-value, and smp->ctx.a[2] for the hdr_idx. Depending on
|
||||
* the direction, multiple cookies may be parsed on the same line or not.
|
||||
* The cookie name is in expr->arg and the name length in expr->args->data.str.len.
|
||||
* The cookie name is in args and the name length in args->data.str.len.
|
||||
* Accepts exactly 1 argument of type string.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
@ -8130,7 +8132,7 @@ acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
int hdr_name_len;
|
||||
char *sol;
|
||||
|
||||
if (!expr->args || expr->args->type != ARGT_STR)
|
||||
if (!args || args->type != ARGT_STR)
|
||||
return 0;
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
@ -8160,7 +8162,7 @@ acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!http_find_header2(hdr_name, hdr_name_len, sol, idx, ctx))
|
||||
goto out;
|
||||
|
||||
if (ctx->vlen < expr->args->data.str.len + 1)
|
||||
if (ctx->vlen < args->data.str.len + 1)
|
||||
continue;
|
||||
|
||||
smp->ctx.a[0] = ctx->line + ctx->val;
|
||||
@ -8169,7 +8171,7 @@ acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
smp->type = SMP_T_CSTR;
|
||||
smp->ctx.a[0] = extract_cookie_value(smp->ctx.a[0], smp->ctx.a[1],
|
||||
expr->args->data.str.str, expr->args->data.str.len,
|
||||
args->data.str.str, args->data.str.len,
|
||||
(dir & ACL_DIR_MASK) == ACL_DIR_REQ,
|
||||
&smp->data.str.str,
|
||||
&smp->data.str.len);
|
||||
@ -8188,13 +8190,13 @@ acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
}
|
||||
|
||||
/* Iterate over all cookies present in a request to count how many occurrences
|
||||
* match the name in expr->arg and expr->args->data.str.len. If <multi> is non-null, then
|
||||
* match the name in args and args->data.str.len. If <multi> is non-null, then
|
||||
* multiple cookies may be parsed on the same line.
|
||||
* Accepts exactly 1 argument of type string.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
@ -8206,7 +8208,7 @@ acl_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
char *val_beg, *val_end;
|
||||
char *sol;
|
||||
|
||||
if (!expr->args || expr->args->type != ARGT_STR)
|
||||
if (!args || args->type != ARGT_STR)
|
||||
return 0;
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
@ -8232,7 +8234,7 @@ acl_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!http_find_header2(hdr_name, hdr_name_len, sol, idx, &ctx))
|
||||
break;
|
||||
|
||||
if (ctx.vlen < expr->args->data.str.len + 1)
|
||||
if (ctx.vlen < args->data.str.len + 1)
|
||||
continue;
|
||||
|
||||
val_beg = ctx.line + ctx.val;
|
||||
@ -8241,7 +8243,7 @@ acl_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
smp->type = SMP_T_CSTR;
|
||||
while ((val_beg = extract_cookie_value(val_beg, val_end,
|
||||
expr->args->data.str.str, expr->args->data.str.len,
|
||||
args->data.str.str, args->data.str.len,
|
||||
(dir & ACL_DIR_MASK) == ACL_DIR_REQ,
|
||||
&smp->data.str.str,
|
||||
&smp->data.str.len))) {
|
||||
|
@ -1363,19 +1363,19 @@ pattern_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
|
||||
static int
|
||||
acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
return smp_fetch_rdp_cookie(px, l4, l7, dir, expr->args, smp);
|
||||
return smp_fetch_rdp_cookie(px, l4, l7, dir, args, smp);
|
||||
}
|
||||
|
||||
/* returns either 1 or 0 depending on whether an RDP cookie is found or not */
|
||||
static int
|
||||
acl_fetch_rdp_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = smp_fetch_rdp_cookie(px, l4, l7, dir, expr->args, smp);
|
||||
ret = smp_fetch_rdp_cookie(px, l4, l7, dir, args, smp);
|
||||
|
||||
if (smp->flags & SMP_F_MAY_CHANGE)
|
||||
return 0;
|
||||
@ -1390,7 +1390,7 @@ acl_fetch_rdp_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
/* copy the source IPv4/v6 address into temp_pattern */
|
||||
static int
|
||||
acl_fetch_src(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
switch (l4->si[0].addr.from.ss_family) {
|
||||
case AF_INET:
|
||||
@ -1438,7 +1438,7 @@ pattern_fetch_src6(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the connection's source port */
|
||||
static int
|
||||
acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->type = SMP_T_UINT;
|
||||
if (!(smp->data.uint = get_host_port(&l4->si[0].addr.from)))
|
||||
@ -1452,7 +1452,7 @@ acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set test->ptr to point to the frontend's IPv4/IPv6 address and test->i to the family */
|
||||
static int
|
||||
acl_fetch_dst(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
stream_sock_get_to_addr(&l4->si[0]);
|
||||
|
||||
@ -1507,7 +1507,7 @@ pattern_fetch_dst6(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the frontend connexion's destination port */
|
||||
static int
|
||||
acl_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
stream_sock_get_to_addr(&l4->si[0]);
|
||||
|
||||
|
@ -326,7 +326,7 @@ int protocol_disable_all(void)
|
||||
/* set temp integer to the number of connexions to the same listening socket */
|
||||
static int
|
||||
acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = l4->listener->nbconn;
|
||||
@ -336,7 +336,7 @@ acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the id of the socket (listener) */
|
||||
static int
|
||||
acl_fetch_so_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = l4->listener->luid;
|
||||
|
140
src/session.c
140
src/session.c
@ -2327,7 +2327,7 @@ acl_fetch_get_gpc0(struct stktable *table, struct sample *smp, struct stksess *t
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2339,7 +2339,7 @@ acl_fetch_sc1_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2352,7 +2352,7 @@ acl_fetch_sc2_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2360,7 +2360,7 @@ acl_fetch_src_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_get_gpc0(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2387,7 +2387,7 @@ acl_fetch_inc_gpc0(struct stktable *table, struct sample *smp, struct stksess *t
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2399,7 +2399,7 @@ acl_fetch_sc1_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2412,7 +2412,7 @@ acl_fetch_sc2_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2420,7 +2420,7 @@ acl_fetch_src_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_inc_gpc0(&px->table, smp, stktable_update_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2448,7 +2448,7 @@ acl_fetch_clr_gpc0(struct stktable *table, struct sample *smp, struct stksess *t
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2460,7 +2460,7 @@ acl_fetch_sc1_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2473,7 +2473,7 @@ acl_fetch_sc2_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2481,7 +2481,7 @@ acl_fetch_src_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_clr_gpc0(&px->table, smp, stktable_update_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2504,7 +2504,7 @@ acl_fetch_conn_cnt(struct stktable *table, struct sample *smp, struct stksess *t
|
||||
/* set temp integer to the cumulated number of connections from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2515,7 +2515,7 @@ acl_fetch_sc1_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the cumulated number of connections from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2529,7 +2529,7 @@ acl_fetch_sc2_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2537,7 +2537,7 @@ acl_fetch_src_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_conn_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2563,7 +2563,7 @@ acl_fetch_conn_rate(struct stktable *table, struct sample *smp, struct stksess *
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2576,7 +2576,7 @@ acl_fetch_sc1_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2590,7 +2590,7 @@ acl_fetch_sc2_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2598,7 +2598,7 @@ acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_conn_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2608,7 +2608,7 @@ acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stksess *ts;
|
||||
struct stktable_key *key;
|
||||
@ -2618,7 +2618,7 @@ acl_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, int
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
|
||||
if ((ts = stktable_update_key(&px->table, key)) == NULL)
|
||||
/* entry does not exist and could not be created */
|
||||
@ -2654,7 +2654,7 @@ acl_fetch_conn_cur(struct stktable *table, struct sample *smp, struct stksess *t
|
||||
/* set temp integer to the number of concurrent connections from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2665,7 +2665,7 @@ acl_fetch_sc1_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the number of concurrent connections from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2679,7 +2679,7 @@ acl_fetch_sc2_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2687,7 +2687,7 @@ acl_fetch_src_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_conn_cur(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2710,7 +2710,7 @@ acl_fetch_sess_cnt(struct stktable *table, struct sample *smp, struct stksess *t
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2721,7 +2721,7 @@ acl_fetch_sc1_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2735,7 +2735,7 @@ acl_fetch_sc2_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2743,7 +2743,7 @@ acl_fetch_src_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_sess_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2769,7 +2769,7 @@ acl_fetch_sess_rate(struct stktable *table, struct sample *smp, struct stksess *
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2782,7 +2782,7 @@ acl_fetch_sc1_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2796,7 +2796,7 @@ acl_fetch_sc2_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2804,7 +2804,7 @@ acl_fetch_src_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_sess_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2827,7 +2827,7 @@ acl_fetch_http_req_cnt(struct stktable *table, struct sample *smp, struct stkses
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2838,7 +2838,7 @@ acl_fetch_sc1_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2852,7 +2852,7 @@ acl_fetch_sc2_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2860,7 +2860,7 @@ acl_fetch_src_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_http_req_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2886,7 +2886,7 @@ acl_fetch_http_req_rate(struct stktable *table, struct sample *smp, struct stkse
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2899,7 +2899,7 @@ acl_fetch_sc1_http_req_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2913,7 +2913,7 @@ acl_fetch_sc2_http_req_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2921,7 +2921,7 @@ acl_fetch_src_http_req_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_http_req_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -2944,7 +2944,7 @@ acl_fetch_http_err_cnt(struct stktable *table, struct sample *smp, struct stkses
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -2955,7 +2955,7 @@ acl_fetch_sc1_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -2969,7 +2969,7 @@ acl_fetch_sc2_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2977,7 +2977,7 @@ acl_fetch_src_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_http_err_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -3003,7 +3003,7 @@ acl_fetch_http_err_rate(struct stktable *table, struct sample *smp, struct stkse
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -3016,7 +3016,7 @@ acl_fetch_sc1_http_err_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -3030,7 +3030,7 @@ acl_fetch_sc2_http_err_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3038,7 +3038,7 @@ acl_fetch_src_http_err_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_http_err_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -3064,7 +3064,7 @@ acl_fetch_kbytes_in(struct stktable *table, struct sample *smp, struct stksess *
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -3077,7 +3077,7 @@ acl_fetch_sc1_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -3091,7 +3091,7 @@ acl_fetch_sc2_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3099,7 +3099,7 @@ acl_fetch_src_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_kbytes_in(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -3127,7 +3127,7 @@ acl_fetch_bytes_in_rate(struct stktable *table, struct sample *smp, struct stkse
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -3140,7 +3140,7 @@ acl_fetch_sc1_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -3154,7 +3154,7 @@ acl_fetch_sc2_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3162,7 +3162,7 @@ acl_fetch_src_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_bytes_in_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -3188,7 +3188,7 @@ acl_fetch_kbytes_out(struct stktable *table, struct sample *smp, struct stksess
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -3201,7 +3201,7 @@ acl_fetch_sc1_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -3215,7 +3215,7 @@ acl_fetch_sc2_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3223,7 +3223,7 @@ acl_fetch_src_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_kbytes_out(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -3251,7 +3251,7 @@ acl_fetch_bytes_out_rate(struct stktable *table, struct sample *smp, struct stks
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
@ -3264,7 +3264,7 @@ acl_fetch_sc1_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
@ -3278,7 +3278,7 @@ acl_fetch_sc2_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3286,7 +3286,7 @@ acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
return acl_fetch_bytes_out_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
@ -3295,11 +3295,11 @@ acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = expr->args->data.prx->table.current;
|
||||
smp->data.uint = args->data.prx->table.current;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -3308,9 +3308,9 @@ acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
const struct arg *args, struct sample *smp)
|
||||
{
|
||||
px = expr->args->data.prx;
|
||||
px = args->data.prx;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
smp->type = SMP_T_UINT;
|
||||
smp->data.uint = px->table.size - px->table.current;
|
||||
|
Loading…
Reference in New Issue
Block a user