modify fqdn_plugin table
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
|
||||
struct fqdn_plugin_schema {
|
||||
int item_id_column;
|
||||
int suffix_match_method_column;
|
||||
int fqdn_column;
|
||||
int rule_tag_column;
|
||||
int gc_timeout_s;
|
||||
@@ -78,17 +77,6 @@ void *fqdn_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
||||
goto error;
|
||||
}
|
||||
|
||||
custom_item = cJSON_GetObjectItem(item, "suffix_match_method");
|
||||
if (custom_item != NULL && custom_item->type == cJSON_Number) {
|
||||
schema->suffix_match_method_column = custom_item->valueint;
|
||||
} else {
|
||||
log_fatal(logger, MODULE_FQDN_PLUGIN,
|
||||
"[%s:%d] fqdn_plugin table:<%s> schema has no "
|
||||
"suffix_match_method column", __FUNCTION__,
|
||||
__LINE__, table_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
// rule_tag is optional
|
||||
custom_item = cJSON_GetObjectItem(item, "fqdn");
|
||||
if (custom_item != NULL && custom_item->type == cJSON_Number) {
|
||||
@@ -304,25 +292,6 @@ fqdn_plugin_rule_new(const char *line, struct fqdn_plugin_schema *schema,
|
||||
}
|
||||
fqdn_plugin_rule->id = atoi(line + column_offset);
|
||||
|
||||
ret = get_column_pos(line, schema->suffix_match_method_column,
|
||||
&column_offset, &column_len);
|
||||
if (ret < 0) {
|
||||
log_fatal(logger, MODULE_FQDN_PLUGIN,
|
||||
"[%s:%d] fqdn_plugin table:<%s> has no suffix_match_method"
|
||||
" in line:%s", __FUNCTION__, __LINE__, table_name, line);
|
||||
goto error;
|
||||
}
|
||||
|
||||
fqdn_plugin_rule->is_suffix_match = atoi(line + column_offset);
|
||||
if (fqdn_plugin_rule->is_suffix_match != 0 &&
|
||||
fqdn_plugin_rule->is_suffix_match != 1) {
|
||||
log_fatal(logger, MODULE_FQDN_PLUGIN,
|
||||
"[%s:%d] fqdn_plugin table:<%s> suffix_match_method:%d "
|
||||
"is illegal in line:%s", __FUNCTION__, __LINE__, table_name,
|
||||
fqdn_plugin_rule->is_suffix_match, line);
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = get_column_pos(line, schema->fqdn_column,
|
||||
&column_offset, &column_len);
|
||||
if (ret < 0) {
|
||||
@@ -335,6 +304,12 @@ fqdn_plugin_rule_new(const char *line, struct fqdn_plugin_schema *schema,
|
||||
fqdn = line + column_offset;
|
||||
fqdn_len = column_len;
|
||||
|
||||
if (fqdn[0] == '*') {
|
||||
fqdn_plugin_rule->is_suffix_match = 1;
|
||||
fqdn++;
|
||||
fqdn_len--;
|
||||
}
|
||||
|
||||
if (fqdn[0] == '.') {
|
||||
fqdn++;
|
||||
fqdn_len--;
|
||||
|
||||
Reference in New Issue
Block a user