[master] 1e6affc Refuse vcl.label if it would cause a return(vcl)'ed VCL to return(vcl)
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jan 11 11:30:05 CET 2017
commit 1e6affcea87a2a4444ee54552599577a1509a4b6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jan 11 10:28:18 2017 +0000
Refuse vcl.label if it would cause a return(vcl)'ed VCL to return(vcl)
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 8061634..6791245 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -691,6 +691,18 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
VCLI_Out(cli, "%s is not a label", vpl->name);
return;
}
+ if (!VTAILQ_EMPTY(&vpt->dfrom) &&
+ !VTAILQ_EMPTY(&vpl->dto)) {
+ VCLI_SetResult(cli, CLIS_PARAM);
+ VCLI_Out(cli, "return(vcl) can only be used from"
+ " the active VCL.\n\n");
+ VCLI_Out(cli,
+ "Label %s is used in return(vcl) from VCL %s\n",
+ vpl->name, VTAILQ_FIRST(&vpl->dto)->from->name);
+ VCLI_Out(cli, "and VCL %s also has return(vcl)",
+ vpt->name);
+ return;
+ }
mgt_vcl_dep_del(VTAILQ_FIRST(&vpl->dfrom));
AN(VTAILQ_EMPTY(&vpl->dfrom));
} else {
More information about the varnish-commit
mailing list