Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-cluster
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
libvmod-cluster
Commits
43e72d21
Commit
43e72d21
authored
Mar 20, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle .deny / . allow NULL arguments
parent
b0583696
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
vmod_cluster.c
src/vmod_cluster.c
+14
-6
cfg.vtc
src/vtc/cfg.vtc
+16
-0
No files found.
src/vmod_cluster.c
View file @
43e72d21
...
...
@@ -212,21 +212,29 @@ cluster_task_param_r(VRT_CTX, struct vmod_cluster_cluster *vc)
}
static
void
cluster_blacklist_add
(
struct
vmod_cluster_cluster_param
*
p
,
cluster_blacklist_add
(
VRT_CTX
,
struct
vmod_cluster_cluster_param
*
p
,
VCL_BACKEND
b
)
{
CHECK_OBJ_NOTNULL
(
p
,
VMOD_CLUSTER_CLUSTER_PARAM_MAGIC
);
if
(
b
==
NULL
)
{
VRT_fail
(
ctx
,
"Can not deny the NULL backend"
);
return
;
}
assert
(
p
->
nblack
<
p
->
spcblack
);
p
->
blacklist
[
p
->
nblack
++
]
=
b
;
}
static
void
cluster_blacklist_del
(
struct
vmod_cluster_cluster_param
*
p
,
cluster_blacklist_del
(
VRT_CTX
,
struct
vmod_cluster_cluster_param
*
p
,
VCL_BACKEND
b
)
{
int
i
;
CHECK_OBJ_NOTNULL
(
p
,
VMOD_CLUSTER_CLUSTER_PARAM_MAGIC
);
if
(
b
==
NULL
)
{
VRT_fail
(
ctx
,
"Can not allow the NULL backend"
);
return
;
}
for
(
i
=
0
;
i
<
p
->
nblack
;
i
++
)
if
(
p
->
blacklist
[
i
]
==
b
)
{
p
->
nblack
--
;
...
...
@@ -284,7 +292,7 @@ vmod_cluster__init(VRT_CTX,
if
(
args
->
valid_real
)
p
->
real
=
args
->
real
;
if
(
args
->
valid_deny
)
cluster_blacklist_add
(
p
,
args
->
deny
);
cluster_blacklist_add
(
ctx
,
p
,
args
->
deny
);
vc
->
dir
=
VRT_AddDirector
(
ctx
,
vmod_cluster_methods
,
vc
,
"%s"
,
vcl_name
);
}
...
...
@@ -328,7 +336,7 @@ vmod_cluster_deny(VRT_CTX,
return
;
pl
=
cluster_task_param_l
(
ctx
,
vc
,
pr
->
nblack
+
1
,
NULL
);
cluster_blacklist_add
(
pl
,
b
);
cluster_blacklist_add
(
ctx
,
pl
,
b
);
}
VCL_VOID
...
...
@@ -347,7 +355,7 @@ vmod_cluster_allow(VRT_CTX,
return
;
pl
=
cluster_task_param_l
(
ctx
,
vc
,
pr
->
nblack
,
NULL
);
cluster_blacklist_del
(
pl
,
b
);
cluster_blacklist_del
(
ctx
,
pl
,
b
);
}
VCL_BOOL
...
...
@@ -521,7 +529,7 @@ cluster_update_by_args(VRT_CTX, struct vmod_cluster_cluster *vc,
if
(
pl
==
NULL
)
pr
=
pl
=
cluster_task_param_l
(
ctx
,
vc
,
++
nblack
,
spc
);
cluster_blacklist_add
(
pl
,
arg
->
deny
);
cluster_blacklist_add
(
ctx
,
pl
,
arg
->
deny
);
}
if
(
arg
->
valid_real
&&
pr
->
real
!=
arg
->
real
)
{
if
(
pl
==
NULL
)
...
...
src/vtc/cfg.vtc
View file @
43e72d21
...
...
@@ -193,3 +193,19 @@ client c1 {
} -run
logexpect l1 -wait
varnish v1 -errvcl {Can not deny the NULL backend} {
import cluster;
import directors;
backend dummy { .host = "${bad_ip}"; }
sub vcl_init {
new rr = directors.round_robin();
rr.add_backend(dummy);
new cl = cluster.cluster(
rr.backend(),
deny=directors.lookup("null"),
real=dummy);
}
}
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