mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
[MINOR] acl: add fe_id/so_id to match frontend's and socket's id
This commit is contained in:
parent
b937b7e3b3
commit
346f76ddbd
@ -5604,6 +5604,13 @@ fe_conn(frontend) <integer>
|
|||||||
considered saturated. See also the "dst_conn", "be_conn" and "fe_sess_rate"
|
considered saturated. See also the "dst_conn", "be_conn" and "fe_sess_rate"
|
||||||
criteria.
|
criteria.
|
||||||
|
|
||||||
|
fe_id <integer>
|
||||||
|
Applies to the fronted's id. Can be used in backends to check from which
|
||||||
|
frontend it was called.
|
||||||
|
|
||||||
|
so_id <integer>
|
||||||
|
Applies to the socket's id. Useful in frontends with many bind keywords.
|
||||||
|
|
||||||
be_conn <integer>
|
be_conn <integer>
|
||||||
be_conn(frontend) <integer>
|
be_conn(frontend) <integer>
|
||||||
Applies to the number of currently established connections on the backend,
|
Applies to the number of currently established connections on the backend,
|
||||||
|
26
src/client.c
26
src/client.c
@ -610,6 +610,30 @@ acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set test->i to the id of the frontend */
|
||||||
|
static int
|
||||||
|
acl_fetch_fe_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->fe->uuid;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set test->i to the id of the socket (listener) */
|
||||||
|
static int
|
||||||
|
acl_fetch_so_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->listener->luid;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 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 = {{ },{
|
||||||
@ -621,6 +645,8 @@ static struct acl_kw_list acl_kws = {{ },{
|
|||||||
{ "src_limit", acl_parse_int, acl_fetch_sconn, acl_match_int },
|
{ "src_limit", acl_parse_int, acl_fetch_sconn, acl_match_int },
|
||||||
#endif
|
#endif
|
||||||
{ "dst_conn", acl_parse_int, acl_fetch_dconn, acl_match_int, ACL_USE_NOTHING },
|
{ "dst_conn", acl_parse_int, acl_fetch_dconn, acl_match_int, ACL_USE_NOTHING },
|
||||||
|
{ "fe_id", acl_parse_int, acl_fetch_fe_id, acl_match_int, ACL_USE_NOTHING },
|
||||||
|
{ "so_id", acl_parse_int, acl_fetch_so_id, acl_match_int, ACL_USE_NOTHING },
|
||||||
{ NULL, NULL, NULL, NULL },
|
{ NULL, NULL, NULL, NULL },
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user