Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
038557a7
Commit
038557a7
authored
Feb 23, 2016
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test VMOD ACLs using vmod-debug
parent
9e07b947
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
+48
-0
m00023.vtc
bin/varnishtest/tests/m00023.vtc
+32
-0
vmod.vcc
lib/libvmod_debug/vmod.vcc
+4
-0
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+12
-0
No files found.
bin/varnishtest/tests/m00023.vtc
0 → 100644
View file @
038557a7
varnishtest "Test VMOD ACLs"
varnish v1 -vcl {
import debug;
backend dummy {
.host = "${bad_ip}";
}
acl loopback {
"127"/24;
}
sub vcl_init {
if (!debug.match_acl(loopback, "127.0.0.127")) {
debug.init_fail();
}
}
sub vcl_recv {
if (debug.match_acl(loopback, client.ip)) {
return (synth(200));
}
return (synth(500));
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
} -run
lib/libvmod_debug/vmod.vcc
View file @
038557a7
...
...
@@ -150,3 +150,7 @@ Reset to the previous snapshot of a workspace, taken from debug.workspace_snap.
$Function VOID vcl_release_delay(DURATION)
Hold a reference to the VCL when it goes cold for the given delay.
$Function BOOL match_acl(ACL acl, IP ip)
Perform an IP match against a named ACL.
lib/libvmod_debug/vmod_debug.c
View file @
038557a7
...
...
@@ -36,6 +36,7 @@
#include "vcl.h"
#include "vrt.h"
#include "vsa.h"
#include "vsb.h"
#include "vtim.h"
#include "vcc_if.h"
...
...
@@ -466,3 +467,14 @@ vmod_vcl_release_delay(VRT_CTX, VCL_DURATION delay)
assert
(
delay
>
0
.
0
);
vcl_release_delay
=
delay
;
}
VCL_BOOL
vmod_match_acl
(
VRT_CTX
,
VCL_ACL
acl
,
VCL_IP
ip
)
{
CHECK_OBJ_ORNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_ORNULL
(
acl
,
VRT_ACL_MAGIC
);
assert
(
VSA_Sane
(
ip
));
return
(
VRT_acl_match
(
ctx
,
acl
,
ip
));
}
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