Add line number to warning about mangled yaml parameters. Limit number of warnings to 10.

remotes/origin/HEAD
Victor Julien 14 years ago
parent 0fc878b391
commit 4b2d94a841

@ -37,6 +37,9 @@
* work most of the time. */ * work most of the time. */
#define DEFAULT_NAME_LEN 16 #define DEFAULT_NAME_LEN 16
#define MANGLE_ERRORS_MAX 10
static int mangle_errors = 0;
/* Configuration processing states. */ /* Configuration processing states. */
enum conf_state { enum conf_state {
CONF_KEY = 0, CONF_KEY = 0,
@ -139,9 +142,15 @@ ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq)
((strcmp(parent->name, "address-groups") == 0) || ((strcmp(parent->name, "address-groups") == 0) ||
(strcmp(parent->name, "port-groups") == 0)))) { (strcmp(parent->name, "port-groups") == 0)))) {
Mangle(node->name); Mangle(node->name);
SCLogWarning(SC_WARN_DEPRECATED, if (mangle_errors < MANGLE_ERRORS_MAX) {
"%s is deprecated. Please use %s", SCLogWarning(SC_WARN_DEPRECATED,
value, node->name); "%s is deprecated. Please use %s on line %"PRIuMAX".",
value, node->name, (uintmax_t)parser->mark.line+1);
mangle_errors++;
if (mangle_errors >= MANGLE_ERRORS_MAX)
SCLogWarning(SC_WARN_DEPRECATED, "not showing more "
"parameter name warnings.");
}
} }
} }
TAILQ_INSERT_TAIL(&parent->head, node, next); TAILQ_INSERT_TAIL(&parent->head, node, next);

Loading…
Cancel
Save