From db5252e90d0b6f4b885d3cc33beeb387e3b044ec Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 16 Dec 2011 17:06:15 +0100 Subject: MEDIUM: acl: use temp_pattern to store any integer-type information All ACL fetches which return integer value now store the result into the temporary pattern struct. All ACL matches which rely on integer also get their value there. Note: the pattern data types are not set right now. --- src/acl.c | 12 ++-- src/backend.c | 51 +++++++------- src/frontend.c | 14 ++-- src/proto_http.c | 8 +- src/proto_tcp.c | 8 +- src/protocols.c | 10 +-- src/session.c | 204 +++++++++++++++++++++++++++--------------------------- 7 files changed, 151 insertions(+), 156 deletions(-) diff --git a/src/acl.c b/src/acl.c index f0966a5..3ea2470 100644 --- a/src/acl.c +++ b/src/acl.c @@ -102,7 +102,7 @@ acl_fetch_req_len(struct proxy *px, struct session *l4, void *l7, int dir, if (!l4 || !l4->req) return 0; - test->i = l4->req->l; + temp_pattern.data.integer = l4->req->l; test->flags = ACL_TEST_F_VOLATILE | ACL_TEST_F_MAY_CHANGE; return 1; } @@ -155,7 +155,7 @@ acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, int dir goto not_ssl_hello; } - test->i = hs_type; + temp_pattern.data.integer = hs_type; test->flags = ACL_TEST_F_VOLATILE; return 1; @@ -268,7 +268,7 @@ acl_fetch_req_ssl_ver(struct proxy *px, struct session *l4, void *l7, int dir, /* OK that's enough. We have at least the whole message, and we have * the protocol version. */ - test->i = version; + temp_pattern.data.integer = version; test->flags = ACL_TEST_F_VOLATILE; return 1; @@ -552,7 +552,7 @@ acl_fetch_rdp_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir return 0; test->flags = ACL_TEST_F_VOLATILE; - test->i = ret; + temp_pattern.data.integer = ret; return 1; } @@ -813,8 +813,8 @@ int acl_match_dom(struct acl_test *test, struct acl_pattern *pattern) /* Checks that the integer in is included between min and max */ int acl_match_int(struct acl_test *test, struct acl_pattern *pattern) { - if ((!pattern->val.range.min_set || pattern->val.range.min <= test->i) && - (!pattern->val.range.max_set || test->i <= pattern->val.range.max)) + if ((!pattern->val.range.min_set || pattern->val.range.min <= temp_pattern.data.integer) && + (!pattern->val.range.max_set || temp_pattern.data.integer <= pattern->val.range.max)) return ACL_PAT_PASS; return ACL_PAT_FAIL; } diff --git a/src/backend.c b/src/backend.c index 6a12cf4..0f3bccd 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1340,7 +1340,7 @@ int backend_parse_balance(const char **args, char *err, int errlen, struct proxy /* All supported keywords must be declared here. */ /************************************************************************/ -/* set test->i to the number of enabled servers on the proxy */ +/* set temp integer to the number of enabled servers on the proxy */ static int acl_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -1356,11 +1356,11 @@ acl_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, int dir, return 0; if (px->srv_act) - test->i = px->srv_act; + temp_pattern.data.integer = px->srv_act; else if (px->lbprm.fbck) - test->i = 1; + temp_pattern.data.integer = 1; else - test->i = px->srv_bck; + temp_pattern.data.integer = px->srv_bck; return 1; } @@ -1383,7 +1383,7 @@ acl_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, int dir, return 1; } -/* set test->i to the number of enabled servers on the proxy */ +/* set temp integer to the number of enabled servers on the proxy */ static int acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -1399,7 +1399,7 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir, if (!px) return 0; - test->i = 0; + temp_pattern.data.integer = 0; iterator = px->srv; while (iterator) { if ((iterator->state & SRV_RUNNING) == 0) { @@ -1407,31 +1407,31 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir, continue; } if (iterator->maxconn == 0 || iterator->maxqueue == 0) { - test->i = -1; + /* configuration is stupid */ + temp_pattern.data.integer = -1; return 1; } - test->i += (iterator->maxconn - iterator->cur_sess) - + (iterator->maxqueue - iterator->nbpend); + temp_pattern.data.integer += (iterator->maxconn - iterator->cur_sess) + + (iterator->maxqueue - iterator->nbpend); iterator = iterator->next; } return 1; } -/* set test->i to the id of the backend */ +/* 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 acl_test *test) { test->flags = ACL_TEST_F_READ_ONLY; - - test->i = l4->be->uuid; + temp_pattern.data.integer = l4->be->uuid; return 1; } -/* set test->i to the id of the server */ +/* 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 acl_test *test) { @@ -1440,13 +1440,12 @@ acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir, return 0; test->flags = ACL_TEST_F_READ_ONLY; - - test->i = target_srv(&l4->target)->puid; + temp_pattern.data.integer = target_srv(&l4->target)->puid; return 1; } -/* set test->i to the number of connections per second reaching the backend */ +/* set temp integer to the number of connections per second reaching the backend */ static int acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -1461,11 +1460,11 @@ acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, if (!px) return 0; - test->i = read_freq_ctr(&px->be_sess_per_sec); + temp_pattern.data.integer = read_freq_ctr(&px->be_sess_per_sec); return 1; } -/* set test->i to the number of concurrent connections on the backend */ +/* set temp integer to the number of concurrent connections on the backend */ static int acl_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -1480,11 +1479,11 @@ acl_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, int dir, if (!px) return 0; - test->i = px->beconn; + temp_pattern.data.integer = px->beconn; return 1; } -/* set test->i to the total number of queued connections on the backend */ +/* set temp integer to the total number of queued connections on the backend */ static int acl_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -1499,11 +1498,11 @@ acl_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, int dir, if (!px) return 0; - test->i = px->totpend; + temp_pattern.data.integer = px->totpend; return 1; } -/* set test->i to the total number of queued connections on the backend divided +/* set temp integer to the total number of queued connections on the backend divided * by the number of running servers and rounded up. If there is no running * server, we return twice the total, just as if we had half a running server. * This is more or less correct anyway, since we expect the last server to come @@ -1533,21 +1532,21 @@ acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir nbsrv = px->srv_bck; if (nbsrv > 0) - test->i = (px->totpend + nbsrv - 1) / nbsrv; + temp_pattern.data.integer = (px->totpend + nbsrv - 1) / nbsrv; else - test->i = px->totpend * 2; + temp_pattern.data.integer = px->totpend * 2; return 1; } -/* set test->i to the number of concurrent connections on the server in the backend */ +/* set temp integer to the number of concurrent connections on the server in the backend */ static int acl_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) { struct server *srv = expr->arg.srv; - test->i = srv->cur_sess; + temp_pattern.data.integer = srv->cur_sess; return 1; } diff --git a/src/frontend.c b/src/frontend.c index a32018c..f185f62 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -514,19 +514,17 @@ int make_proxy_line(char *buf, int buf_len, struct sockaddr_storage *src, struct return ret; } -/* set test->i to the id of the frontend */ +/* 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 acl_test *test) { test->flags = ACL_TEST_F_READ_ONLY; - - test->i = l4->fe->uuid; - + temp_pattern.data.integer = l4->fe->uuid; return 1; } -/* set test->i to the number of connections per second reaching the frontend */ +/* set temp integer to the number of connections per second reaching the frontend */ static int acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -541,11 +539,11 @@ acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, if (!px) return 0; - test->i = read_freq_ctr(&px->fe_sess_per_sec); + temp_pattern.data.integer = read_freq_ctr(&px->fe_sess_per_sec); return 1; } -/* set test->i to the number of concurrent connections on the frontend */ +/* set temp integer to the number of concurrent connections on the frontend */ static int acl_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -560,7 +558,7 @@ acl_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, int dir, if (!px) return 0; - test->i = px->feconn; + temp_pattern.data.integer = px->feconn; return 1; } diff --git a/src/proto_http.c b/src/proto_http.c index f45c514..133d916 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -7919,7 +7919,7 @@ acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir, len = txn->rsp.sl.st.c_l; ptr = txn->rsp.sol + txn->rsp.sl.st.c; - test->i = __strl2ui(ptr, len); + temp_pattern.data.integer = __strl2ui(ptr, len); test->flags = ACL_TEST_F_VOL_1ST; return 1; } @@ -7999,7 +7999,7 @@ acl_fetch_url_port(struct proxy *px, struct session *l4, void *l7, int dir, /* Same optimization as url_ip */ url2sa(txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to); - test->i = ntohs(((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_port); + temp_pattern.data.integer = ntohs(((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_port); if (px->options & PR_O_HTTP_PROXY) l4->flags |= SN_ADDR_SET; @@ -8093,7 +8093,7 @@ acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, char *sol, while (http_find_header2(expr->arg.str, expr->arg_len, sol, idx, &ctx)) cnt++; - test->i = cnt; + temp_pattern.data.integer = cnt; test->flags = ACL_TEST_F_VOL_HDR; return 1; } @@ -8154,7 +8154,7 @@ acl_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, char *sol, if (http_find_header2(expr->arg.str, expr->arg_len, sol, idx, ctx)) { test->flags |= ACL_TEST_F_FETCH_MORE; test->flags |= ACL_TEST_F_VOL_HDR; - test->i = strl2ic((char *)ctx->line + ctx->val, ctx->vlen); + temp_pattern.data.integer = strl2ic((char *)ctx->line + ctx->val, ctx->vlen); return 1; } diff --git a/src/proto_tcp.c b/src/proto_tcp.c index caeb539..9331fdc 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -1286,12 +1286,12 @@ pattern_fetch_src6(struct proxy *px, struct session *l4, void *l7, int dir, return 1; } -/* set test->i to the connection's source port */ +/* 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 acl_test *test) { - if (!(test->i = get_host_port(&l4->si[0].addr.from))) + if (!(temp_pattern.data.integer = get_host_port(&l4->si[0].addr.from))) return 0; test->flags = 0; @@ -1350,7 +1350,7 @@ pattern_fetch_dst6(struct proxy *px, struct session *l4, void *l7, int dir, return 1; } -/* set test->i to the frontend connexion's destination port */ +/* 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 acl_test *test) @@ -1358,7 +1358,7 @@ acl_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir, if (!(l4->flags & SN_FRT_ADDR_SET)) get_frt_addr(l4); - if (!(test->i = get_host_port(&l4->si[0].addr.to))) + if (!(temp_pattern.data.integer = get_host_port(&l4->si[0].addr.to))) return 0; test->flags = 0; diff --git a/src/protocols.c b/src/protocols.c index 46c41f6..92f2c67 100644 --- a/src/protocols.c +++ b/src/protocols.c @@ -323,24 +323,22 @@ int protocol_disable_all(void) /* All supported ACL keywords must be declared here. */ /************************************************************************/ -/* set test->i to the number of connexions to the same listening socket */ +/* 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 acl_test *test) { - test->i = l4->listener->nbconn; + temp_pattern.data.integer = l4->listener->nbconn; return 1; } -/* set test->i to the id of the socket (listener) */ +/* 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 acl_test *test) { test->flags = ACL_TEST_F_READ_ONLY; - - test->i = l4->listener->luid; - + temp_pattern.data.integer = l4->listener->luid; return 1; } diff --git a/src/session.c b/src/session.c index dbef9ee..c465990 100644 --- a/src/session.c +++ b/src/session.c @@ -2232,22 +2232,22 @@ void session_shutdown(struct session *session, int why) /* All supported ACL keywords must be declared here. */ /************************************************************************/ -/* set test->i to the General Purpose Counter 0 value in the stksess entry */ +/* set temp integer to the General Purpose Counter 0 value in the stksess entry */ static int acl_fetch_get_gpc0(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, gpc0); + temp_pattern.data.integer = stktable_data_cast(ptr, gpc0); } return 1; } -/* set test->i to the General Purpose Counter 0 value from the session's tracked +/* set temp integer to the General Purpose Counter 0 value from the session's tracked * frontend counters. */ static int @@ -2259,7 +2259,7 @@ acl_fetch_sc1_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_get_gpc0(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the General Purpose Counter 0 value from the session's tracked +/* set temp integer to the General Purpose Counter 0 value from the session's tracked * backend counters. */ static int @@ -2271,7 +2271,7 @@ acl_fetch_sc2_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_get_gpc0(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the General Purpose Counter 0 value from the session's source +/* set temp integer to the General Purpose Counter 0 value from the session's source * address in the table pointed to by expr. */ static int @@ -2294,24 +2294,24 @@ acl_fetch_src_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, } /* Increment the General Purpose Counter 0 value in the stksess entry and - * return it into test->i. + * return it into temp integer. */ static int acl_fetch_inc_gpc0(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0); if (!ptr) return 0; /* parameter not stored */ - test->i = ++stktable_data_cast(ptr, gpc0); + temp_pattern.data.integer = ++stktable_data_cast(ptr, gpc0); } return 1; } /* Increment the General Purpose Counter 0 value from the session's tracked - * frontend counters and return it into test->i. + * frontend counters and return it into temp integer. */ static int acl_fetch_sc1_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, @@ -2323,7 +2323,7 @@ acl_fetch_sc1_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, } /* Increment the General Purpose Counter 0 value from the session's tracked - * backend counters and return it into test->i. + * backend counters and return it into temp integer. */ static int acl_fetch_sc2_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, @@ -2335,7 +2335,7 @@ acl_fetch_sc2_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, } /* Increment the General Purpose Counter 0 value from the session's source - * address in the table pointed to by expr, and return it into test->i. + * address in the table pointed to by expr, and return it into temp integer. */ static int acl_fetch_src_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, @@ -2357,25 +2357,25 @@ acl_fetch_src_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, } /* Clear the General Purpose Counter 0 value in the stksess entry and - * return its previous value into test->i. + * return its previous value into temp integer. */ static int acl_fetch_clr_gpc0(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, gpc0); + temp_pattern.data.integer = stktable_data_cast(ptr, gpc0); stktable_data_cast(ptr, gpc0) = 0; } return 1; } /* Clear the General Purpose Counter 0 value from the session's tracked - * frontend counters and return its previous value into test->i. + * frontend counters and return its previous value into temp integer. */ static int acl_fetch_sc1_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, @@ -2387,7 +2387,7 @@ acl_fetch_sc1_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, } /* Clear the General Purpose Counter 0 value from the session's tracked - * backend counters and return its previous value into test->i. + * backend counters and return its previous value into temp integer. */ static int acl_fetch_sc2_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, @@ -2399,7 +2399,7 @@ acl_fetch_sc2_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, } /* Clear the General Purpose Counter 0 value from the session's source address - * in the table pointed to by expr, and return its previous value into test->i. + * in the table pointed to by expr, and return its previous value into temp integer. */ static int acl_fetch_src_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, @@ -2420,22 +2420,22 @@ acl_fetch_src_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_clr_gpc0(&px->table, test, stktable_update_key(&px->table, key)); } -/* set test->i to the cumulated number of connections in the stksess entry */ +/* set temp integer to the cumulated number of connections in the stksess entry */ static int acl_fetch_conn_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_CNT); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, conn_cnt); + temp_pattern.data.integer = stktable_data_cast(ptr, conn_cnt); } return 1; } -/* set test->i to the cumulated number of connections from the session's tracked FE counters */ +/* 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 acl_test *test) @@ -2446,7 +2446,7 @@ acl_fetch_sc1_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_cnt(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the cumulated number of connections from the session's tracked BE counters */ +/* 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 acl_test *test) @@ -2457,7 +2457,7 @@ acl_fetch_sc2_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_cnt(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the cumulated number of connections from the session's source +/* set temp integer to the cumulated number of connections from the session's source * address in the table pointed to by expr. */ static int @@ -2479,23 +2479,23 @@ acl_fetch_src_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_cnt(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the connection rate in the stksess entry over the configured period */ +/* set temp integer to the connection rate in the stksess entry over the configured period */ static int acl_fetch_conn_rate(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_RATE); if (!ptr) return 0; /* parameter not stored */ - test->i = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate), + temp_pattern.data.integer = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate), table->data_arg[STKTABLE_DT_CONN_RATE].u); } return 1; } -/* set test->i to the connection rate from the session's tracked FE counters over +/* set temp integer to the connection rate from the session's tracked FE counters over * the configured period. */ static int @@ -2508,7 +2508,7 @@ acl_fetch_sc1_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_rate(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the connection rate from the session's tracked BE counters over +/* set temp integer to the connection rate from the session's tracked BE counters over * the configured period. */ static int @@ -2521,7 +2521,7 @@ acl_fetch_sc2_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_rate(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the connection rate from the session's source address in the +/* set temp integer to the connection rate from the session's source address in the * table pointed to by expr, over the configured period. */ static int @@ -2543,7 +2543,7 @@ acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_rate(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the number of connections from the session's source address +/* set temp integer to the number of connections from the session's source address * in the table pointed to by expr, after updating it. */ static int @@ -2572,28 +2572,28 @@ acl_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, int if (!ptr) return 0; /* parameter not stored in this table */ - test->i = ++stktable_data_cast(ptr, conn_cnt); + temp_pattern.data.integer = ++stktable_data_cast(ptr, conn_cnt); test->flags = ACL_TEST_F_VOL_TEST; return 1; } -/* set test->i to the number of concurrent connections in the stksess entry */ +/* set temp integer to the number of concurrent connections in the stksess entry */ static int acl_fetch_conn_cur(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_CUR); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, conn_cur); + temp_pattern.data.integer = stktable_data_cast(ptr, conn_cur); } return 1; } -/* set test->i to the number of concurrent connections from the session's tracked FE counters */ +/* 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 acl_test *test) @@ -2604,7 +2604,7 @@ acl_fetch_sc1_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_cur(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the number of concurrent connections from the session's tracked BE counters */ +/* 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 acl_test *test) @@ -2615,7 +2615,7 @@ acl_fetch_sc2_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_cur(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the number of concurrent connections from the session's source +/* set temp integer to the number of concurrent connections from the session's source * address in the table pointed to by expr. */ static int @@ -2637,22 +2637,22 @@ acl_fetch_src_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_conn_cur(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the cumulated number of sessions in the stksess entry */ +/* set temp integer to the cumulated number of sessions in the stksess entry */ static int acl_fetch_sess_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_CNT); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, sess_cnt); + temp_pattern.data.integer = stktable_data_cast(ptr, sess_cnt); } return 1; } -/* set test->i to the cumulated number of sessions from the session's tracked FE counters */ +/* 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 acl_test *test) @@ -2663,7 +2663,7 @@ acl_fetch_sc1_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_sess_cnt(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the cumulated number of sessions from the session's tracked BE counters */ +/* 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 acl_test *test) @@ -2674,7 +2674,7 @@ acl_fetch_sc2_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_sess_cnt(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the cumulated number of session from the session's source +/* set temp integer to the cumulated number of session from the session's source * address in the table pointed to by expr. */ static int @@ -2696,23 +2696,23 @@ acl_fetch_src_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_sess_cnt(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the session rate in the stksess entry over the configured period */ +/* set temp integer to the session rate in the stksess entry over the configured period */ static int acl_fetch_sess_rate(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_RATE); if (!ptr) return 0; /* parameter not stored */ - test->i = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate), + temp_pattern.data.integer = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate), table->data_arg[STKTABLE_DT_SESS_RATE].u); } return 1; } -/* set test->i to the session rate from the session's tracked FE counters over +/* set temp integer to the session rate from the session's tracked FE counters over * the configured period. */ static int @@ -2725,7 +2725,7 @@ acl_fetch_sc1_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_sess_rate(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the session rate from the session's tracked BE counters over +/* set temp integer to the session rate from the session's tracked BE counters over * the configured period. */ static int @@ -2738,7 +2738,7 @@ acl_fetch_sc2_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_sess_rate(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the session rate from the session's source address in the +/* set temp integer to the session rate from the session's source address in the * table pointed to by expr, over the configured period. */ static int @@ -2760,22 +2760,22 @@ acl_fetch_src_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_sess_rate(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the cumulated number of sessions in the stksess entry */ +/* set temp integer to the cumulated number of sessions in the stksess entry */ static int acl_fetch_http_req_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_CNT); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, http_req_cnt); + temp_pattern.data.integer = stktable_data_cast(ptr, http_req_cnt); } return 1; } -/* set test->i to the cumulated number of sessions from the session's tracked FE counters */ +/* 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 acl_test *test) @@ -2786,7 +2786,7 @@ acl_fetch_sc1_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d return acl_fetch_http_req_cnt(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the cumulated number of sessions from the session's tracked BE counters */ +/* 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 acl_test *test) @@ -2797,7 +2797,7 @@ acl_fetch_sc2_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d return acl_fetch_http_req_cnt(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the cumulated number of session from the session's source +/* set temp integer to the cumulated number of session from the session's source * address in the table pointed to by expr. */ static int @@ -2819,23 +2819,23 @@ acl_fetch_src_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d return acl_fetch_http_req_cnt(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the session rate in the stksess entry over the configured period */ +/* set temp integer to the session rate in the stksess entry over the configured period */ static int acl_fetch_http_req_rate(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_RATE); if (!ptr) return 0; /* parameter not stored */ - test->i = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate), + temp_pattern.data.integer = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate), table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u); } return 1; } -/* set test->i to the session rate from the session's tracked FE counters over +/* set temp integer to the session rate from the session's tracked FE counters over * the configured period. */ static int @@ -2848,7 +2848,7 @@ acl_fetch_sc1_http_req_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_http_req_rate(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the session rate from the session's tracked BE counters over +/* set temp integer to the session rate from the session's tracked BE counters over * the configured period. */ static int @@ -2861,7 +2861,7 @@ acl_fetch_sc2_http_req_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_http_req_rate(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the session rate from the session's source address in the +/* set temp integer to the session rate from the session's source address in the * table pointed to by expr, over the configured period. */ static int @@ -2883,22 +2883,22 @@ acl_fetch_src_http_req_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_http_req_rate(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the cumulated number of sessions in the stksess entry */ +/* set temp integer to the cumulated number of sessions in the stksess entry */ static int acl_fetch_http_err_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_CNT); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, http_err_cnt); + temp_pattern.data.integer = stktable_data_cast(ptr, http_err_cnt); } return 1; } -/* set test->i to the cumulated number of sessions from the session's tracked FE counters */ +/* 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 acl_test *test) @@ -2909,7 +2909,7 @@ acl_fetch_sc1_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d return acl_fetch_http_err_cnt(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the cumulated number of sessions from the session's tracked BE counters */ +/* 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 acl_test *test) @@ -2920,7 +2920,7 @@ acl_fetch_sc2_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d return acl_fetch_http_err_cnt(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the cumulated number of session from the session's source +/* set temp integer to the cumulated number of session from the session's source * address in the table pointed to by expr. */ static int @@ -2942,23 +2942,23 @@ acl_fetch_src_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d return acl_fetch_http_err_cnt(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the session rate in the stksess entry over the configured period */ +/* set temp integer to the session rate in the stksess entry over the configured period */ static int acl_fetch_http_err_rate(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_RATE); if (!ptr) return 0; /* parameter not stored */ - test->i = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate), + temp_pattern.data.integer = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate), table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u); } return 1; } -/* set test->i to the session rate from the session's tracked FE counters over +/* set temp integer to the session rate from the session's tracked FE counters over * the configured period. */ static int @@ -2971,7 +2971,7 @@ acl_fetch_sc1_http_err_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_http_err_rate(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the session rate from the session's tracked BE counters over +/* set temp integer to the session rate from the session's tracked BE counters over * the configured period. */ static int @@ -2984,7 +2984,7 @@ acl_fetch_sc2_http_err_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_http_err_rate(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the session rate from the session's source address in the +/* set temp integer to the session rate from the session's source address in the * table pointed to by expr, over the configured period. */ static int @@ -3006,23 +3006,23 @@ acl_fetch_src_http_err_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_http_err_rate(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the number of kbytes received from clients matching the stksess entry */ +/* set temp integer to the number of kbytes received from clients matching the stksess entry */ static int acl_fetch_kbytes_in(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_IN_CNT); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, bytes_in_cnt) >> 10; + temp_pattern.data.integer = stktable_data_cast(ptr, bytes_in_cnt) >> 10; } return 1; } -/* set test->i to the number of kbytes received from clients according to the +/* set temp integer to the number of kbytes received from clients according to the * session's tracked FE counters. */ static int @@ -3035,7 +3035,7 @@ acl_fetch_sc1_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_kbytes_in(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the number of kbytes received from clients according to the +/* set temp integer to the number of kbytes received from clients according to the * session's tracked BE counters. */ static int @@ -3048,7 +3048,7 @@ acl_fetch_sc2_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_kbytes_in(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the number of kbytes received from the session's source +/* set temp integer to the number of kbytes received from the session's source * address in the table pointed to by expr. */ static int @@ -3070,25 +3070,25 @@ acl_fetch_src_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir, return acl_fetch_kbytes_in(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the bytes rate from clients in the stksess entry over the +/* set temp integer to the bytes rate from clients in the stksess entry over the * configured period. */ static int acl_fetch_bytes_in_rate(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_IN_RATE); if (!ptr) return 0; /* parameter not stored */ - test->i = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate), + temp_pattern.data.integer = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate), table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u); } return 1; } -/* set test->i to the bytes rate from clients from the session's tracked FE +/* set temp integer to the bytes rate from clients from the session's tracked FE * counters over the configured period. */ static int @@ -3101,7 +3101,7 @@ acl_fetch_sc1_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_bytes_in_rate(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the bytes rate from clients from the session's tracked BE +/* set temp integer to the bytes rate from clients from the session's tracked BE * counters over the configured period. */ static int @@ -3114,7 +3114,7 @@ acl_fetch_sc2_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_bytes_in_rate(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the bytes rate from clients from the session's source address +/* set temp integer to the bytes rate from clients from the session's source address * in the table pointed to by expr, over the configured period. */ static int @@ -3136,23 +3136,23 @@ acl_fetch_src_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_bytes_in_rate(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the number of kbytes sent to clients matching the stksess entry */ +/* set temp integer to the number of kbytes sent to clients matching the stksess entry */ static int acl_fetch_kbytes_out(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_OUT_CNT); if (!ptr) return 0; /* parameter not stored */ - test->i = stktable_data_cast(ptr, bytes_out_cnt) >> 10; + temp_pattern.data.integer = stktable_data_cast(ptr, bytes_out_cnt) >> 10; } return 1; } -/* set test->i to the number of kbytes sent to clients according to the session's +/* set temp integer to the number of kbytes sent to clients according to the session's * tracked FE counters. */ static int @@ -3165,7 +3165,7 @@ acl_fetch_sc1_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir return acl_fetch_kbytes_out(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the number of kbytes sent to clients according to the session's +/* set temp integer to the number of kbytes sent to clients according to the session's * tracked BE counters. */ static int @@ -3178,7 +3178,7 @@ acl_fetch_sc2_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir return acl_fetch_kbytes_out(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the number of kbytes sent to the session's source address in +/* set temp integer to the number of kbytes sent to the session's source address in * the table pointed to by expr. */ static int @@ -3200,25 +3200,25 @@ acl_fetch_src_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir return acl_fetch_kbytes_out(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the bytes rate to clients in the stksess entry over the +/* set temp integer to the bytes rate to clients in the stksess entry over the * configured period. */ static int acl_fetch_bytes_out_rate(struct stktable *table, struct acl_test *test, struct stksess *ts) { test->flags = ACL_TEST_F_VOL_TEST; - test->i = 0; + temp_pattern.data.integer = 0; if (ts != NULL) { void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_OUT_RATE); if (!ptr) return 0; /* parameter not stored */ - test->i = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate), + temp_pattern.data.integer = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate), table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u); } return 1; } -/* set test->i to the bytes rate to clients from the session's tracked FE counters +/* set temp integer to the bytes rate to clients from the session's tracked FE counters * over the configured period. */ static int @@ -3231,7 +3231,7 @@ acl_fetch_sc1_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_bytes_out_rate(l4->stkctr1_table, test, l4->stkctr1_entry); } -/* set test->i to the bytes rate to clients from the session's tracked BE counters +/* set temp integer to the bytes rate to clients from the session's tracked BE counters * over the configured period. */ static int @@ -3244,7 +3244,7 @@ acl_fetch_sc2_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_bytes_out_rate(l4->stkctr2_table, test, l4->stkctr2_entry); } -/* set test->i to the bytes rate to client from the session's source address in +/* set temp integer to the bytes rate to client from the session's source address in * the table pointed to by expr, over the configured period. */ static int @@ -3266,7 +3266,7 @@ acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int return acl_fetch_bytes_out_rate(&px->table, test, stktable_lookup_key(&px->table, key)); } -/* set test->i to the number of used entries in the table pointed to by expr. */ +/* set temp integer to the number of used entries in the table pointed to by expr. */ static int acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -3278,11 +3278,11 @@ acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir, return 0; /* table not found */ test->flags = ACL_TEST_F_VOL_TEST; - test->i = px->table.current; + temp_pattern.data.integer = px->table.current; return 1; } -/* set test->i to the number of free entries in the table pointed to by expr. */ +/* set temp integer to the number of free entries in the table pointed to by expr. */ static int acl_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, int dir, struct acl_expr *expr, struct acl_test *test) @@ -3294,7 +3294,7 @@ acl_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, int dir, return 0; /* table not found */ test->flags = ACL_TEST_F_VOL_TEST; - test->i = px->table.size - px->table.current; + temp_pattern.data.integer = px->table.size - px->table.current; return 1; } -- 1.7.2.3