[master] 0ce0d37c3 Clean up the mgt->vcc interface for vcc_acl_pedantic
Nils Goroll
nils.goroll at uplex.de
Sat Apr 4 13:12:08 UTC 2020
commit 0ce0d37c3df9dbc47afabe3360ea37e51db5d9f7
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sat Apr 4 14:59:28 2020 +0200
Clean up the mgt->vcc interface for vcc_acl_pedantic
Spotted by flexelint
Ref: 6c8f25e712bcd59b85a0486044eba740848a739b
diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index 8f742e16c..39e9ddcd3 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -68,6 +68,7 @@ const char *mgt_vmod_path;
unsigned mgt_vcc_err_unref;
unsigned mgt_vcc_allow_inline_c;
unsigned mgt_vcc_unsafe_path;
+unsigned mgt_vcc_acl_pedantic;
#define VGC_SRC "vgc.c"
@@ -109,6 +110,7 @@ run_vcc(void *priv)
VCC_Err_Unref(vcc, mgt_vcc_err_unref);
VCC_Allow_InlineC(vcc, mgt_vcc_allow_inline_c);
VCC_Unsafe_Path(vcc, mgt_vcc_unsafe_path);
+ VCC_Acl_Pedantic(vcc, mgt_vcc_acl_pedantic);
STV_Foreach(stv)
VCC_Predef(vcc, "VCL_STEVEDORE", stv->ident);
VTAILQ_FOREACH(vpg, &vclhead, list)
diff --git a/include/libvcc.h b/include/libvcc.h
index 3bf2d1ea1..63cd136a0 100644
--- a/include/libvcc.h
+++ b/include/libvcc.h
@@ -37,6 +37,7 @@ void VCC_Allow_InlineC(struct vcc *, unsigned);
void VCC_Builtin_VCL(struct vcc *, const char *);
void VCC_Err_Unref(struct vcc *, unsigned);
void VCC_Unsafe_Path(struct vcc *, unsigned);
+void VCC_Acl_Pedantic(struct vcc *, unsigned);
void VCC_VCL_path(struct vcc *, const char *);
void VCC_VMOD_path(struct vcc *, const char *);
void VCC_Predef(struct vcc *, const char *type, const char *name);
diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index 274f158de..c3fb9a6ce 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -43,8 +43,6 @@
#include <vtcp.h>
#include <vsa.h>
-unsigned mgt_vcc_acl_pedantic;
-
#define ACL_MAXADDR (sizeof(struct in6_addr) + 1)
struct acl_e {
@@ -140,12 +138,12 @@ vcc_acl_chk(struct vcc *tl, const struct acl_e *ae, const int l,
AN(sa);
VTCP_name(sa, h, sizeof h, NULL, 0);
bprintf(t, "%s/%d", h, ae->mask);
- if (mgt_vcc_acl_pedantic)
+ if (tl->acl_pedantic != 0)
VSB_printf(tl->sb, "Address/Netmask mismatch, need be %s\n", t);
else
VSB_printf(tl->sb, "Address/Netmask mismatch, changed to %s\n", t);
vcc_ErrWhere(tl, ae->t_addr);
- if (mgt_vcc_acl_pedantic == 0)
+ if (tl->acl_pedantic == 0)
vcc_Warn(tl);
return (strdup(t));
}
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 87c6614e9..94fabd984 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -913,6 +913,14 @@ VCC_Unsafe_Path(struct vcc *vcc, unsigned u)
vcc->unsafe_path = u;
}
+void
+VCC_Acl_Pedantic(struct vcc *vcc, unsigned u)
+{
+
+ CHECK_OBJ_NOTNULL(vcc, VCC_MAGIC);
+ vcc->acl_pedantic = u;
+}
+
/*--------------------------------------------------------------------
* Configure settings
*/
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 6a291c50b..f47b6dede 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -222,6 +222,7 @@ struct vcc {
unsigned err_unref;
unsigned allow_inline_c;
unsigned unsafe_path;
+ unsigned acl_pedantic;
struct symtab *syms;
More information about the varnish-commit
mailing list