[7.0] f5077e639 Use correct list var name in mgt_vcl_discard_depcheck
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Nov 15 14:44:05 UTC 2021
commit f5077e6399a359548beca2c3e5c827dccb5231fb
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Fri Nov 12 11:39:11 2021 +0100
Use correct list var name in mgt_vcl_discard_depcheck
Using the wrong list variable would cause the dependency check to consider
VCLs that were not attempted discarded.
Fixes: #3734
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index df77dd0c8..000b6b11e 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -754,7 +754,7 @@ mgt_vcl_discard_depcheck(struct cli *cli)
struct vclprog *vp;
struct vcldep *vd;
- VTAILQ_FOREACH(vp, &discardhead, list) {
+ VTAILQ_FOREACH(vp, &discardhead, discard_list) {
VTAILQ_FOREACH(vd, &vp->dto, lto)
if (!vd->from->discard) {
mgt_vcl_discard_depfail(cli, vp);
diff --git a/bin/varnishtest/tests/r03734.vtc b/bin/varnishtest/tests/r03734.vtc
new file mode 100644
index 000000000..a34ebefd0
--- /dev/null
+++ b/bin/varnishtest/tests/r03734.vtc
@@ -0,0 +1,44 @@
+varnishtest "Issue 3734 - Discard dependency check and labels"
+
+varnish v1 -vcl {
+ backend default none;
+
+ sub vcl_recv {
+ return (synth(200, "vcl1"));
+ }
+} -start
+
+varnish v1 -vcl {
+ backend default none;
+
+ sub vcl_recv {
+ return (synth(200, "vcl2"));
+ }
+}
+
+varnish v1 -cliok { vcl.label lbl_vcl2 vcl2 }
+
+varnish v1 -vcl {
+ backend default none;
+
+ sub vcl_recv {
+ if (req.url == "/label") {
+ return (vcl(lbl_vcl2));
+ }
+ return (synth(200, "vcl3"));
+ }
+}
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 200
+ expect resp.reason == vcl3
+
+ txreq -url /label
+ rxresp
+ expect resp.status == 200
+ expect resp.reason == vcl2
+} -run
+
+varnish v1 -cliok { vcl.discard vcl1 }
More information about the varnish-commit
mailing list