mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
[MINOR] acl: add be_id/srv_id to match backend's and server's id
These ones can be useful in responses.
This commit is contained in:
parent
02ff8ef677
commit
35ed8019e3
@ -6966,6 +6966,10 @@ be_conn(backend) <integer>
|
|||||||
backend. It can be used to use a specific farm when the nominal one is full.
|
backend. It can be used to use a specific farm when the nominal one is full.
|
||||||
See also the "fe_conn", "queue" and "be_sess_rate" criteria.
|
See also the "fe_conn", "queue" and "be_sess_rate" criteria.
|
||||||
|
|
||||||
|
be_id <integer>
|
||||||
|
Applies to the backend's id. Can be used in frontends to check from which
|
||||||
|
backend it was called.
|
||||||
|
|
||||||
be_sess_rate <integer>
|
be_sess_rate <integer>
|
||||||
be_sess_rate(backend) <integer>
|
be_sess_rate(backend) <integer>
|
||||||
Returns true when the sessions creation rate on the backend matches the
|
Returns true when the sessions creation rate on the backend matches the
|
||||||
@ -7329,6 +7333,9 @@ src_updt_conn_cnt(table) <integer>
|
|||||||
tcp-request content reject if { src_update_count gt 3 }
|
tcp-request content reject if { src_update_count gt 3 }
|
||||||
server local 127.0.0.1:22
|
server local 127.0.0.1:22
|
||||||
|
|
||||||
|
srv_id <integer>
|
||||||
|
Applies to the server's id. Can be used in frontends or backends.
|
||||||
|
|
||||||
srv_is_up(<server>)
|
srv_is_up(<server>)
|
||||||
srv_is_up(<backend>/<server>)
|
srv_is_up(<backend>/<server>)
|
||||||
Returns true when the designated server is UP, and false when it is either
|
Returns true when the designated server is UP, and false when it is either
|
||||||
|
@ -1386,6 +1386,30 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set test->i to the id of the backend */
|
||||||
|
static int
|
||||||
|
acl_fetch_be_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||||
|
struct acl_expr *expr, struct acl_test *test) {
|
||||||
|
|
||||||
|
test->flags = ACL_TEST_F_READ_ONLY;
|
||||||
|
|
||||||
|
test->i = l4->be->uuid;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set test->i to the id of the server */
|
||||||
|
static int
|
||||||
|
acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||||
|
struct acl_expr *expr, struct acl_test *test) {
|
||||||
|
|
||||||
|
test->flags = ACL_TEST_F_READ_ONLY;
|
||||||
|
|
||||||
|
test->i = l4->srv->puid;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* set test->i to the number of connections per second reaching the backend */
|
/* set test->i to the number of connections per second reaching the backend */
|
||||||
static int
|
static int
|
||||||
acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||||
@ -1482,13 +1506,15 @@ acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir
|
|||||||
|
|
||||||
/* Note: must not be declared <const> as its list will be overwritten */
|
/* Note: must not be declared <const> as its list will be overwritten */
|
||||||
static struct acl_kw_list acl_kws = {{ },{
|
static struct acl_kw_list acl_kws = {{ },{
|
||||||
{ "nbsrv", acl_parse_int, acl_fetch_nbsrv, acl_match_int, ACL_USE_NOTHING },
|
{ "nbsrv", acl_parse_int, acl_fetch_nbsrv, acl_match_int, ACL_USE_NOTHING },
|
||||||
{ "connslots", acl_parse_int, acl_fetch_connslots, acl_match_int, ACL_USE_NOTHING },
|
{ "connslots", acl_parse_int, acl_fetch_connslots, acl_match_int, ACL_USE_NOTHING },
|
||||||
{ "be_sess_rate", acl_parse_int, acl_fetch_be_sess_rate, acl_match_int, ACL_USE_NOTHING },
|
{ "be_id", acl_parse_int, acl_fetch_be_id, acl_match_int, ACL_USE_NOTHING },
|
||||||
{ "be_conn", acl_parse_int, acl_fetch_be_conn, acl_match_int, ACL_USE_NOTHING },
|
{ "be_sess_rate", acl_parse_int, acl_fetch_be_sess_rate, acl_match_int, ACL_USE_NOTHING },
|
||||||
{ "queue", acl_parse_int, acl_fetch_queue_size, acl_match_int, ACL_USE_NOTHING },
|
{ "be_conn", acl_parse_int, acl_fetch_be_conn, acl_match_int, ACL_USE_NOTHING },
|
||||||
{ "avg_queue", acl_parse_int, acl_fetch_avg_queue_size, acl_match_int, ACL_USE_NOTHING },
|
{ "queue", acl_parse_int, acl_fetch_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 },
|
{ "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_NOTHING },
|
||||||
{ NULL, NULL, NULL, NULL },
|
{ NULL, NULL, NULL, NULL },
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user