[MINOR] acl: add srv_conn acl to count connections on a
specific backend server
These ACLs are used to check the number of active connections on the specified server in the specified backend.
diff --git a/src/backend.c b/src/backend.c
index 4b923a7..d76324f 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1551,6 +1551,17 @@
return 1;
}
+/* set test->i to the number of concurrent connections on the server in the backend */
+static int
+acl_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, int dir,
+ struct acl_expr *expr, struct acl_test *test)
+{
+ struct server *srv = expr->arg.srv;
+
+ test->i = srv->cur_sess;
+ return 1;
+}
+
/* Note: must not be declared <const> as its list will be overwritten */
static struct acl_kw_list acl_kws = {{ },{
{ "nbsrv", acl_parse_int, acl_fetch_nbsrv, acl_match_int, ACL_USE_NOTHING },
@@ -1562,6 +1573,7 @@
{ "avg_queue", acl_parse_int, acl_fetch_avg_queue_size, acl_match_int, ACL_USE_NOTHING },
{ "srv_is_up", acl_parse_nothing, acl_fetch_srv_is_up, acl_match_nothing, ACL_USE_NOTHING },
{ "srv_id", acl_parse_int, acl_fetch_srv_id, acl_match_int, ACL_USE_RTR_INTERNAL },
+ { "srv_conn", acl_parse_int, acl_fetch_srv_conn, acl_match_int, ACL_USE_NOTHING },
{ NULL, NULL, NULL, NULL },
}};