summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author刘文坛 <[email protected]>2023-10-11 06:53:03 +0000
committer刘文坛 <[email protected]>2023-10-11 06:53:03 +0000
commite49427974fa9b1945cc93449dfe92531b1523b50 (patch)
tree8d2a7cff64a983d45759cc67aabba31596ea59ee
parent461d43c6b76d3cd25705ed3ff054019f5e6404a6 (diff)
[BUGFIX]fix illegal clause indexv4.0.47
-rw-r--r--src/maat_bool_plugin.c11
-rw-r--r--src/maat_compile.c43
-rw-r--r--src/maat_expr.c10
-rw-r--r--src/maat_flag.c11
-rw-r--r--src/maat_fqdn_plugin.c23
-rw-r--r--src/maat_group.c16
-rw-r--r--src/maat_interval.c9
-rw-r--r--src/maat_ip.c22
-rw-r--r--src/maat_ip_plugin.c22
-rw-r--r--src/maat_ipport_plugin.c3
-rw-r--r--test/maat_framework_gtest.cpp16
-rw-r--r--test/maat_json.json10
-rw-r--r--test/table_info.conf3
13 files changed, 153 insertions, 46 deletions
diff --git a/src/maat_bool_plugin.c b/src/maat_bool_plugin.c
index f8a5fe8..a3f38ad 100644
--- a/src/maat_bool_plugin.c
+++ b/src/maat_bool_plugin.c
@@ -304,7 +304,7 @@ bool_plugin_expr_new(struct bool_plugin_schema *schema, const char *table_name,
size_t column_offset = 0;
size_t column_len = 0;
size_t n_item = 0;
- char expr_buffer[BUFSIZ] = {0};
+ char expr_buffer[BUFSIZ + 1] = {0};
unsigned long long items[MAX_ITEMS_PER_BOOL_EXPR] = {0};
char *token = NULL, *sub_token = NULL, *saveptr;
struct bool_expr *bool_expr = ALLOC(struct bool_expr, 1);
@@ -467,7 +467,13 @@ int bool_plugin_runtime_commit(void *bool_plugin_runtime, const char *table_name
struct bool_matcher *old_bool_matcher = NULL;
if (rule_cnt > 0) {
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_bool_matcher = bool_matcher_new(rules, rule_cnt, &mem_used);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_bool_matcher) {
log_error(bool_plugin_rt->logger, MODULE_BOOL_PLUGIN,
"[%s:%d] table[%s] rebuild bool_matcher engine failed when "
@@ -477,7 +483,8 @@ int bool_plugin_runtime_commit(void *bool_plugin_runtime, const char *table_name
} else {
log_info(bool_plugin_rt->logger, MODULE_BOOL_PLUGIN,
"table[%s] commit %zu bool_plugin rules and rebuild bool_matcher"
- " completed, version:%lld", table_name, rule_cnt, maat_rt_version);
+ " completed, version:%lld, consume:%lldms", table_name, rule_cnt,
+ maat_rt_version, time_elapse_ms);
}
}
diff --git a/src/maat_compile.c b/src/maat_compile.c
index 53339c1..093875e 100644
--- a/src/maat_compile.c
+++ b/src/maat_compile.c
@@ -29,6 +29,12 @@
#define MODULE_COMPILE module_name_str("maat.compile")
#define DEFAULT_GC_TIMEOUT_S 10
#define MAX_SUPER_GROUP_CNT 128
+#define MAX_NOT_CLAUSE_NUM 8
+
+enum clause_not_flag {
+ CLAUSE_NOT_FLAG_UNSET = 0,
+ CLAUSE_NOT_FLAG_SET
+};
struct compile_schema {
int compile_id_column;
@@ -275,7 +281,16 @@ compile_item_new(const char *table_line, struct compile_schema *schema,
__FUNCTION__, __LINE__, table_name, table_line);
goto error;
}
+
compile_item->declared_clause_num = atoi(table_line + column_offset);
+ if (compile_item->declared_clause_num < 0 ||
+ compile_item->declared_clause_num > MAX_NOT_CLAUSE_NUM) {
+ log_error(logger, MODULE_COMPILE,
+ "[%s:%d] table: <%s> clause_num:%d exceed maximum:%d in line:%s",
+ __FUNCTION__, __LINE__, table_name, compile_item->declared_clause_num,
+ MAX_NOT_CLAUSE_NUM, table_line);
+ goto error;
+ }
compile_item->ref_schema = schema;
compile_item->ex_data = ALLOC(void *, 1);
@@ -308,7 +323,7 @@ static void compile_item_free(struct compile_item *item)
FREE(item->ex_data);
}
- item->declared_clause_num = -1;
+ item->declared_clause_num = 0;
if (item->table_line != NULL) {
FREE(item->table_line);
@@ -722,7 +737,7 @@ group2compile_item_new(const char *line, struct group2compile_schema *g2c_schema
{
size_t column_offset = 0;
size_t column_len = 0;
- char vtable_name[MAX_NAME_STR_LEN] = {0};
+ char vtable_name[MAX_NAME_STR_LEN + 1] = {0};
struct group2compile_item *g2c_item = ALLOC(struct group2compile_item, 1);
int ret = get_column_pos(line, g2c_schema->group_id_column, &column_offset,
@@ -753,7 +768,15 @@ group2compile_item_new(const char *line, struct group2compile_schema *g2c_schema
__FUNCTION__, __LINE__, table_name, line);
goto error;
}
+
g2c_item->not_flag = atoi(line + column_offset);
+ if (g2c_item->not_flag != CLAUSE_NOT_FLAG_SET &&
+ g2c_item->not_flag != CLAUSE_NOT_FLAG_UNSET) {
+ log_error(logger, MODULE_COMPILE,
+ "[%s:%d] g2c table:<%s> NOT_flag:%d is illegal in line:%s ",
+ __FUNCTION__, __LINE__, table_name, g2c_item->not_flag, line);
+ goto error;
+ }
ret = get_column_pos(line, g2c_schema->vtable_name_column, &column_offset,
&column_len);
@@ -795,6 +818,13 @@ group2compile_item_new(const char *line, struct group2compile_schema *g2c_schema
}
g2c_item->clause_index = atoi(line + column_offset);
+ if (g2c_item->clause_index < 0 || g2c_item->clause_index >= MAX_NOT_CLAUSE_NUM) {
+ log_error(logger, MODULE_COMPILE,
+ "[%s:%d] g2c table:<%s> clause_index:%d exceed maximum:%d in line:%s",
+ __FUNCTION__, __LINE__, table_name, g2c_item->clause_index,
+ MAX_NOT_CLAUSE_NUM, line);
+ goto error;
+ }
return g2c_item;
error:
@@ -1947,7 +1977,13 @@ int compile_runtime_commit(void *compile_runtime, const char *table_name,
struct bool_matcher *old_bool_matcher = NULL;
struct bool_matcher *new_bool_matcher = NULL;
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_bool_matcher = maat_compile_bool_matcher_new(compile_rt, &compile_cnt);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_bool_matcher) {
log_error(compile_rt->logger, MODULE_COMPILE,
"[%s:%d] table[%s] rebuild compile bool_matcher failed, compile"
@@ -1956,7 +1992,8 @@ int compile_runtime_commit(void *compile_runtime, const char *table_name,
} else {
log_info(compile_rt->logger, MODULE_COMPILE,
"table[%s] commit %zu compile rules and rebuild compile bool_matcher"
- " completed, version:%lld", table_name, compile_cnt, maat_rt_version);
+ " completed, version:%lld, consume:%lldms", table_name, compile_cnt,
+ maat_rt_version, time_elapse_ms);
}
struct literal_clause *old_literal2clause = NULL;
diff --git a/src/maat_expr.c b/src/maat_expr.c
index 370cf28..4712a16 100644
--- a/src/maat_expr.c
+++ b/src/maat_expr.c
@@ -877,8 +877,14 @@ int expr_runtime_commit(void *expr_runtime, const char *table_name,
engine_type = EXPR_ENGINE_TYPE_RS;
}
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_matcher = expr_matcher_new(rules, real_rule_cnt, engine_type,
expr_rt->n_worker_thread, expr_rt->logger);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_matcher) {
log_error(expr_rt->logger, MODULE_EXPR,
"[%s:%d] table[%s] rebuild expr_matcher failed when update"
@@ -887,8 +893,8 @@ int expr_runtime_commit(void *expr_runtime, const char *table_name,
} else {
log_info(expr_rt->logger, MODULE_EXPR,
"table[%s] has %zu rules, commit %zu expr rules(regex rules:%zu) "
- "and rebuild adapter_hs completed, version:%lld", table_name, rule_cnt,
- real_rule_cnt, real_regex_rule_cnt, maat_rt_version);
+ "and rebuild adapter_hs completed, version:%lld, consume:%lldms", table_name, rule_cnt,
+ real_rule_cnt, real_regex_rule_cnt, maat_rt_version, time_elapse_ms);
}
}
diff --git a/src/maat_flag.c b/src/maat_flag.c
index 4c44ac7..c4caa24 100644
--- a/src/maat_flag.c
+++ b/src/maat_flag.c
@@ -360,7 +360,7 @@ flag_item_new(struct flag_schema *schema, const char *table_name,
item->flag = strtoull(line + column_offset, NULL, 0);
- ret = get_column_pos(line, schema->flag_mask_column, &column_offset, &column_len);
+ ret = get_column_pos(line, schema->flag_mask_column, &column_offset, &column_len);
if (ret < 0) {
log_error(flag_rt->logger, MODULE_FLAG,
"[%s:%d] flag table:<%s> has no flag_mask in line:%s",
@@ -490,7 +490,13 @@ int flag_runtime_commit(void *flag_runtime, const char *table_name,
struct flag_matcher *old_flag_matcher = NULL;
if (rule_cnt > 0) {
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_flag_matcher = flag_matcher_new(rules, rule_cnt);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_flag_matcher) {
log_error(flag_rt->logger, MODULE_FLAG,
"[%s:%d] table[%s] rebuild flag_matcher engine failed "
@@ -500,7 +506,8 @@ int flag_runtime_commit(void *flag_runtime, const char *table_name,
} else {
log_info(flag_rt->logger, MODULE_FLAG,
"table[%s] commit %zu flag rules and rebuild flag_matcher completed,"
- " version:%lld", table_name, rule_cnt, maat_rt_version);
+ " version:%lld, consume:%lldms", table_name, rule_cnt, maat_rt_version,
+ time_elapse_ms);
}
}
diff --git a/src/maat_fqdn_plugin.c b/src/maat_fqdn_plugin.c
index fd62759..71c0fa9 100644
--- a/src/maat_fqdn_plugin.c
+++ b/src/maat_fqdn_plugin.c
@@ -21,7 +21,7 @@
struct fqdn_plugin_schema {
int item_id_column;
- int suffix_flag_column;
+ int suffix_match_method_column;
int fqdn_column;
int rule_tag_column;
int gc_timeout_s;
@@ -79,7 +79,7 @@ void *fqdn_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr,
custom_item = cJSON_GetObjectItem(item, "suffix_match_method");
if (custom_item != NULL && custom_item->type == cJSON_Number) {
- schema->suffix_flag_column = custom_item->valueint;
+ schema->suffix_match_method_column = custom_item->valueint;
} else {
log_error(logger, MODULE_FQDN_PLUGIN,
"[%s:%d] fqdn_plugin table:<%s> schema has no suffix_match_method column",
@@ -287,14 +287,22 @@ 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_flag_column, &column_offset, &column_len);
+ ret = get_column_pos(line, schema->suffix_match_method_column, &column_offset, &column_len);
if (ret < 0) {
log_error(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_error(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) {
@@ -473,7 +481,13 @@ int fqdn_plugin_runtime_commit(void *fqdn_plugin_runtime, const char *table_name
struct FQDN_engine *old_fqdn_engine = NULL;
if (rule_cnt > 0) {
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_fqdn_engine = FQDN_engine_new(rules, rule_cnt);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_fqdn_engine) {
log_error(fqdn_plugin_rt->logger, MODULE_FQDN_PLUGIN,
"[%s:%d] table[%s] rebuild FQDN engine failed when update"
@@ -483,7 +497,8 @@ int fqdn_plugin_runtime_commit(void *fqdn_plugin_runtime, const char *table_name
} else {
log_info(fqdn_plugin_rt->logger, MODULE_FQDN_PLUGIN,
"table[%s] commit %zu fqdn_plugin rules and rebuild FQDN engine"
- " completed, version:%lld", table_name, rule_cnt, maat_rt_version);
+ " completed, version:%lld, consume:%lldms", table_name, rule_cnt,
+ maat_rt_version, time_elapse_ms);
}
}
diff --git a/src/maat_group.c b/src/maat_group.c
index 9603374..4fd8654 100644
--- a/src/maat_group.c
+++ b/src/maat_group.c
@@ -354,7 +354,14 @@ group2group_item_new(const char *line, struct group2group_schema *g2g_schema,
__FUNCTION__, __LINE__, table_name, line);
goto error;
}
+
g2g_item->is_exclude = atoi(line + column_offset);
+ if (g2g_item->is_exclude != 0 && g2g_item->is_exclude != 1) {
+ log_error(logger, MODULE_GROUP,
+ "[%s:%d] g2g table:<%s> is_exclude:%d is illegal in line:%s",
+ __FUNCTION__, __LINE__, table_name, g2g_item->is_exclude, line);
+ goto error;
+ }
return g2g_item;
error:
@@ -768,7 +775,13 @@ int group2group_runtime_commit(void *g2g_runtime, const char *table_name,
return 0;
}
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
int ret = group_topology_build_super_groups(g2g_rt->updating_group_topo);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (ret < 0) {
log_error(g2g_rt->logger, MODULE_GROUP,
"[%s:%d] table[%s] group2group runtime commit failed",
@@ -786,7 +799,8 @@ int group2group_runtime_commit(void *g2g_runtime, const char *table_name,
log_info(g2g_rt->logger, MODULE_GROUP,
"table[%s] commit %zu g2g rules and rebuild super_groups completed,"
- " version:%lld", table_name, g2g_rt->rule_num, maat_rt_version);
+ " version:%lld, consume:%lldms", table_name, g2g_rt->rule_num,
+ maat_rt_version, time_elapse_ms);
return 0;
}
diff --git a/src/maat_interval.c b/src/maat_interval.c
index 9e9a35d..a3b382b 100644
--- a/src/maat_interval.c
+++ b/src/maat_interval.c
@@ -491,7 +491,13 @@ int interval_runtime_commit(void *interval_runtime, const char *table_name,
struct interval_matcher *old_interval_matcher = NULL;
if (rule_cnt > 0) {
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_interval_matcher = interval_matcher_new(rules, rule_cnt);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_interval_matcher) {
log_error(interval_rt->logger, MODULE_INTERVAL,
"[%s:%d] table[%s]rebuild interval_matcher engine failed "
@@ -501,7 +507,8 @@ int interval_runtime_commit(void *interval_runtime, const char *table_name,
} else {
log_info(interval_rt->logger, MODULE_INTERVAL,
"table[%s] commit %zu interval rules and rebuild interval_matcher "
- "completed, version:%lld", table_name, rule_cnt, maat_rt_version);
+ "completed, version:%lld, consume:%lldms", table_name, rule_cnt,
+ maat_rt_version, time_elapse_ms);
}
}
diff --git a/src/maat_ip.c b/src/maat_ip.c
index 471d4f1..0b9a747 100644
--- a/src/maat_ip.c
+++ b/src/maat_ip.c
@@ -24,6 +24,11 @@
#define MODULE_IP module_name_str("maat.ip")
+#define IP_PROTO_ANY -1
+#define IP_PROTO_ICMP 1
+#define IP_PROTO_TCP 6
+#define IP_PROTO_UDP 17
+
struct ip_schema {
int item_id_column;
int group_id_column;
@@ -370,7 +375,15 @@ ip_item_new(struct ip_schema *ip_schema, const char *table_name,
__FUNCTION__, __LINE__, table_name, line);
goto error;
}
+
ip_item->proto = atoi(line + column_offset);
+ if (ip_item->proto != IP_PROTO_ANY && ip_item->proto != IP_PROTO_ICMP &&
+ ip_item->proto != IP_PROTO_TCP && ip_item->proto != IP_PROTO_UDP) {
+ log_error(logger, MODULE_IP,
+ "[%s:%d] ip table:<%s> protocol:%d is illegal in line:%s",
+ __FUNCTION__, __LINE__, table_name, ip_item->proto, line);
+ goto error;
+ }
return ip_item;
error:
@@ -596,7 +609,13 @@ int ip_runtime_commit(void *ip_runtime, const char *table_name,
struct ip_matcher *old_ip_matcher = NULL;
if (rule_cnt > 0) {
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_ip_matcher = ip_matcher_new(rules, rule_cnt, &mem_used);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_ip_matcher) {
log_error(ip_rt->logger, MODULE_IP,
"[%s:%d] table[%s] rebuild ip_matcher engine failed "
@@ -606,7 +625,8 @@ int ip_runtime_commit(void *ip_runtime, const char *table_name,
} else {
log_info(ip_rt->logger, MODULE_IP,
"table[%s] commit %zu ip rules and rebuild ip_matcher completed"
- ", version:%lld", table_name, rule_cnt, maat_rt_version);
+ ", version:%lld, consume:%lldms", table_name, rule_cnt,
+ maat_rt_version, time_elapse_ms);
}
}
diff --git a/src/maat_ip_plugin.c b/src/maat_ip_plugin.c
index 5a74dcb..21bf705 100644
--- a/src/maat_ip_plugin.c
+++ b/src/maat_ip_plugin.c
@@ -26,7 +26,6 @@ struct ip_plugin_schema {
int ip_type_column;
int start_ip_column;
int end_ip_column;
- int addr_format_column;
int rule_tag_column;
int gc_timeout_s;
int table_id; //ugly
@@ -111,18 +110,6 @@ void *ip_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr,
goto error;
}
- custom_item = cJSON_GetObjectItem(item, "addr_format");
- if (custom_item != NULL && custom_item->type == cJSON_Number) {
- schema->addr_format_column = custom_item->valueint;
- }
- //TODO: just because test table has no addr_format
- // else {
- // log_error(logger, MODULE_IP_PLUGIN,
- // "[%s:%d] table: <%s> schema has no addr_format column",
- // __FUNCTION__, __LINE__, table_name);
- // goto error;
- // }
-
// rule_tag is optional
custom_item = cJSON_GetObjectItem(item, "rule_tag");
if (custom_item != NULL && custom_item->type == cJSON_Number) {
@@ -491,7 +478,13 @@ int ip_plugin_runtime_commit(void *ip_plugin_runtime, const char *table_name,
struct ip_matcher *old_ip_matcher = NULL;
if (rule_cnt > 0) {
+ struct timespec start, end;
+ clock_gettime(CLOCK_MONOTONIC, &start);
new_ip_matcher = ip_matcher_new(rules, rule_cnt, &mem_used);
+ clock_gettime(CLOCK_MONOTONIC, &end);
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
+
if (NULL == new_ip_matcher) {
log_error(ip_plugin_rt->logger, MODULE_IP_PLUGIN,
"[%s:%d] ip_plugin table[%s] rebuild ip_matcher failed when "
@@ -500,7 +493,8 @@ int ip_plugin_runtime_commit(void *ip_plugin_runtime, const char *table_name,
} else {
log_info(ip_plugin_rt->logger, MODULE_IP_PLUGIN,
"table[%s] commit %zu ip_plugin rules and rebuild ip_matcher "
- "completed, version:%lld", table_name, rule_cnt, maat_rt_version);
+ "completed, version:%lld, consume:%lldms", table_name, rule_cnt,
+ maat_rt_version, time_elapse_ms);
}
}
diff --git a/src/maat_ipport_plugin.c b/src/maat_ipport_plugin.c
index ac83d6f..be07ad1 100644
--- a/src/maat_ipport_plugin.c
+++ b/src/maat_ipport_plugin.c
@@ -500,7 +500,8 @@ int ipport_plugin_runtime_commit(void *ipport_plugin_runtime, const char *table_
clock_gettime(CLOCK_MONOTONIC, &start);
new_matcher = ipport_matcher_new(rules, rule_cnt);
clock_gettime(CLOCK_MONOTONIC, &end);
- long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 + (end.tv_nsec - start.tv_nsec) / 1000000;
+ long long time_elapse_ms = (end.tv_sec - start.tv_sec) * 1000 +
+ (end.tv_nsec - start.tv_nsec) / 1000000;
if (NULL == new_matcher) {
log_error(ipport_plugin_rt->logger, MODULE_IPPORT_PLUGIN,
"[%s:%d] ipport_plugin table[%s] rebuild ipport_matcher failed when "
diff --git a/test/maat_framework_gtest.cpp b/test/maat_framework_gtest.cpp
index 738b922..e2fd6b1 100644
--- a/test/maat_framework_gtest.cpp
+++ b/test/maat_framework_gtest.cpp
@@ -6039,15 +6039,15 @@ TEST_F(MaatCmdTest, UpdateIPPlugin) {
struct maat *maat_inst = MaatCmdTest::_shared_maat_inst;
int *ex_data_counter = MaatCmdTest::_ex_data_counter;
const char *table_line_add[TEST_CMD_LINE_NUM] = {
- "101\t4\t192.168.30.99\t192.168.30.101\tSomething-like-json\t1\trange",
- "102\t4\t192.168.30.90\t192.168.30.128\tBigger-range-should-in-the-back\t1\trange",
- "103\t6\t2001:db8:1234::\t2001:db8:1235::\tBigger-range-should-in-the-back\t1\trange",
- "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t1\trange"};
+ "101\t4\t192.168.30.99\t192.168.30.101\tSomething-like-json\t1",
+ "102\t4\t192.168.30.90\t192.168.30.128\tBigger-range-should-in-the-back\t1",
+ "103\t6\t2001:db8:1234::\t2001:db8:1235::\tBigger-range-should-in-the-back\t1",
+ "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t1"};
const char *table_line_del[TEST_CMD_LINE_NUM] = {
- "101\t4\t192.168.30.99\t192.168.30.101\tSomething-like-json\t0\trange",
- "102\t4\t192.168.30.90\t192.168.30.128\tBigger-range-should-in-the-back\t0\trange",
- "103\t6\t2001:db8:1234::\t2001:db8:1235::\tBigger-range-should-in-the-back\t0\trange",
- "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t0\trange"};
+ "101\t4\t192.168.30.99\t192.168.30.101\tSomething-like-json\t0",
+ "102\t4\t192.168.30.90\t192.168.30.128\tBigger-range-should-in-the-back\t0",
+ "103\t6\t2001:db8:1234::\t2001:db8:1235::\tBigger-range-should-in-the-back\t0",
+ "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t0"};
int table_id = maat_get_table_id(maat_inst, table_name);
ASSERT_GT(table_id, 0);
diff --git a/test/maat_json.json b/test/maat_json.json
index ff793f7..0e7601a 100644
--- a/test/maat_json.json
+++ b/test/maat_json.json
@@ -3022,11 +3022,11 @@
{
"table_name": "TEST_IP_PLUGIN_WITH_EXDATA",
"table_content": [
- "101\t4\t192.168.30.99\t192.168.30.101\tSomething-like-json\t1\trange",
- "102\t4\t192.168.30.90\t192.168.30.128\tBigger-range-should-in-the-back\t1\trange",
- "103\t6\t2001:db8:1234::\t2001:db8:1235::\tBigger-range-should-in-the-back\t1\trange",
- "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t1\trange",
- "105\t6\t2620:100:3000::\t2620:0100:30ff:ffff:ffff:ffff:ffff:ffff\tBugreport-liumengyan-20210517\t1\trange"
+ "101\t4\t192.168.30.99\t192.168.30.101\tSomething-like-json\t1",
+ "102\t4\t192.168.30.90\t192.168.30.128\tBigger-range-should-in-the-back\t1",
+ "103\t6\t2001:db8:1234::\t2001:db8:1235::\tBigger-range-should-in-the-back\t1",
+ "104\t6\t2001:db8:1234::1\t2001:db8:1234::5210\tSomething-like-json\t1",
+ "105\t6\t2620:100:3000::\t2620:0100:30ff:ffff:ffff:ffff:ffff:ffff\tBugreport-liumengyan-20210517\t1"
]
},
{
diff --git a/test/table_info.conf b/test/table_info.conf
index 2265e23..2845d09 100644
--- a/test/table_info.conf
+++ b/test/table_info.conf
@@ -306,8 +306,7 @@
"item_id":1,
"ip_type":2,
"start_ip":3,
- "end_ip":4,
- "addr_format":7
+ "end_ip":4
}
},
{