delete compile table evaluation_order schema

This commit is contained in:
liuwentan
2023-04-03 15:14:57 +08:00
parent 5873d77f17
commit 3ed1f3dfd4
3 changed files with 4 additions and 26 deletions

View File

@@ -31,7 +31,6 @@ struct compile_schema {
int compile_id_column; int compile_id_column;
int rule_tag_column; int rule_tag_column;
int declared_clause_num_column; int declared_clause_num_column;
int evaluation_order_column;
struct ex_data_schema *ex_schema; struct ex_data_schema *ex_schema;
int table_id; //ugly int table_id; //ugly
char table_name[NAME_MAX]; char table_name[NAME_MAX];
@@ -291,15 +290,6 @@ void *compile_schema_new(cJSON *json, struct table_manager *tbl_mgr,
goto error; goto error;
} }
custom_item = cJSON_GetObjectItem(item, "evaluation_order");
if (custom_item != NULL && custom_item->type == cJSON_Number) {
compile_schema->evaluation_order_column = custom_item->valueint;
} else {
log_error(logger, MODULE_COMPILE,
"[%s:%d] table %s has no evaluation_order column", table_name);
goto error;
}
compile_schema->ref_tbl_mgr = tbl_mgr; compile_schema->ref_tbl_mgr = tbl_mgr;
return compile_schema; return compile_schema;
error: error:
@@ -489,16 +479,6 @@ compile_item_new(const char *line, struct compile_schema *compile_schema,
} }
compile_item->declared_clause_num = atoi(line + column_offset); compile_item->declared_clause_num = atoi(line + column_offset);
ret = get_column_pos(line, compile_schema->evaluation_order_column,
&column_offset, &column_len);
if (ret < 0) {
log_error(logger, MODULE_COMPILE,
"[%s:%d] compile table(table_id:%d) line:%s has no evaluation_order",
__FUNCTION__, __LINE__, compile_schema->table_id, line);
goto error;
}
compile_item->evaluation_order = atof(line + column_offset);
return compile_item; return compile_item;
error: error:
FREE(compile_item); FREE(compile_item);

View File

@@ -2827,9 +2827,9 @@ TEST_F(Policy, EvaluationOrder) {
results, ARRAY_SIZE, &n_hit_result, state); results, ARRAY_SIZE, &n_hit_result, state);
EXPECT_EQ(ret, MAAT_SCAN_HIT); EXPECT_EQ(ret, MAAT_SCAN_HIT);
EXPECT_EQ(n_hit_result, 3); EXPECT_EQ(n_hit_result, 3);
EXPECT_EQ(results[0], 166); EXPECT_EQ(results[0], 168);
EXPECT_EQ(results[1], 167); EXPECT_EQ(results[1], 167);
EXPECT_EQ(results[2], 168); EXPECT_EQ(results[2], 166);
uint32_t ip_addr; uint32_t ip_addr;
inet_pton(AF_INET, "192.168.23.23", &ip_addr); inet_pton(AF_INET, "192.168.23.23", &ip_addr);

View File

@@ -8,8 +8,7 @@
"custom": { "custom": {
"compile_id":1, "compile_id":1,
"tags":6, "tags":6,
"clause_num":9, "clause_num":9
"evaluation_order":10
} }
}, },
{ {
@@ -35,8 +34,7 @@
"custom": { "custom": {
"compile_id":1, "compile_id":1,
"tags":6, "tags":6,
"clause_num":9, "clause_num":9
"evaluation_order":10
} }
}, },
{ {