MINOR: proxy: Remove the unused list of block rules

The keyword "block" is now unsupported. So the list of block rules is now
unused. It can be safely removed from the structure proxy.
This commit is contained in:
Christopher Faulet 2019-07-17 15:19:51 +02:00
parent a6a56e6483
commit 8c3b63ae1d
4 changed files with 1 additions and 39 deletions

View File

@ -312,7 +312,6 @@ struct proxy {
struct list acl; /* ACL declared on this proxy */ struct list acl; /* ACL declared on this proxy */
struct list http_req_rules; /* HTTP request rules: allow/deny/... */ struct list http_req_rules; /* HTTP request rules: allow/deny/... */
struct list http_res_rules; /* HTTP response rules: allow/deny/... */ struct list http_res_rules; /* HTTP response rules: allow/deny/... */
struct list block_rules; /* http-request block rules to be inserted before other ones */
struct list redirect_rules; /* content redirecting rules (chained) */ struct list redirect_rules; /* content redirecting rules (chained) */
struct list switching_rules; /* content switching rules (chained) */ struct list switching_rules; /* content switching rules (chained) */
struct list persist_rules; /* 'force-persist' and 'ignore-persist' rules (chained) */ struct list persist_rules; /* 'force-persist' and 'ignore-persist' rules (chained) */

View File

@ -66,19 +66,6 @@ int warnif_rule_after_monitor(struct proxy *proxy, const char *file, int line, c
return 0; return 0;
} }
/* Report a warning if a rule is placed after a 'block' rule.
* Return 1 if the warning has been emitted, otherwise 0.
*/
int warnif_rule_after_block(struct proxy *proxy, const char *file, int line, const char *arg)
{
if (!LIST_ISEMPTY(&proxy->block_rules)) {
ha_warning("parsing [%s:%d] : a '%s' rule placed after a 'block' rule will still be processed before.\n",
file, line, arg);
return 1;
}
return 0;
}
/* Report a warning if a rule is placed after an 'http_request' rule. /* Report a warning if a rule is placed after an 'http_request' rule.
* Return 1 if the warning has been emitted, otherwise 0. * Return 1 if the warning has been emitted, otherwise 0.
*/ */
@ -186,19 +173,12 @@ int warnif_misplaced_http_req(struct proxy *proxy, const char *file, int line, c
} }
/* report a warning if a block rule is dangerously placed */ /* report a warning if a block rule is dangerously placed */
int warnif_misplaced_block(struct proxy *proxy, const char *file, int line, const char *arg) int warnif_misplaced_monitor(struct proxy *proxy, const char *file, int line, const char *arg)
{ {
return warnif_rule_after_http_req(proxy, file, line, arg) || return warnif_rule_after_http_req(proxy, file, line, arg) ||
warnif_misplaced_http_req(proxy, file, line, arg); warnif_misplaced_http_req(proxy, file, line, arg);
} }
/* report a warning if a block rule is dangerously placed */
int warnif_misplaced_monitor(struct proxy *proxy, const char *file, int line, const char *arg)
{
return warnif_rule_after_block(proxy, file, line, arg) ||
warnif_misplaced_block(proxy, file, line, arg);
}
/* report a warning if a "tcp request content" rule is dangerously placed */ /* report a warning if a "tcp request content" rule is dangerously placed */
int warnif_misplaced_tcp_cont(struct proxy *proxy, const char *file, int line, const char *arg) int warnif_misplaced_tcp_cont(struct proxy *proxy, const char *file, int line, const char *arg)
{ {

View File

@ -2813,16 +2813,6 @@ int check_config_validity()
} }
} }
/* move any "block" rules at the beginning of the http-request rules */
if (!LIST_ISEMPTY(&curproxy->block_rules)) {
/* insert block_rules into http_req_rules at the beginning */
curproxy->block_rules.p->n = curproxy->http_req_rules.n;
curproxy->http_req_rules.n->p = curproxy->block_rules.p;
curproxy->block_rules.n->p = &curproxy->http_req_rules;
curproxy->http_req_rules.n = curproxy->block_rules.n;
LIST_INIT(&curproxy->block_rules);
}
if (curproxy->table && curproxy->table->peers.name) { if (curproxy->table && curproxy->table->peers.name) {
struct peers *curpeers; struct peers *curpeers;
@ -3374,12 +3364,6 @@ out_uri_auth_compat:
err_code |= ERR_WARN; err_code |= ERR_WARN;
} }
if (!LIST_ISEMPTY(&curproxy->block_rules)) {
ha_warning("config : 'block' rules ignored for %s '%s' as they require HTTP mode.\n",
proxy_type_str(curproxy), curproxy->id);
err_code |= ERR_WARN;
}
if (!LIST_ISEMPTY(&curproxy->redirect_rules)) { if (!LIST_ISEMPTY(&curproxy->redirect_rules)) {
ha_warning("config : 'redirect' rules ignored for %s '%s' as they require HTTP mode.\n", ha_warning("config : 'redirect' rules ignored for %s '%s' as they require HTTP mode.\n",
proxy_type_str(curproxy), curproxy->id); proxy_type_str(curproxy), curproxy->id);

View File

@ -862,7 +862,6 @@ void init_new_proxy(struct proxy *p)
LIST_INIT(&p->acl); LIST_INIT(&p->acl);
LIST_INIT(&p->http_req_rules); LIST_INIT(&p->http_req_rules);
LIST_INIT(&p->http_res_rules); LIST_INIT(&p->http_res_rules);
LIST_INIT(&p->block_rules);
LIST_INIT(&p->redirect_rules); LIST_INIT(&p->redirect_rules);
LIST_INIT(&p->mon_fail_cond); LIST_INIT(&p->mon_fail_cond);
LIST_INIT(&p->switching_rules); LIST_INIT(&p->switching_rules);