[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_* */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 6ca7ec5..258942e 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -4990,7 +4990,7 @@
 		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 @@
 				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 @@
 				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 @@
 		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 @@
 				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 @@
 				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().
 				 */
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 66b8a13..5882791 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -686,9 +686,9 @@
 					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 @@
 					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 @@
 					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 @@
 				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 @@
 					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 @@
 					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 @@
 		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 @@
 		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 @@
 		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;
 	}
diff --git a/src/session.c b/src/session.c
index 37ded37..0574c0b 100644
--- a/src/session.c
+++ b/src/session.c
@@ -64,10 +64,10 @@
 	/* 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 @@
 	 * 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 @@
 	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 @@
 			/* 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 @@
 	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 @@
 		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 @@
 			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 @@
 			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 @@
  * 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 @@
  * 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 @@
 
 /* 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 @@
  * 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 @@
 
 /* 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 @@
 
 /* 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 @@
  * 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 @@
 
 /* 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 @@
  */
 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 @@
  * 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 @@
  */
 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 @@
 
 /* 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 @@
  */
 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 @@
  * 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 @@
  * 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 @@
  * 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 @@
  */
 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 @@
  * 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 @@
  * 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 @@
  */
 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 @@
 
 /* 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 @@
 			 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 @@
 		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 @@
 
 	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;
 	}