mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
BUG/MINOR: bwlim: Fix parameters check for set-bandwidth-limit actions
First, the inspect-delay is now tested if the action is used on a tcp-response content rule. Then, when an expressions scope is checked, we now take care to detect the right scope depending on the ruleset used (tcp-request, tcp-response, http-request or http-response). This patch could be backported to 2.7.
This commit is contained in:
parent
da2e117369
commit
6bf86c73ba
@ -450,10 +450,26 @@ int check_bwlim_action(struct act_rule *rule, struct proxy *px, char **err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
where = 0;
|
where = 0;
|
||||||
if (px->cap & PR_CAP_FE)
|
if (px->cap & PR_CAP_FE) {
|
||||||
where |= (rule->from == ACT_F_HTTP_REQ ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_FE_HRS_HDR);
|
if (rule->from == ACT_F_TCP_REQ_CNT)
|
||||||
if (px->cap & PR_CAP_BE)
|
where |= SMP_VAL_FE_REQ_CNT;
|
||||||
where |= (rule->from == ACT_F_HTTP_REQ ? SMP_VAL_BE_HRQ_HDR : SMP_VAL_BE_HRS_HDR);
|
else if (rule->from == ACT_F_HTTP_REQ)
|
||||||
|
where |= SMP_VAL_FE_HRQ_HDR;
|
||||||
|
else if (rule->from == ACT_F_TCP_RES_CNT)
|
||||||
|
where |= SMP_VAL_FE_RES_CNT;
|
||||||
|
else if (rule->from == ACT_F_HTTP_RES)
|
||||||
|
where |= SMP_VAL_FE_HRS_HDR;
|
||||||
|
}
|
||||||
|
if (px->cap & PR_CAP_BE) {
|
||||||
|
if (rule->from == ACT_F_TCP_REQ_CNT)
|
||||||
|
where |= SMP_VAL_BE_REQ_CNT;
|
||||||
|
else if (rule->from == ACT_F_HTTP_REQ)
|
||||||
|
where |= SMP_VAL_BE_HRQ_HDR;
|
||||||
|
else if (rule->from == ACT_F_TCP_RES_CNT)
|
||||||
|
where |= SMP_VAL_BE_RES_CNT;
|
||||||
|
else if (rule->from == ACT_F_HTTP_RES)
|
||||||
|
where |= SMP_VAL_BE_HRS_HDR;
|
||||||
|
}
|
||||||
|
|
||||||
if ((rule->action & BWLIM_ACT_LIMIT_EXPR) && rule->arg.act.p[1]) {
|
if ((rule->action & BWLIM_ACT_LIMIT_EXPR) && rule->arg.act.p[1]) {
|
||||||
struct sample_expr *expr = rule->arg.act.p[1];
|
struct sample_expr *expr = rule->arg.act.p[1];
|
||||||
@ -473,6 +489,15 @@ int check_bwlim_action(struct act_rule *rule, struct proxy *px, char **err)
|
|||||||
proxy_type_str(px), px->id);
|
proxy_type_str(px), px->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rule->from == ACT_F_TCP_RES_CNT && (px->cap & PR_CAP_BE)) {
|
||||||
|
if (!px->tcp_rep.inspect_delay && !(expr->fetch->val & SMP_VAL_BE_SRV_CON)) {
|
||||||
|
ha_warning("%s '%s' : a 'tcp-response content set-bandwidth-limit*' rule explicitly depending on response"
|
||||||
|
" contents without any 'tcp-response inspect-delay' setting."
|
||||||
|
" This means that this rule will randomly find its contents. This can be fixed by"
|
||||||
|
" setting the tcp-response inspect-delay.\n",
|
||||||
|
proxy_type_str(px), px->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rule->action & BWLIM_ACT_PERIOD_EXPR) && rule->arg.act.p[2]) {
|
if ((rule->action & BWLIM_ACT_PERIOD_EXPR) && rule->arg.act.p[2]) {
|
||||||
@ -491,6 +516,15 @@ int check_bwlim_action(struct act_rule *rule, struct proxy *px, char **err)
|
|||||||
" This means that this rule will randomly find its contents. This can be fixed by"
|
" This means that this rule will randomly find its contents. This can be fixed by"
|
||||||
" setting the tcp-request inspect-delay.\n",
|
" setting the tcp-request inspect-delay.\n",
|
||||||
proxy_type_str(px), px->id);
|
proxy_type_str(px), px->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rule->from == ACT_F_TCP_RES_CNT && (px->cap & PR_CAP_BE)) {
|
||||||
|
if (!px->tcp_rep.inspect_delay && !(expr->fetch->val & SMP_VAL_BE_SRV_CON)) {
|
||||||
|
ha_warning("%s '%s' : a 'tcp-response content set-bandwidth-limit*' rule explicitly depending on response"
|
||||||
|
" contents without any 'tcp-response inspect-delay' setting."
|
||||||
|
" This means that this rule will randomly find its contents. This can be fixed by"
|
||||||
|
" setting the tcp-response inspect-delay.\n",
|
||||||
|
proxy_type_str(px), px->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -511,6 +545,15 @@ int check_bwlim_action(struct act_rule *rule, struct proxy *px, char **err)
|
|||||||
proxy_type_str(px), px->id);
|
proxy_type_str(px), px->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rule->from == ACT_F_TCP_RES_CNT && (px->cap & PR_CAP_BE)) {
|
||||||
|
if (!px->tcp_rep.inspect_delay && !(conf->expr->fetch->val & SMP_VAL_BE_SRV_CON)) {
|
||||||
|
ha_warning("%s '%s' : a 'tcp-response content set-bandwidth-limit*' rule explicitly depending on response"
|
||||||
|
" contents without any 'tcp-response inspect-delay' setting."
|
||||||
|
" This means that this rule will randomly find its contents. This can be fixed by"
|
||||||
|
" setting the tcp-response inspect-delay.\n",
|
||||||
|
proxy_type_str(px), px->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user