[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.
diff --git a/include/proto/session.h b/include/proto/session.h
index bf390ca..f33f924 100644
--- a/include/proto/session.h
+++ b/include/proto/session.h
@@ -55,22 +55,22 @@
{
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 @@
{
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 @@
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 @@
{
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 @@
{
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);
}
}
diff --git a/include/types/proto_tcp.h b/include/types/proto_tcp.h
index bee52aa..0ee2ec7 100644
--- a/include/types/proto_tcp.h
+++ b/include/types/proto_tcp.h
@@ -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 {
diff --git a/include/types/session.h b/include/types/session.h
index 7b6cf4f..79a8373 100644
--- a/include/types/session.h
+++ b/include/types/session.h
@@ -184,10 +184,11 @@
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_* */