[MINOR] session-counters: use "track-sc{1,2}" instead of "track-{fe,be}-counters"

The assumption that there was a 1:1 relation between tracked counters and
the frontend/backend role was wrong. It is perfectly possible to track the
track-fe-counters from the backend and the track-be-counters from the
frontend. Thus, in order to reduce confusion, let's remove this useless
{fe,be} reference and simply use {1,2} instead. The keywords have also been
renamed in order to limit confusion. The ACL rule action now becomes
"track-sc{1,2}". The ACLs are now "sc{1,2}_*" instead of "trk{fe,be}_*".

That means that we can reasonably document "sc1" and "sc2" (sticky counters
1 and 2) as sort of patterns that are available during the whole session's
life and use them just like any other pattern.
This commit is contained in:
Willy Tarreau 2010-08-06 19:06:56 +02:00
parent 9e9879a263
commit 56123282ef
6 changed files with 301 additions and 297 deletions

View File

@ -55,22 +55,22 @@ static inline void session_store_counters(struct session *s)
{
void *ptr;
if (s->be_tracked_counters) {
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_CONN_CUR);
if (s->stkctr2_entry) {
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_CONN_CUR);
if (ptr)
stktable_data_cast(ptr, conn_cur)--;
s->be_tracked_counters->ref_cnt--;
stksess_kill_if_expired(s->be_tracked_table, s->be_tracked_counters);
s->be_tracked_counters = NULL;
s->stkctr2_entry->ref_cnt--;
stksess_kill_if_expired(s->stkctr2_table, s->stkctr2_entry);
s->stkctr2_entry = NULL;
}
if (s->fe_tracked_counters) {
ptr = stktable_data_ptr(s->fe_tracked_table, s->fe_tracked_counters, STKTABLE_DT_CONN_CUR);
if (s->stkctr1_entry) {
ptr = stktable_data_ptr(s->stkctr1_table, s->stkctr1_entry, STKTABLE_DT_CONN_CUR);
if (ptr)
stktable_data_cast(ptr, conn_cur)--;
s->fe_tracked_counters->ref_cnt--;
stksess_kill_if_expired(s->fe_tracked_table, s->fe_tracked_counters);
s->fe_tracked_counters = NULL;
s->stkctr1_entry->ref_cnt--;
stksess_kill_if_expired(s->stkctr1_table, s->stkctr1_entry);
s->stkctr1_entry = NULL;
}
}
@ -82,15 +82,15 @@ static inline void session_stop_backend_counters(struct session *s)
{
void *ptr;
if (!s->be_tracked_counters)
if (!s->stkctr2_entry)
return;
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_CONN_CUR);
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_CONN_CUR);
if (ptr)
stktable_data_cast(ptr, conn_cur)--;
s->be_tracked_counters->ref_cnt--;
stksess_kill_if_expired(s->be_tracked_table, s->be_tracked_counters);
s->be_tracked_counters = NULL;
s->stkctr2_entry->ref_cnt--;
stksess_kill_if_expired(s->stkctr2_table, s->stkctr2_entry);
s->stkctr2_entry = NULL;
}
/* Increase total and concurrent connection count for stick entry <ts> of table
@ -117,33 +117,33 @@ static inline void session_start_counters(struct stktable *t, struct stksess *ts
ts->expire = tick_add(now_ms, MS_TO_TICKS(t->expire));
}
/* Enable frontend tracking of session counters on stksess <ts>. The caller is
/* Enable tracking of session counters as stkctr1 on stksess <ts>. The caller is
* responsible for ensuring that <t> and <ts> are valid pointers. Some controls
* are performed to ensure the state can still change.
*/
static inline void session_track_fe_counters(struct session *s, struct stktable *t, struct stksess *ts)
static inline void session_track_stkctr1(struct session *s, struct stktable *t, struct stksess *ts)
{
if (s->fe_tracked_counters)
if (s->stkctr1_entry)
return;
ts->ref_cnt++;
s->fe_tracked_table = t;
s->fe_tracked_counters = ts;
s->stkctr1_table = t;
s->stkctr1_entry = ts;
session_start_counters(t, ts);
}
/* Enable backend tracking of session counters on stksess <ts>. The caller is
/* Enable tracking of session counters as stkctr1 on stksess <ts>. The caller is
* responsible for ensuring that <t> and <ts> are valid pointers. Some controls
* are performed to ensure the state can still change.
*/
static inline void session_track_be_counters(struct session *s, struct stktable *t, struct stksess *ts)
static inline void session_track_stkctr2(struct session *s, struct stktable *t, struct stksess *ts)
{
if (s->be_tracked_counters)
if (s->stkctr2_entry)
return;
ts->ref_cnt++;
s->be_tracked_table = t;
s->be_tracked_counters = ts;
s->stkctr2_table = t;
s->stkctr2_entry = ts;
session_start_counters(t, ts);
}
@ -158,26 +158,26 @@ static void inline session_inc_http_req_ctr(struct session *s)
{
void *ptr;
if (s->be_tracked_counters) {
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_HTTP_REQ_CNT);
if (s->stkctr2_entry) {
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_HTTP_REQ_CNT);
if (ptr)
stktable_data_cast(ptr, http_req_cnt)++;
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_HTTP_REQ_RATE);
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_HTTP_REQ_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
s->be_tracked_table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
s->stkctr2_table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
}
if (s->fe_tracked_counters) {
ptr = stktable_data_ptr(s->fe_tracked_table, s->fe_tracked_counters, STKTABLE_DT_HTTP_REQ_CNT);
if (s->stkctr1_entry) {
ptr = stktable_data_ptr(s->stkctr1_table, s->stkctr1_entry, STKTABLE_DT_HTTP_REQ_CNT);
if (ptr)
stktable_data_cast(ptr, http_req_cnt)++;
ptr = stktable_data_ptr(s->fe_tracked_table, s->fe_tracked_counters, STKTABLE_DT_HTTP_REQ_RATE);
ptr = stktable_data_ptr(s->stkctr1_table, s->stkctr1_entry, STKTABLE_DT_HTTP_REQ_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
s->fe_tracked_table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
s->stkctr1_table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
}
}
@ -191,26 +191,26 @@ static void inline session_inc_http_err_ctr(struct session *s)
{
void *ptr;
if (s->be_tracked_counters) {
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_HTTP_ERR_CNT);
if (s->stkctr2_entry) {
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_HTTP_ERR_CNT);
if (ptr)
stktable_data_cast(ptr, http_err_cnt)++;
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_HTTP_ERR_RATE);
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_HTTP_ERR_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
s->be_tracked_table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
s->stkctr2_table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
}
if (s->fe_tracked_counters) {
ptr = stktable_data_ptr(s->fe_tracked_table, s->fe_tracked_counters, STKTABLE_DT_HTTP_ERR_CNT);
if (s->stkctr1_entry) {
ptr = stktable_data_ptr(s->stkctr1_table, s->stkctr1_entry, STKTABLE_DT_HTTP_ERR_CNT);
if (ptr)
stktable_data_cast(ptr, http_err_cnt)++;
ptr = stktable_data_ptr(s->fe_tracked_table, s->fe_tracked_counters, STKTABLE_DT_HTTP_ERR_RATE);
ptr = stktable_data_ptr(s->stkctr1_table, s->stkctr1_entry, STKTABLE_DT_HTTP_ERR_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
s->fe_tracked_table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
s->stkctr1_table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
}
}

View File

@ -32,8 +32,8 @@
enum {
TCP_ACT_ACCEPT = 1,
TCP_ACT_REJECT = 2,
TCP_ACT_TRK_FE_CTR = 3,
TCP_ACT_TRK_BE_CTR = 4,
TCP_ACT_TRK_SC1 = 3,
TCP_ACT_TRK_SC2 = 4,
};
struct tcp_rule {

View File

@ -184,10 +184,11 @@ struct session {
int flags;
} store[8]; /* tracked stickiness values to store */
int store_count;
struct stksess *fe_tracked_counters; /* counters currently being tracked by this session (frontend) */
struct stktable *fe_tracked_table; /* table the counters above belong to (undefined if counters are null) */
struct stksess *be_tracked_counters; /* counters currently being tracked by this session (backend) */
struct stktable *be_tracked_table; /* table the counters above belong to (undefined if counters are null) */
struct stksess *stkctr1_entry; /* entry containing counters currently being tracked as set 1 by this session */
struct stktable *stkctr1_table; /* table the counters above belong to (undefined if counters are null) */
struct stksess *stkctr2_entry; /* entry containing counters currently being tracked as set 2 by this session */
struct stktable *stkctr2_table; /* table the counters above belong to (undefined if counters are null) */
struct {
int logwait; /* log fields waiting to be collected : LW_* */

View File

@ -4990,7 +4990,7 @@ int check_config_validity()
list_for_each_entry(trule, &curproxy->tcp_req.l4_rules, list) {
struct proxy *target;
if (trule->action != TCP_ACT_TRK_FE_CTR && trule->action != TCP_ACT_TRK_BE_CTR)
if (trule->action != TCP_ACT_TRK_SC1 && trule->action != TCP_ACT_TRK_SC2)
continue;
if (trule->act_prm.trk_ctr.table.n)
@ -4999,8 +4999,9 @@ int check_config_validity()
target = curproxy;
if (!target) {
Alert("Proxy '%s': unable to find table '%s' referenced by track-counter.\n",
curproxy->id, trule->act_prm.trk_ctr.table.n);
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
curproxy->id, trule->act_prm.trk_ctr.table.n,
trule->action == TCP_ACT_TRK_SC1 ? 1 : 2);
cfgerr++;
}
else if (target->table.size == 0) {
@ -5009,14 +5010,14 @@ int check_config_validity()
cfgerr++;
}
else if (trule->act_prm.trk_ctr.type != target->table.type) {
Alert("Proxy '%s': type of track-counters pattern not usable with type of stick-table '%s'.\n",
Alert("Proxy '%s': type of tracking key for sticky counter not usable with type of stick-table '%s'.\n",
curproxy->id, trule->act_prm.trk_ctr.table.n ? trule->act_prm.trk_ctr.table.n : curproxy->id);
cfgerr++;
}
else {
free(trule->act_prm.trk_ctr.table.n);
trule->act_prm.trk_ctr.table.t = &target->table;
/* Note: if we decide to enhance the track-counters syntax, we may be able
/* Note: if we decide to enhance the track-sc syntax, we may be able
* to pass a list of counters to track and allocate them right here using
* stktable_alloc_data_type().
*/
@ -5027,7 +5028,7 @@ int check_config_validity()
list_for_each_entry(trule, &curproxy->tcp_req.inspect_rules, list) {
struct proxy *target;
if (trule->action != TCP_ACT_TRK_FE_CTR && trule->action != TCP_ACT_TRK_BE_CTR)
if (trule->action != TCP_ACT_TRK_SC1 && trule->action != TCP_ACT_TRK_SC2)
continue;
if (trule->act_prm.trk_ctr.table.n)
@ -5036,8 +5037,9 @@ int check_config_validity()
target = curproxy;
if (!target) {
Alert("Proxy '%s': unable to find table '%s' referenced by track-counter.\n",
curproxy->id, trule->act_prm.trk_ctr.table.n);
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
curproxy->id, trule->act_prm.trk_ctr.table.n,
trule->action == TCP_ACT_TRK_SC1 ? 1 : 2);
cfgerr++;
}
else if (target->table.size == 0) {
@ -5046,14 +5048,14 @@ int check_config_validity()
cfgerr++;
}
else if (trule->act_prm.trk_ctr.type != target->table.type) {
Alert("Proxy '%s': type of track-counters pattern not usable with type of stick-table '%s'.\n",
Alert("Proxy '%s': type of tracking key for sticky counter not usable with type of stick-table '%s'.\n",
curproxy->id, trule->act_prm.trk_ctr.table.n ? trule->act_prm.trk_ctr.table.n : curproxy->id);
cfgerr++;
}
else {
free(trule->act_prm.trk_ctr.table.n);
trule->act_prm.trk_ctr.table.t = &target->table;
/* Note: if we decide to enhance the track-counters syntax, we may be able
/* Note: if we decide to enhance the track-sc syntax, we may be able
* to pass a list of counters to track and allocate them right here using
* stktable_alloc_data_type().
*/

View File

@ -686,9 +686,9 @@ int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit)
s->flags |= SN_FINST_R;
return 0;
}
else if (rule->action == TCP_ACT_TRK_FE_CTR) {
if (!s->fe_tracked_counters) {
/* only the first valid track-counters directive applies.
else if (rule->action == TCP_ACT_TRK_SC1) {
if (!s->stkctr1_entry) {
/* only the first valid track-sc1 directive applies.
* Also, note that right now we can only track SRC so we
* don't check how to get the key, but later we may need
* to consider rule->act_prm->trk_ctr.type.
@ -696,12 +696,12 @@ int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit)
t = rule->act_prm.trk_ctr.table.t;
ts = stktable_get_entry(t, tcpv4_src_to_stktable_key(s));
if (ts)
session_track_fe_counters(s, t, ts);
session_track_stkctr1(s, t, ts);
}
}
else if (rule->action == TCP_ACT_TRK_BE_CTR) {
if (!s->be_tracked_counters) {
/* only the first valid track-counters directive applies.
else if (rule->action == TCP_ACT_TRK_SC2) {
if (!s->stkctr2_entry) {
/* only the first valid track-sc2 directive applies.
* Also, note that right now we can only track SRC so we
* don't check how to get the key, but later we may need
* to consider rule->act_prm->trk_ctr.type.
@ -709,7 +709,7 @@ int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit)
t = rule->act_prm.trk_ctr.table.t;
ts = stktable_get_entry(t, tcpv4_src_to_stktable_key(s));
if (ts)
session_track_be_counters(s, t, ts);
session_track_stkctr2(s, t, ts);
}
}
else {
@ -764,9 +764,9 @@ int tcp_exec_req_rules(struct session *s)
result = 0;
break;
}
else if (rule->action == TCP_ACT_TRK_FE_CTR) {
if (!s->fe_tracked_counters) {
/* only the first valid track-counters directive applies.
else if (rule->action == TCP_ACT_TRK_SC1) {
if (!s->stkctr1_entry) {
/* only the first valid track-sc1 directive applies.
* Also, note that right now we can only track SRC so we
* don't check how to get the key, but later we may need
* to consider rule->act_prm->trk_ctr.type.
@ -774,12 +774,12 @@ int tcp_exec_req_rules(struct session *s)
t = rule->act_prm.trk_ctr.table.t;
ts = stktable_get_entry(t, tcpv4_src_to_stktable_key(s));
if (ts)
session_track_fe_counters(s, t, ts);
session_track_stkctr1(s, t, ts);
}
}
else if (rule->action == TCP_ACT_TRK_BE_CTR) {
if (!s->be_tracked_counters) {
/* only the first valid track-counters directive applies.
else if (rule->action == TCP_ACT_TRK_SC2) {
if (!s->stkctr2_entry) {
/* only the first valid track-sc2 directive applies.
* Also, note that right now we can only track SRC so we
* don't check how to get the key, but later we may need
* to consider rule->act_prm->trk_ctr.type.
@ -787,7 +787,7 @@ int tcp_exec_req_rules(struct session *s)
t = rule->act_prm.trk_ctr.table.t;
ts = stktable_get_entry(t, tcpv4_src_to_stktable_key(s));
if (ts)
session_track_be_counters(s, t, ts);
session_track_stkctr2(s, t, ts);
}
}
else {
@ -818,7 +818,7 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
arg++;
rule->action = TCP_ACT_REJECT;
}
else if (strcmp(args[arg], "track-fe-counters") == 0) {
else if (strcmp(args[arg], "track-sc1") == 0) {
int ret;
arg++;
@ -828,9 +828,9 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
if (ret < 0) /* nb: warnings are not handled yet */
return -1;
rule->action = TCP_ACT_TRK_FE_CTR;
rule->action = TCP_ACT_TRK_SC1;
}
else if (strcmp(args[arg], "track-be-counters") == 0) {
else if (strcmp(args[arg], "track-sc2") == 0) {
int ret;
arg++;
@ -840,12 +840,12 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
if (ret < 0) /* nb: warnings are not handled yet */
return -1;
rule->action = TCP_ACT_TRK_BE_CTR;
rule->action = TCP_ACT_TRK_SC2;
}
else {
snprintf(err, errlen,
"'%s %s' expects 'accept', 'reject', 'track-fe-counters' "
"or 'track-be-counters' in %s '%s' (was '%s')",
"'%s %s' expects 'accept', 'reject', 'track-sc1' "
"or 'track-sc2' in %s '%s' (was '%s')",
args[0], args[1], proxy_type_str(curpx), curpx->id, args[arg]);
return -1;
}

View File

@ -64,10 +64,10 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
/* minimum session initialization required for monitor mode below */
s->flags = 0;
s->logs.logwait = p->to_log;
s->fe_tracked_counters = NULL;
s->be_tracked_counters = NULL;
s->fe_tracked_table = NULL;
s->be_tracked_table = NULL;
s->stkctr1_entry = NULL;
s->stkctr2_entry = NULL;
s->stkctr1_table = NULL;
s->stkctr2_table = NULL;
/* if this session comes from a known monitoring system, we want to ignore
* it as soon as possible, which means closing it immediately for TCP, but
@ -122,7 +122,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
* even initializing the stream interfaces.
*/
if ((l->options & LI_O_TCP_RULES) && !tcp_exec_req_rules(s)) {
if (s->fe_tracked_counters || s->be_tracked_counters)
if (s->stkctr1_entry || s->stkctr2_entry)
session_store_counters(s);
task_free(t);
LIST_DEL(&s->list);
@ -137,30 +137,30 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
if (p->feconn > p->counters.feconn_max)
p->counters.feconn_max = p->feconn;
proxy_inc_fe_sess_ctr(l, p);
if (s->fe_tracked_counters) {
if (s->stkctr1_entry) {
void *ptr;
ptr = stktable_data_ptr(s->fe_tracked_table, s->fe_tracked_counters, STKTABLE_DT_SESS_CNT);
ptr = stktable_data_ptr(s->stkctr1_table, s->stkctr1_entry, STKTABLE_DT_SESS_CNT);
if (ptr)
stktable_data_cast(ptr, sess_cnt)++;
ptr = stktable_data_ptr(s->fe_tracked_table, s->fe_tracked_counters, STKTABLE_DT_SESS_RATE);
ptr = stktable_data_ptr(s->stkctr1_table, s->stkctr1_entry, STKTABLE_DT_SESS_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
s->fe_tracked_table->data_arg[STKTABLE_DT_SESS_RATE].u, 1);
s->stkctr1_table->data_arg[STKTABLE_DT_SESS_RATE].u, 1);
}
if (s->be_tracked_counters) {
if (s->stkctr2_entry) {
void *ptr;
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_SESS_CNT);
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_SESS_CNT);
if (ptr)
stktable_data_cast(ptr, sess_cnt)++;
ptr = stktable_data_ptr(s->be_tracked_table, s->be_tracked_counters, STKTABLE_DT_SESS_RATE);
ptr = stktable_data_ptr(s->stkctr2_table, s->stkctr2_entry, STKTABLE_DT_SESS_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
s->be_tracked_table->data_arg[STKTABLE_DT_SESS_RATE].u, 1);
s->stkctr2_table->data_arg[STKTABLE_DT_SESS_RATE].u, 1);
}
/* this part should be common with other protocols */
@ -288,7 +288,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
/* work is finished, we can release everything (eg: monitoring) */
pool_free2(pool2_buffer, s->rep);
pool_free2(pool2_buffer, s->req);
if (s->fe_tracked_counters || s->be_tracked_counters)
if (s->stkctr1_entry || s->stkctr2_entry)
session_store_counters(s);
task_free(t);
LIST_DEL(&s->list);
@ -312,7 +312,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
pool_free2(pool2_buffer, s->req);
out_free_task:
p->feconn--;
if (s->fe_tracked_counters || s->be_tracked_counters)
if (s->stkctr1_entry || s->stkctr2_entry)
session_store_counters(s);
task_free(t);
out_free_session:
@ -376,7 +376,7 @@ void session_free(struct session *s)
pool_free2(fe->req_cap_pool, txn->req.cap);
}
if (s->fe_tracked_counters || s->be_tracked_counters)
if (s->stkctr1_entry || s->stkctr2_entry)
session_store_counters(s);
list_for_each_entry_safe(bref, back, &s->back_refs, users) {
@ -432,38 +432,38 @@ void session_process_counters(struct session *s)
if (s->listener->counters)
s->listener->counters->bytes_in += bytes;
if (s->be_tracked_counters) {
if (s->stkctr2_entry) {
void *ptr;
ptr = stktable_data_ptr(s->be_tracked_table,
s->be_tracked_counters,
ptr = stktable_data_ptr(s->stkctr2_table,
s->stkctr2_entry,
STKTABLE_DT_BYTES_IN_CNT);
if (ptr)
stktable_data_cast(ptr, bytes_in_cnt) += bytes;
ptr = stktable_data_ptr(s->be_tracked_table,
s->be_tracked_counters,
ptr = stktable_data_ptr(s->stkctr2_table,
s->stkctr2_entry,
STKTABLE_DT_BYTES_IN_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
s->be_tracked_table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u, bytes);
s->stkctr2_table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u, bytes);
}
if (s->fe_tracked_counters) {
if (s->stkctr1_entry) {
void *ptr;
ptr = stktable_data_ptr(s->fe_tracked_table,
s->fe_tracked_counters,
ptr = stktable_data_ptr(s->stkctr1_table,
s->stkctr1_entry,
STKTABLE_DT_BYTES_IN_CNT);
if (ptr)
stktable_data_cast(ptr, bytes_in_cnt) += bytes;
ptr = stktable_data_ptr(s->fe_tracked_table,
s->fe_tracked_counters,
ptr = stktable_data_ptr(s->stkctr1_table,
s->stkctr1_entry,
STKTABLE_DT_BYTES_IN_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
s->fe_tracked_table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u, bytes);
s->stkctr1_table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u, bytes);
}
}
}
@ -483,38 +483,38 @@ void session_process_counters(struct session *s)
if (s->listener->counters)
s->listener->counters->bytes_out += bytes;
if (s->be_tracked_counters) {
if (s->stkctr2_entry) {
void *ptr;
ptr = stktable_data_ptr(s->be_tracked_table,
s->be_tracked_counters,
ptr = stktable_data_ptr(s->stkctr2_table,
s->stkctr2_entry,
STKTABLE_DT_BYTES_OUT_CNT);
if (ptr)
stktable_data_cast(ptr, bytes_out_cnt) += bytes;
ptr = stktable_data_ptr(s->be_tracked_table,
s->be_tracked_counters,
ptr = stktable_data_ptr(s->stkctr2_table,
s->stkctr2_entry,
STKTABLE_DT_BYTES_OUT_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
s->be_tracked_table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u, bytes);
s->stkctr2_table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u, bytes);
}
if (s->fe_tracked_counters) {
if (s->stkctr1_entry) {
void *ptr;
ptr = stktable_data_ptr(s->fe_tracked_table,
s->fe_tracked_counters,
ptr = stktable_data_ptr(s->stkctr1_table,
s->stkctr1_entry,
STKTABLE_DT_BYTES_OUT_CNT);
if (ptr)
stktable_data_cast(ptr, bytes_out_cnt) += bytes;
ptr = stktable_data_ptr(s->fe_tracked_table,
s->fe_tracked_counters,
ptr = stktable_data_ptr(s->stkctr1_table,
s->stkctr1_entry,
STKTABLE_DT_BYTES_OUT_RATE);
if (ptr)
update_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
s->fe_tracked_table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u, bytes);
s->stkctr1_table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u, bytes);
}
}
}
@ -2170,24 +2170,24 @@ acl_fetch_get_gpc0(struct stktable *table, struct acl_test *test, struct stksess
* frontend counters.
*/
static int
acl_fetch_trkfe_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_get_gpc0(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* backend counters.
*/
static int
acl_fetch_trkbe_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_get_gpc0(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2233,24 +2233,24 @@ acl_fetch_inc_gpc0(struct stktable *table, struct acl_test *test, struct stksess
* frontend counters and return it into test->i.
*/
static int
acl_fetch_trkfe_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_inc_gpc0(l4->fe_tracked_table, test, l4->fe_tracked_counters);
return acl_fetch_inc_gpc0(l4->stkctr1_table, test, l4->stkctr1_entry);
}
/* Increment the General Purpose Counter 0 value from the session's tracked
* backend counters and return it into test->i.
*/
static int
acl_fetch_trkbe_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_inc_gpc0(l4->be_tracked_table, test, l4->be_tracked_counters);
return acl_fetch_inc_gpc0(l4->stkctr2_table, test, l4->stkctr2_entry);
}
/* Increment the General Purpose Counter 0 value from the session's source
@ -2292,24 +2292,24 @@ acl_fetch_conn_cnt(struct stktable *table, struct acl_test *test, struct stksess
/* set test->i to the cumulated number of connections from the session's tracked FE counters */
static int
acl_fetch_trkfe_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_conn_cnt(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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 */
static int
acl_fetch_trkbe_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_conn_cnt(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2354,26 +2354,26 @@ acl_fetch_conn_rate(struct stktable *table, struct acl_test *test, struct stkses
* the configured period.
*/
static int
acl_fetch_trkfe_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_conn_rate(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* the configured period.
*/
static int
acl_fetch_trkbe_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_conn_rate(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2450,24 +2450,24 @@ acl_fetch_conn_cur(struct stktable *table, struct acl_test *test, struct stksess
/* set test->i to the number of concurrent connections from the session's tracked FE counters */
static int
acl_fetch_trkfe_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_conn_cur(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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 */
static int
acl_fetch_trkbe_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_conn_cur(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2509,24 +2509,24 @@ acl_fetch_sess_cnt(struct stktable *table, struct acl_test *test, struct stksess
/* set test->i to the cumulated number of sessions from the session's tracked FE counters */
static int
acl_fetch_trkfe_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_sess_cnt(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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 */
static int
acl_fetch_trkbe_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_sess_cnt(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2571,26 +2571,26 @@ acl_fetch_sess_rate(struct stktable *table, struct acl_test *test, struct stkses
* the configured period.
*/
static int
acl_fetch_trkfe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_sess_rate(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* the configured period.
*/
static int
acl_fetch_trkbe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_sess_rate(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2632,24 +2632,24 @@ acl_fetch_http_req_cnt(struct stktable *table, struct acl_test *test, struct stk
/* set test->i to the cumulated number of sessions from the session's tracked FE counters */
static int
acl_fetch_trkfe_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_http_req_cnt(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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 */
static int
acl_fetch_trkbe_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_http_req_cnt(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2657,7 +2657,7 @@ acl_fetch_trkbe_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int
*/
static int
acl_fetch_src_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
struct acl_expr *expr, struct acl_test *test)
{
struct stktable_key *key;
@ -2694,26 +2694,26 @@ acl_fetch_http_req_rate(struct stktable *table, struct acl_test *test, struct st
* the configured period.
*/
static int
acl_fetch_trkfe_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_http_req_rate(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* the configured period.
*/
static int
acl_fetch_trkbe_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_http_req_rate(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2721,7 +2721,7 @@ acl_fetch_trkbe_http_req_rate(struct proxy *px, struct session *l4, void *l7, in
*/
static int
acl_fetch_src_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
struct acl_expr *expr, struct acl_test *test)
{
struct stktable_key *key;
@ -2755,24 +2755,24 @@ acl_fetch_http_err_cnt(struct stktable *table, struct acl_test *test, struct stk
/* set test->i to the cumulated number of sessions from the session's tracked FE counters */
static int
acl_fetch_trkfe_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_http_err_cnt(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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 */
static int
acl_fetch_trkbe_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_http_err_cnt(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2780,7 +2780,7 @@ acl_fetch_trkbe_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int
*/
static int
acl_fetch_src_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
struct acl_expr *expr, struct acl_test *test)
{
struct stktable_key *key;
@ -2817,26 +2817,26 @@ acl_fetch_http_err_rate(struct stktable *table, struct acl_test *test, struct st
* the configured period.
*/
static int
acl_fetch_trkfe_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_http_err_rate(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* the configured period.
*/
static int
acl_fetch_trkbe_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_http_err_rate(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2881,26 +2881,26 @@ acl_fetch_kbytes_in(struct stktable *table, struct acl_test *test, struct stkses
* session's tracked FE counters.
*/
static int
acl_fetch_trkfe_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_kbytes_in(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* session's tracked BE counters.
*/
static int
acl_fetch_trkbe_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_kbytes_in(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2947,26 +2947,26 @@ acl_fetch_bytes_in_rate(struct stktable *table, struct acl_test *test, struct st
* counters over the configured period.
*/
static int
acl_fetch_trkfe_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_bytes_in_rate(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* counters over the configured period.
*/
static int
acl_fetch_trkbe_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_bytes_in_rate(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -2974,7 +2974,7 @@ acl_fetch_trkbe_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, in
*/
static int
acl_fetch_src_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
struct acl_expr *expr, struct acl_test *test)
{
struct stktable_key *key;
@ -3011,26 +3011,26 @@ acl_fetch_kbytes_out(struct stktable *table, struct acl_test *test, struct stkse
* tracked FE counters.
*/
static int
acl_fetch_trkfe_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_kbytes_out(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* tracked BE counters.
*/
static int
acl_fetch_trkbe_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_kbytes_out(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -3077,26 +3077,26 @@ acl_fetch_bytes_out_rate(struct stktable *table, struct acl_test *test, struct s
* over the configured period.
*/
static int
acl_fetch_trkfe_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc1_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->fe_tracked_counters)
if (!l4->stkctr1_entry)
return 0;
return acl_fetch_bytes_out_rate(l4->fe_tracked_table, test, l4->fe_tracked_counters);
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
* over the configured period.
*/
static int
acl_fetch_trkbe_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
acl_fetch_sc2_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
{
if (!l4->be_tracked_counters)
if (!l4->stkctr2_entry)
return 0;
return acl_fetch_bytes_out_rate(l4->be_tracked_table, test, l4->be_tracked_counters);
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
@ -3104,7 +3104,7 @@ acl_fetch_trkbe_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, i
*/
static int
acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test)
struct acl_expr *expr, struct acl_test *test)
{
struct stktable_key *key;
@ -3124,57 +3124,57 @@ acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
/* Note: must not be declared <const> as its list will be overwritten */
static struct acl_kw_list acl_kws = {{ },{
{ "trkfe_get_gpc0", acl_parse_int, acl_fetch_trkfe_get_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_get_gpc0", acl_parse_int, acl_fetch_trkbe_get_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "src_get_gpc0", acl_parse_int, acl_fetch_src_get_gpc0, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_inc_gpc0", acl_parse_int, acl_fetch_trkfe_inc_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_inc_gpc0", acl_parse_int, acl_fetch_trkbe_inc_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "src_inc_gpc0", acl_parse_int, acl_fetch_src_inc_gpc0, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_conn_cnt", acl_parse_int, acl_fetch_trkfe_conn_cnt, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_conn_cnt", acl_parse_int, acl_fetch_trkbe_conn_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_conn_cnt", acl_parse_int, acl_fetch_src_conn_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_conn_rate", acl_parse_int, acl_fetch_trkfe_conn_rate, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_conn_rate", acl_parse_int, acl_fetch_trkbe_conn_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_conn_rate", acl_parse_int, acl_fetch_src_conn_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "src_updt_conn_cnt", acl_parse_int, acl_fetch_src_updt_conn_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_conn_cur", acl_parse_int, acl_fetch_trkfe_conn_cur, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_conn_cur", acl_parse_int, acl_fetch_trkbe_conn_cur, acl_match_int, ACL_USE_NOTHING },
{ "src_conn_cur", acl_parse_int, acl_fetch_src_conn_cur, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_sess_cnt", acl_parse_int, acl_fetch_trkfe_sess_cnt, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_sess_cnt", acl_parse_int, acl_fetch_trkbe_sess_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_sess_cnt", acl_parse_int, acl_fetch_src_sess_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_sess_rate", acl_parse_int, acl_fetch_trkfe_sess_rate, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_sess_rate", acl_parse_int, acl_fetch_trkbe_sess_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_sess_rate", acl_parse_int, acl_fetch_src_sess_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_http_req_cnt", acl_parse_int, acl_fetch_trkfe_http_req_cnt, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_http_req_cnt", acl_parse_int, acl_fetch_trkbe_http_req_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_http_req_cnt", acl_parse_int, acl_fetch_src_http_req_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_http_req_rate", acl_parse_int, acl_fetch_trkfe_http_req_rate, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_http_req_rate", acl_parse_int, acl_fetch_trkbe_http_req_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_http_req_rate", acl_parse_int, acl_fetch_src_http_req_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_http_err_cnt", acl_parse_int, acl_fetch_trkfe_http_err_cnt, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_http_err_cnt", acl_parse_int, acl_fetch_trkbe_http_err_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_http_err_cnt", acl_parse_int, acl_fetch_src_http_err_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_http_err_rate", acl_parse_int, acl_fetch_trkfe_http_err_rate, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_http_err_rate", acl_parse_int, acl_fetch_trkbe_http_err_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_http_err_rate", acl_parse_int, acl_fetch_src_http_err_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_kbytes_in", acl_parse_int, acl_fetch_trkfe_kbytes_in, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkbe_kbytes_in", acl_parse_int, acl_fetch_trkbe_kbytes_in, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "src_kbytes_in", acl_parse_int, acl_fetch_src_kbytes_in, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_bytes_in_rate", acl_parse_int, acl_fetch_trkfe_bytes_in_rate, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_bytes_in_rate", acl_parse_int, acl_fetch_trkbe_bytes_in_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_bytes_in_rate", acl_parse_int, acl_fetch_src_bytes_in_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_kbytes_out", acl_parse_int, acl_fetch_trkfe_kbytes_out, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkbe_kbytes_out", acl_parse_int, acl_fetch_trkbe_kbytes_out, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "src_kbytes_out", acl_parse_int, acl_fetch_src_kbytes_out, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "trkfe_bytes_out_rate", acl_parse_int, acl_fetch_trkfe_bytes_out_rate, acl_match_int, ACL_USE_NOTHING },
{ "trkbe_bytes_out_rate", acl_parse_int, acl_fetch_trkbe_bytes_out_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_bytes_out_rate", acl_parse_int, acl_fetch_src_bytes_out_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_get_gpc0", acl_parse_int, acl_fetch_sc1_get_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "sc2_get_gpc0", acl_parse_int, acl_fetch_sc2_get_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "src_get_gpc0", acl_parse_int, acl_fetch_src_get_gpc0, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_inc_gpc0", acl_parse_int, acl_fetch_sc1_inc_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "sc2_inc_gpc0", acl_parse_int, acl_fetch_sc2_inc_gpc0, acl_match_int, ACL_USE_NOTHING },
{ "src_inc_gpc0", acl_parse_int, acl_fetch_src_inc_gpc0, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_conn_cnt", acl_parse_int, acl_fetch_sc1_conn_cnt, acl_match_int, ACL_USE_NOTHING },
{ "sc2_conn_cnt", acl_parse_int, acl_fetch_sc2_conn_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_conn_cnt", acl_parse_int, acl_fetch_src_conn_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_conn_rate", acl_parse_int, acl_fetch_sc1_conn_rate, acl_match_int, ACL_USE_NOTHING },
{ "sc2_conn_rate", acl_parse_int, acl_fetch_sc2_conn_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_conn_rate", acl_parse_int, acl_fetch_src_conn_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "src_updt_conn_cnt", acl_parse_int, acl_fetch_src_updt_conn_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_conn_cur", acl_parse_int, acl_fetch_sc1_conn_cur, acl_match_int, ACL_USE_NOTHING },
{ "sc2_conn_cur", acl_parse_int, acl_fetch_sc2_conn_cur, acl_match_int, ACL_USE_NOTHING },
{ "src_conn_cur", acl_parse_int, acl_fetch_src_conn_cur, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_sess_cnt", acl_parse_int, acl_fetch_sc1_sess_cnt, acl_match_int, ACL_USE_NOTHING },
{ "sc2_sess_cnt", acl_parse_int, acl_fetch_sc2_sess_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_sess_cnt", acl_parse_int, acl_fetch_src_sess_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_sess_rate", acl_parse_int, acl_fetch_sc1_sess_rate, acl_match_int, ACL_USE_NOTHING },
{ "sc2_sess_rate", acl_parse_int, acl_fetch_sc2_sess_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_sess_rate", acl_parse_int, acl_fetch_src_sess_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_http_req_cnt", acl_parse_int, acl_fetch_sc1_http_req_cnt, acl_match_int, ACL_USE_NOTHING },
{ "sc2_http_req_cnt", acl_parse_int, acl_fetch_sc2_http_req_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_http_req_cnt", acl_parse_int, acl_fetch_src_http_req_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_http_req_rate", acl_parse_int, acl_fetch_sc1_http_req_rate, acl_match_int, ACL_USE_NOTHING },
{ "sc2_http_req_rate", acl_parse_int, acl_fetch_sc2_http_req_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_http_req_rate", acl_parse_int, acl_fetch_src_http_req_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_http_err_cnt", acl_parse_int, acl_fetch_sc1_http_err_cnt, acl_match_int, ACL_USE_NOTHING },
{ "sc2_http_err_cnt", acl_parse_int, acl_fetch_sc2_http_err_cnt, acl_match_int, ACL_USE_NOTHING },
{ "src_http_err_cnt", acl_parse_int, acl_fetch_src_http_err_cnt, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_http_err_rate", acl_parse_int, acl_fetch_sc1_http_err_rate, acl_match_int, ACL_USE_NOTHING },
{ "sc2_http_err_rate", acl_parse_int, acl_fetch_sc2_http_err_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_http_err_rate", acl_parse_int, acl_fetch_src_http_err_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_kbytes_in", acl_parse_int, acl_fetch_sc1_kbytes_in, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc2_kbytes_in", acl_parse_int, acl_fetch_sc2_kbytes_in, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "src_kbytes_in", acl_parse_int, acl_fetch_src_kbytes_in, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_bytes_in_rate", acl_parse_int, acl_fetch_sc1_bytes_in_rate, acl_match_int, ACL_USE_NOTHING },
{ "sc2_bytes_in_rate", acl_parse_int, acl_fetch_sc2_bytes_in_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_bytes_in_rate", acl_parse_int, acl_fetch_src_bytes_in_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_kbytes_out", acl_parse_int, acl_fetch_sc1_kbytes_out, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc2_kbytes_out", acl_parse_int, acl_fetch_sc2_kbytes_out, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "src_kbytes_out", acl_parse_int, acl_fetch_src_kbytes_out, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ "sc1_bytes_out_rate", acl_parse_int, acl_fetch_sc1_bytes_out_rate, acl_match_int, ACL_USE_NOTHING },
{ "sc2_bytes_out_rate", acl_parse_int, acl_fetch_sc2_bytes_out_rate, acl_match_int, ACL_USE_NOTHING },
{ "src_bytes_out_rate", acl_parse_int, acl_fetch_src_bytes_out_rate, acl_match_int, ACL_USE_TCP4_VOLATILE },
{ NULL, NULL, NULL, NULL },
}};
/* Parse a "track-counters" line starting with "track-counters" in args[arg-1].
/* Parse a "track-sc[12]" line starting with "track-sc[12]" in args[arg-1].
* Returns the number of warnings emitted, or -1 in case of fatal errors. The
* <prm> struct is fed with the table name if any. If unspecified, the caller
* will assume that the current proxy's table is used.
@ -3185,10 +3185,11 @@ int parse_track_counters(char **args, int *arg,
struct proxy *defpx, char *err, int errlen)
{
int pattern_type = 0;
char *kw = args[*arg - 1];
/* parse the arguments of "track-counters" before the condition in the
/* parse the arguments of "track-sc[12]" before the condition in the
* following form :
* track-counters src [ table xxx ] [ if|unless ... ]
* track-sc[12] src [ table xxx ] [ if|unless ... ]
*/
while (args[*arg]) {
if (strcmp(args[*arg], "src") == 0) {
@ -3198,8 +3199,8 @@ int parse_track_counters(char **args, int *arg,
else if (strcmp(args[*arg], "table") == 0) {
if (!args[*arg + 1]) {
snprintf(err, errlen,
"missing table for track-counter in %s '%s'.",
proxy_type_str(curpx), curpx->id);
"missing table for %s in %s '%s'.",
kw, proxy_type_str(curpx), curpx->id);
return -1;
}
/* we copy the table name for now, it will be resolved later */
@ -3215,8 +3216,8 @@ int parse_track_counters(char **args, int *arg,
if (!pattern_type) {
snprintf(err, errlen,
"track-counter key not specified in %s '%s' (found %s, only 'src' is supported).",
proxy_type_str(curpx), curpx->id, quote_arg(args[*arg]));
"%s key not specified in %s '%s' (found %s, only 'src' is supported).",
kw, proxy_type_str(curpx), curpx->id, quote_arg(args[*arg]));
return -1;
}