Silence all warnings that stem from the default config
As we now setup the logging very early, parsing the default config would
always print warnings about experimental (and possibly deprecated)
options in the default config. This would even mess with commands like
`named -V` and it is also wrong to warn users about using experimental
options in the default config, because they can't do anything about
this. Add CFG_PCTX_NODEPRECATED and CFG_PCTX_NOEXPERIMENTAL options
that we can pass to cfg parser and silence the early warnings caused by
using experimental options in the default config.
(cherry picked from commit 86f1ec34dc)
This commit is contained in:
@@ -356,7 +356,9 @@ named_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
|
||||
isc_buffer_init(&b, defaultconf, sizeof(defaultconf) - 1);
|
||||
isc_buffer_add(&b, sizeof(defaultconf) - 1);
|
||||
return (cfg_parse_buffer(parser, &b, __FILE__, 0, &cfg_type_namedconf,
|
||||
CFG_PCTX_NODEPRECATED, conf));
|
||||
CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
|
||||
CFG_PCTX_NOEXPERIMENTAL,
|
||||
conf));
|
||||
}
|
||||
|
||||
const char *
|
||||
|
||||
@@ -258,8 +258,10 @@ struct cfg_parser {
|
||||
};
|
||||
|
||||
/* Parser context flags */
|
||||
#define CFG_PCTX_SKIP 0x1
|
||||
#define CFG_PCTX_NODEPRECATED 0x2
|
||||
#define CFG_PCTX_SKIP (1 << 0)
|
||||
#define CFG_PCTX_NODEPRECATED (1 << 1)
|
||||
#define CFG_PCTX_NOOBSOLETE (1 << 2)
|
||||
#define CFG_PCTX_NOEXPERIMENTAL (1 << 3)
|
||||
|
||||
/*@{*/
|
||||
/*%
|
||||
|
||||
@@ -689,7 +689,8 @@ cfg_parse_buffer(cfg_parser_t *pctx, isc_buffer_t *buffer, const char *file,
|
||||
REQUIRE(type != NULL);
|
||||
REQUIRE(buffer != NULL);
|
||||
REQUIRE(ret != NULL && *ret == NULL);
|
||||
REQUIRE((flags & ~(CFG_PCTX_NODEPRECATED)) == 0);
|
||||
REQUIRE((flags & ~(CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE |
|
||||
CFG_PCTX_NOEXPERIMENTAL)) == 0);
|
||||
|
||||
CHECK(isc_lex_openbuffer(pctx->lexer, buffer));
|
||||
|
||||
@@ -2357,13 +2358,17 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
|
||||
cfg_parser_warning(pctx, 0, "option '%s' is deprecated",
|
||||
clause->name);
|
||||
}
|
||||
if ((clause->flags & CFG_CLAUSEFLAG_OBSOLETE) != 0) {
|
||||
if ((pctx->flags & CFG_PCTX_NOOBSOLETE) == 0 &&
|
||||
(clause->flags & CFG_CLAUSEFLAG_OBSOLETE) != 0)
|
||||
{
|
||||
cfg_parser_warning(pctx, 0,
|
||||
"option '%s' is obsolete and "
|
||||
"should be removed ",
|
||||
clause->name);
|
||||
}
|
||||
if ((clause->flags & CFG_CLAUSEFLAG_EXPERIMENTAL) != 0) {
|
||||
if ((pctx->flags & CFG_PCTX_NOEXPERIMENTAL) == 0 &&
|
||||
(clause->flags & CFG_CLAUSEFLAG_EXPERIMENTAL) != 0)
|
||||
{
|
||||
cfg_parser_warning(pctx, 0,
|
||||
"option '%s' is experimental and "
|
||||
"subject to change in the future",
|
||||
|
||||
Reference in New Issue
Block a user