[master] 1c759b8 Move acls to vrt_ctx
Poul-Henning Kamp
phk at varnish-cache.org
Tue Apr 30 11:52:06 CEST 2013
commit 1c759b879db8551b5d3689c80ca726eb2603bb2a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Apr 30 09:51:58 2013 +0000
Move acls to vrt_ctx
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 8449a6a..8d361b1 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -98,10 +98,11 @@ VRT_count(const struct vrt_ctx *ctx, unsigned u)
/*--------------------------------------------------------------------*/
void
-VRT_acl_log(struct req *req, const char *msg)
+VRT_acl_log(const struct vrt_ctx *ctx, const char *msg)
{
- VSLb(req->vsl, SLT_VCL_acl, "%s", msg);
+ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+ VSLb(ctx->vsl, SLT_VCL_acl, "%s", msg);
}
/*--------------------------------------------------------------------*/
diff --git a/include/vrt.h b/include/vrt.h
index b0e752f..2e230ad 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -182,7 +182,7 @@ struct vrt_ref {
/* ACL related */
#define VRT_ACL_MAXADDR 16 /* max(IPv4, IPv6) */
-void VRT_acl_log(struct req *, const char *msg);
+void VRT_acl_log(const struct vrt_ctx *, const char *msg);
/* req related */
diff --git a/lib/libvcl/vcc_acl.c b/lib/libvcl/vcc_acl.c
index d3db319..9c9e117 100644
--- a/lib/libvcl/vcc_acl.c
+++ b/lib/libvcl/vcc_acl.c
@@ -357,7 +357,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
const char *oc;
Fh(tl, 0, "\nstatic int\n");
- Fh(tl, 0, "match_acl_%s_%s(struct req *req, const void *p)\n",
+ Fh(tl, 0, "match_acl_%s_%s(const struct vrt_ctx *ctx, const void *p)\n",
anon ? "anon" : "named", acln);
Fh(tl, 0, "{\n");
Fh(tl, 0, "\tconst unsigned char *a;\n");
@@ -372,7 +372,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
Fh(tl, 0, "\telse if (fam == %d)\n", PF_INET6);
Fh(tl, 0, "\t\ta += %zd;\n", offsetof(struct sockaddr_in6, sin6_addr));
Fh(tl, 0, "\telse {\n");
- Fh(tl, 0, "\t\tVRT_acl_log(req, \"NO_FAM %s\");\n", acln);
+ Fh(tl, 0, "\t\tVRT_acl_log(ctx, \"NO_FAM %s\");\n", acln);
Fh(tl, 0, "\t\treturn(0);\n");
Fh(tl, 0, "\t}\n\n");
depth = -1;
@@ -424,7 +424,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
i = (ae->mask + 7) / 8;
if (!anon) {
- Fh(tl, 0, "\t%*sVRT_acl_log(req, \"%sMATCH %s \" ",
+ Fh(tl, 0, "\t%*sVRT_acl_log(ctx, \"%sMATCH %s \" ",
-i, "", ae->not ? "NEG_" : "", acln);
EncToken(tl->fh, ae->t_addr);
if (ae->t_mask != NULL)
@@ -441,7 +441,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
/* Deny by default */
if (!anon)
- Fh(tl, 0, "\tVRT_acl_log(req, \"NO_MATCH %s\");\n", acln);
+ Fh(tl, 0, "\tVRT_acl_log(ctx, \"NO_MATCH %s\");\n", acln);
Fh(tl, 0, "\treturn (0);\n}\n");
}
@@ -457,7 +457,7 @@ vcc_Acl_Hack(struct vcc *tl, char *b)
bprintf(acln, "%u", tl->unique++);
vcc_acl_entry(tl);
vcc_acl_emit(tl, acln, 1);
- sprintf(b, "%smatch_acl_anon_%s(req, \v1)",
+ sprintf(b, "%smatch_acl_anon_%s(ctx, \v1)",
(tcond == T_NEQ ? "!" : ""), acln);
}
diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 715a4c9..ab3175e 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -1012,7 +1012,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
vcc_NextToken(tl);
ExpectErr(tl, ID);
vcc_AddRef(tl, tl->t, SYM_ACL);
- bprintf(buf, "%smatch_acl_named_%.*s(req, \v1)",
+ bprintf(buf, "%smatch_acl_named_%.*s(ctx, \v1)",
not, PF(tl->t));
vcc_NextToken(tl);
*e = vcc_expr_edit(BOOL, buf, *e, NULL);
More information about the varnish-commit
mailing list