Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent3
Commits
474b9fce
Commit
474b9fce
authored
May 23, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also check for duplicate definitions of backends, probes and acls.
parent
b3484a49
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
4 deletions
+33
-4
v00034.vtc
bin/varnishtest/tests/v00034.vtc
+12
-1
vcc_acl.c
lib/libvcl/vcc_acl.c
+7
-1
vcc_backend.c
lib/libvcl/vcc_backend.c
+13
-1
vcc_parse.c
lib/libvcl/vcc_parse.c
+1
-1
No files found.
bin/varnishtest/tests/v00034.vtc
View file @
474b9fce
varnishtest "Test sub redefinition"
varnishtest "Test sub
and backend
redefinition"
server s1 {
rxreq
...
...
@@ -13,3 +13,14 @@ varnish v1 -badvcl {
sub c1 { }
sub vcl_recv { call c1; }
}
varnish v1 -badvcl {
backend s1 { .host = "127.0.0.1"; }
backend s1 { .host = "127.0.0.1"; }
}
varnish v1 -badvcl {
backend s1 { .host = "127.0.0.1"; .probe = p1;}
probe p1 { }
probe p1 { }
}
lib/libvcl/vcc_acl.c
View file @
474b9fce
...
...
@@ -465,6 +465,7 @@ void
vcc_Acl
(
struct
vcc
*
tl
)
{
struct
token
*
an
;
int
i
;
char
acln
[
1024
];
vcc_NextToken
(
tl
);
...
...
@@ -474,7 +475,12 @@ vcc_Acl(struct vcc *tl)
an
=
tl
->
t
;
vcc_NextToken
(
tl
);
vcc_AddDef
(
tl
,
an
,
SYM_ACL
);
i
=
vcc_AddDef
(
tl
,
an
,
SYM_ACL
);
if
(
i
>
1
)
{
vsb_printf
(
tl
->
sb
,
"ACL %.*s redefined
\n
"
,
PF
(
an
));
vcc_ErrWhere
(
tl
,
an
);
return
;
}
bprintf
(
acln
,
"%.*s"
,
PF
(
an
));
SkipToken
(
tl
,
'{'
);
...
...
lib/libvcl/vcc_backend.c
View file @
474b9fce
...
...
@@ -412,6 +412,7 @@ void
vcc_ParseProbe
(
struct
vcc
*
tl
)
{
struct
token
*
t_probe
;
int
i
;
vcc_NextToken
(
tl
);
/* ID: probe */
...
...
@@ -419,7 +420,11 @@ vcc_ParseProbe(struct vcc *tl)
ERRCHK
(
tl
);
t_probe
=
tl
->
t
;
vcc_NextToken
(
tl
);
vcc_AddDef
(
tl
,
t_probe
,
SYM_PROBE
);
i
=
vcc_AddDef
(
tl
,
t_probe
,
SYM_PROBE
);
if
(
i
>
1
)
{
vsb_printf
(
tl
->
sb
,
"Probe %.*s redefined
\n
"
,
PF
(
t_probe
));
vcc_ErrWhere
(
tl
,
t_probe
);
}
Fh
(
tl
,
0
,
"
\n
#define vgc_probe_%.*s
\t
vgc_probe__%d
\n
"
,
PF
(
t_probe
),
tl
->
nprobe
);
...
...
@@ -682,6 +687,11 @@ vcc_DefBackend(struct vcc *tl, const struct token *nm)
sym
=
VCC_GetSymbolTok
(
tl
,
nm
,
SYM_BACKEND
);
AN
(
sym
);
if
(
sym
->
ndef
>
0
)
{
vsb_printf
(
tl
->
sb
,
"Backend %.*s redefined
\n
"
,
PF
(
tl
->
t
));
vcc_ErrWhere
(
tl
,
nm
);
return
;
}
sym
->
fmt
=
BACKEND
;
sym
->
eval
=
vcc_Eval_Backend
;
sym
->
ndef
++
;
...
...
@@ -700,6 +710,7 @@ vcc_ParseSimpleDirector(struct vcc *tl)
h
=
TlAlloc
(
tl
,
sizeof
*
h
);
h
->
name
=
tl
->
t_dir
;
vcc_DefBackend
(
tl
,
tl
->
t_dir
);
ERRCHK
(
tl
);
sprintf
(
vgcname
,
"_%.*s"
,
PF
(
h
->
name
));
h
->
vgcname
=
TlAlloc
(
tl
,
strlen
(
vgcname
)
+
1
);
strcpy
(
h
->
vgcname
,
vgcname
);
...
...
@@ -748,6 +759,7 @@ vcc_ParseDirector(struct vcc *tl)
vcc_ParseSimpleDirector
(
tl
);
}
else
{
vcc_DefBackend
(
tl
,
tl
->
t_dir
);
ERRCHK
(
tl
);
ExpectErr
(
tl
,
ID
);
/* ID: policy */
tl
->
t_policy
=
tl
->
t
;
vcc_NextToken
(
tl
);
...
...
lib/libvcl/vcc_parse.c
View file @
474b9fce
...
...
@@ -204,7 +204,7 @@ vcc_Function(struct vcc *tl)
assert
(
m
<
VCL_MET_MAX
);
tl
->
fb
=
tl
->
fm
[
m
];
if
(
tl
->
mprocs
[
m
]
==
NULL
)
{
vcc_AddDef
(
tl
,
tl
->
t
,
SYM_SUB
);
(
void
)
vcc_AddDef
(
tl
,
tl
->
t
,
SYM_SUB
);
vcc_AddRef
(
tl
,
tl
->
t
,
SYM_SUB
);
tl
->
mprocs
[
m
]
=
vcc_AddProc
(
tl
,
tl
->
t
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment