mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
[MINOR] report in the proxies the requirements for ACLs
This patch propagates the ACL conditions' "requires" bitfield to the proxies. This makes it possible to know exactly what a proxy might have to support for any request, which helps knowing whether we have to allocate some space for certain types of structures or not (eg: the hdr_idx struct). The concept might be extended to a lot more types of information, such as detecting whether we need to allocate some space for some request ACLs which need a result in the response, etc...
This commit is contained in:
parent
1d0dfb155d
commit
a9fb08317f
@ -162,6 +162,7 @@ struct proxy {
|
||||
unsigned int inspect_delay; /* inspection delay */
|
||||
struct list inspect_rules; /* inspection rules */
|
||||
} tcp_req;
|
||||
int acl_requires; /* Elements required to satisfy all ACLs (ACL_USE_*) */
|
||||
struct server *srv; /* known servers */
|
||||
int srv_act, srv_bck; /* # of servers eligible for LB (UP|!checked) AND (enabled+weight!=0) */
|
||||
|
||||
|
@ -1360,6 +1360,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
return -1;
|
||||
}
|
||||
cond->line = linenum;
|
||||
curproxy->acl_requires |= cond->requires;
|
||||
LIST_ADDQ(&curproxy->block_cond, &cond->list);
|
||||
warnif_misplaced_block(curproxy, file, linenum, args[0]);
|
||||
}
|
||||
@ -1475,6 +1476,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
|
||||
cond->line = linenum;
|
||||
curproxy->acl_requires |= cond->requires;
|
||||
rule = (struct redirect_rule *)calloc(1, sizeof(*rule));
|
||||
rule->cond = cond;
|
||||
rule->rdr_str = strdup(destination);
|
||||
@ -1536,6 +1538,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
|
||||
cond->line = linenum;
|
||||
curproxy->acl_requires |= cond->requires;
|
||||
if (cond->requires & ACL_USE_RTR_ANY) {
|
||||
struct acl *acl;
|
||||
const char *name;
|
||||
@ -1921,6 +1924,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
return -1;
|
||||
}
|
||||
cond->line = linenum;
|
||||
curproxy->acl_requires |= cond->requires;
|
||||
LIST_ADDQ(&curproxy->mon_fail_cond, &cond->list);
|
||||
}
|
||||
else {
|
||||
@ -3442,6 +3446,7 @@ int check_config_validity()
|
||||
break;
|
||||
|
||||
case PR_MODE_HTTP:
|
||||
curproxy->acl_requires |= ACL_USE_L7_ANY;
|
||||
if ((curproxy->cookie_name != NULL) && (curproxy->srv == NULL)) {
|
||||
Alert("config : HTTP proxy %s has a cookie but no server list !\n",
|
||||
curproxy->id);
|
||||
|
@ -539,6 +539,8 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
|
||||
|
||||
// FIXME: how to set this ?
|
||||
// cond->line = linenum;
|
||||
if (cond)
|
||||
curpx->acl_requires |= cond->requires;
|
||||
if (cond && cond->requires & (ACL_USE_RTR_ANY | ACL_USE_L7_ANY)) {
|
||||
struct acl *acl;
|
||||
const char *name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user