tcp-request content reject if { src_update_count gt 3 }
server local 127.0.0.1:22
+srv_conn(backend/server) <integer>
+ Applies to the number of currently established connections on the server,
+ possibly including the connection being evaluated.
+ It can be used to use a specific farm when one server is full.
+ See also the "fe_conn", "be_conn" and "queue" criteria.
+
srv_id <integer>
Applies to the server's id. Can be used in frontends or backends.
list_for_each_entry(acl, &p->acl, list) {
list_for_each_entry(expr, &acl->expr, list) {
- if (strcmp(expr->kw->kw, "srv_is_up") == 0) {
+ if (strcmp(expr->kw->kw, "srv_is_up") == 0 ||
+ strcmp(expr->kw->kw, "srv_conn") == 0) {
struct proxy *px;
struct server *srv;
char *pname, *sname;
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 },
{ "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 },
}};