diff --git a/lib/config/config.c b/lib/config/config.c index 35ee3ac5b..eb8880ee3 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -1040,9 +1040,14 @@ static int _config_def_check_tree(struct cft_check_handle *handle, size_t buf_size, struct dm_config_node *root) { struct dm_config_node *cn; + cfg_def_item_t *def; int valid, r = 1; size_t len; + def = cfg_def_get_item_p(root->id); + if (def->flags & CFG_SECTION_NO_CHECK) + return 1; + for (cn = root->child; cn; cn = cn->sib) { if ((valid = _config_def_check_node(handle, vp, pvp, rp, prp, buf_size, cn)) && !cn->v) { @@ -1662,14 +1667,9 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi char path[CFG_PATH_MAX_LEN]; char commentline[MAX_COMMENT_LINE+1]; - if (cn->id < 0) + if (cn->id <= 0) return 1; - if (!cn->id) { - log_error(INTERNAL_ERROR "Configuration node %s has invalid id.", cn->key); - return 0; - } - if (out->tree_spec->type == CFG_DEF_TREE_LIST) return 1; diff --git a/lib/config/config.h b/lib/config/config.h index 03319bfcd..7520fc074 100644 --- a/lib/config/config.h +++ b/lib/config/config.h @@ -121,6 +121,8 @@ typedef union { #define CFG_DISABLED 0x200 /* whether to print integers in octal form (prefixed by "0") */ #define CFG_FORMAT_INT_OCTAL 0x400 +/* whether to disable checks for the whole config section subtree */ +#define CFG_SECTION_NO_CHECK 0x800 /* configuration definition item structure */ typedef struct cfg_def_item { diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h index ce03b36be..520953148 100644 --- a/lib/config/config_settings.h +++ b/lib/config/config_settings.h @@ -51,6 +51,7 @@ * CFG_DEFAULT_COMMENTED - node's default value is commented out on output * CFG_DISABLED - configuration is disabled (defaults always used) * CFG_FORMAT_INT_OCTAL - print integer number in octal form (also prefixed by "0") + * CFG_SECTION_NO_CHECK - do not check content of the section at all - use with care!!! * * type: Allowed type for the value of simple configuation setting, one of: * CFG_TYPE_BOOL