Commit 1ca122e4 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Error earlier if we cannot find the probe

We don't have forward declarations in VCL.  OK'd by phk@.
Fixes #1837.
parent 8c77b5df
varnishtest "Test VCC errors out if probe is used before it is defined"
varnish v1 -errvcl "Probe p not found" {
backend b {
.host = "127.0.0.1";
.probe = p;
}
probe p {
}
}
......@@ -20,7 +20,7 @@ varnish v1 -errvcl {Backend s1 redefined} {
}
varnish v1 -errvcl {Probe p1 redefined} {
backend s1 { .host = "127.0.0.1"; .probe = p1;}
probe p1 { }
probe p1 { }
backend s1 { .host = "127.0.0.1"; .probe = p1;}
}
......@@ -384,6 +384,12 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
Fb(tl, 0, "\t.probe = &%s,\n", p);
ERRCHK(tl);
} else if (vcc_IdIs(t_field, "probe") && tl->t->tok == ID) {
if (VCC_FindSymbol(tl, tl->t, SYM_PROBE) == NULL) {
VSB_printf(tl->sb, "Probe %.*s not found\n",
PF(tl->t));
vcc_ErrWhere(tl, tl->t);
return;
}
Fb(tl, 0, "\t.probe = &vgc_probe_%.*s,\n", PF(tl->t));
vcc_AddRef(tl, tl->t, SYM_PROBE);
vcc_NextToken(tl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment