[master] 17b53dbe5 param: Introduce the notion of VCC parameters

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 21 17:24:13 UTC 2020


commit 17b53dbe5568bce71a271779b7dc739c243890ba
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Oct 21 17:40:37 2020 +0200

    param: Introduce the notion of VCC parameters
    
    Just like string parameters, they need to be guarded by PARAM_ALL since
    they are not inherited by the cache process.
    
    Refs #3250

diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c
index 4ee4e23f3..5b295208b 100644
--- a/bin/varnishd/mgt/mgt_param_tbl.c
+++ b/bin/varnishd/mgt/mgt_param_tbl.c
@@ -43,32 +43,6 @@ struct parspec mgt_parspec[] = {
 #define PARAM(ty, nm, ...) { #nm, __VA_ARGS__ },
 #include "tbl/params.h"
 
-	{ "vcc_err_unref", tweak_bool, &mgt_vcc_err_unref,
-		NULL, NULL, "on",
-		"bool",
-		"Unreferenced VCL objects result in error." },
-	{ "vcc_acl_pedantic", tweak_bool, &mgt_vcc_acl_pedantic,
-		NULL, NULL, "off",
-		"bool",
-		"Insist that network numbers used in ACLs have an "
-		"all-zero host part, e.g. make 1.2.3.4/24 an error.\n"
-		"With this option set to off (the default), the host "
-		"part of network numbers is being fixed to all-zeroes "
-		"(e.g. the above changed to 1.2.3.0/24), a warning is "
-		"output during VCL compilation and any ACL entry hits "
-		"are logged with the fixed address as \"fixed: ...\" "
-		"after the original VCL entry.\n"
-		"With this option set to on, any ACL entries with non-zero "
-		"host parts cause VCL compilation to fail." },
-	{ "vcc_allow_inline_c", tweak_bool, &mgt_vcc_allow_inline_c,
-		NULL, NULL, "off",
-		"bool",
-		"Allow inline C code in VCL." },
-	{ "vcc_unsafe_path", tweak_bool, &mgt_vcc_unsafe_path,
-		NULL, NULL, "on",
-		"bool",
-		"Allow '/' in vmod & include paths.\n"
-		"Allow 'import ... from ...'." },
 	{ "pcre_match_limit", tweak_uint,
 		&mgt_param.vre_limits.match,
 		"1", NULL, "10000",
diff --git a/include/tbl/params.h b/include/tbl/params.h
index 4209669d9..139565924 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -1304,8 +1304,54 @@ PARAM_STRING(
 	"where VMODs are to be found."
 )
 
+/*--------------------------------------------------------------------
+ * VCC parameters
+ */
+
+#  define PARAM_VCC(nm, def, descr) \
+	PARAM(, nm, tweak_bool, &mgt_ ## nm, NULL, NULL, def, "bool", descr)
+
+PARAM_VCC(
+	/* name */	vcc_err_unref,
+	/* def */	"on",
+	/* descr */
+	"Unreferenced VCL objects result in error."
+)
+
+PARAM_VCC(
+	/* name */	vcc_acl_pedantic,
+	/* def */	"off",
+	/* descr */
+	"Insist that network numbers used in ACLs have an "
+	"all-zero host part, e.g. make 1.2.3.4/24 an error.\n"
+	"With this option set to off (the default), the host "
+	"part of network numbers is being fixed to all-zeroes "
+	"(e.g. the above changed to 1.2.3.0/24), a warning is "
+	"output during VCL compilation and any ACL entry hits "
+	"are logged with the fixed address as \"fixed: ...\" "
+	"after the original VCL entry.\n"
+	"With this option set to on, any ACL entries with non-zero "
+	"host parts cause VCL compilation to fail."
+)
+
+PARAM_VCC(
+	/* name */	vcc_allow_inline_c,
+	/* def */	"off",
+	/* descr */
+	"Allow inline C code in VCL."
+)
+
+PARAM_VCC(
+	/* name */	vcc_unsafe_path,
+	/* def */	"on",
+	/* descr */
+	"Allow '/' in vmod & include paths.\n"
+	"Allow 'import ... from ...'."
+)
+
 #  undef PARAM_ALL
 #  undef PARAM_STRING
+#  undef PARAM_VCC
 #endif /* defined(PARAM_ALL) */
 
 #undef PARAM_SIMPLE
@@ -1614,63 +1660,6 @@ PARAM(
 	/* flags */	EXPERIMENTAL
 )
 
-/* actual location mgt_param_tbl.c */
-PARAM(
-	/* name */	vcc_acl_pedantic,
-	/* type */	bool,
-	/* min */	NULL,
-	/* max */	NULL,
-	/* def */	"off",	// XXX change to on in 7.x ?
-	/* units */	"bool",
-	/* descr */
-	"Insist that network numbers used in ACLs have an all-zero host part, "
-	"e.g. make 1.2.3.4/24 an error.\n"
-	"With this option set to off (the default), the host part of network "
-	"numbers is being fixed to all-zeroes (e.g. the above changed to "
-	"1.2.3.0/24), a warning is output during VCL compilation and any ACL "
-	"entry hits are logged with the fixed address as \"fixed: ...\" "
-	"after the original VCL entry.\n"
-	"With this option set to on, any ACL entries with non-zero host parts "
-	"cause VCL compilation to fail."
-)
-
-/* actual location mgt_param_tbl.c */
-PARAM(
-	/* name */	vcc_allow_inline_c,
-	/* type */	bool,
-	/* min */	NULL,
-	/* max */	NULL,
-	/* def */	"off",
-	/* units */	"bool",
-	/* descr */
-	"Allow inline C code in VCL."
-)
-
-/* actual location mgt_param_tbl.c */
-PARAM(
-	/* name */	vcc_err_unref,
-	/* type */	bool,
-	/* min */	NULL,
-	/* max */	NULL,
-	/* def */	"on",
-	/* units */	"bool",
-	/* descr */
-	"Unreferenced VCL objects result in error."
-)
-
-/* actual location mgt_param_tbl.c */
-PARAM(
-	/* name */	vcc_unsafe_path,
-	/* type */	bool,
-	/* min */	NULL,
-	/* max */	NULL,
-	/* def */	"on",
-	/* units */	"bool",
-	/* descr */
-	"Allow '/' in vmod & include paths.\n"
-	"Allow 'import ... from ...'."
-)
-
 /* actual location mgt_param_bits.c*/
 PARAM(
 	/* name */	vsl_mask,


More information about the varnish-commit mailing list