maat stat输出plugin(含EX data)、fqdn_plugin、IP_plugin中有效规则的数量。调整outer scan_status的计数方式。
This commit is contained in:
@@ -423,17 +423,25 @@ struct _OUTER_scan_status_t* _make_outer_status(_Maat_feather_t *feather, int th
|
||||
outer_mid=ALLOC(struct _OUTER_scan_status_t, 1);
|
||||
outer_mid->feather=feather;
|
||||
outer_mid->district_id=DISTRICT_ANY;
|
||||
outer_mid->thread_num=(unsigned short)thread_num;
|
||||
alignment_int64_array_add(feather->outer_mid_cnt, thread_num, 1);
|
||||
outer_mid->thread_num=(signed short)thread_num;
|
||||
return outer_mid;
|
||||
}
|
||||
struct _OUTER_scan_status_t* grab_mid(scan_status_t* raw_mid,_Maat_feather_t* feather, int thread_num, int is_hit_region)
|
||||
struct _OUTER_scan_status_t* grab_mid(scan_status_t* raw_mid, _Maat_feather_t* feather, int thread_num, int is_hit_region)
|
||||
{
|
||||
struct _OUTER_scan_status_t* _mid=(struct _OUTER_scan_status_t*)(*raw_mid);;
|
||||
if(_mid==NULL)
|
||||
{
|
||||
_mid=_make_outer_status(feather, thread_num);
|
||||
*raw_mid=_mid;
|
||||
if(_mid->thread_num>=0)//Maat_set_scan_status calls grap_mid() with thread_num=-1.
|
||||
{
|
||||
alignment_int64_array_add(feather->outer_mid_cnt, thread_num, 1);
|
||||
}
|
||||
}
|
||||
if(_mid->thread_num<0 && thread_num>0)
|
||||
{
|
||||
_mid->thread_num=thread_num;
|
||||
alignment_int64_array_add(feather->outer_mid_cnt, thread_num, 1);
|
||||
}
|
||||
|
||||
if(is_hit_region==1)
|
||||
@@ -2481,12 +2489,7 @@ int Maat_set_scan_status(Maat_feather_t feather,scan_status_t* mid,enum MAAT_SCA
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
_mid=grab_mid(mid, _feather, 0, 0);
|
||||
if(_mid==NULL)
|
||||
{
|
||||
_mid=_make_outer_status(_feather,0);
|
||||
*mid=_mid;
|
||||
}
|
||||
_mid=grab_mid(mid, _feather, -1, 0);
|
||||
switch(type)
|
||||
{
|
||||
case MAAT_SET_SCAN_DISTRICT:
|
||||
@@ -2599,7 +2602,10 @@ void Maat_clean_status(scan_status_t* mid)
|
||||
return;
|
||||
}
|
||||
_mid=(struct _OUTER_scan_status_t*)(*mid);
|
||||
alignment_int64_array_add(_mid->feather->outer_mid_cnt, _mid->thread_num, -1);
|
||||
if(_mid->thread_num>=0)
|
||||
{
|
||||
alignment_int64_array_add(_mid->feather->outer_mid_cnt, _mid->thread_num, -1);
|
||||
}
|
||||
if(_mid->compile_mid!=NULL)
|
||||
{
|
||||
Maat_hierarchy_compile_mid_free(_mid->compile_mid);
|
||||
|
||||
@@ -57,7 +57,7 @@ extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
int MAAT_FRAME_VERSION_3_5_0_20211020=1;
|
||||
int MAAT_FRAME_VERSION_3_5_1_20211024=1;
|
||||
|
||||
int is_valid_table_name(const char* str)
|
||||
{
|
||||
|
||||
@@ -351,10 +351,12 @@ void Maat_table_runtime_plugin_new_row(struct Maat_table_runtime* table_rt, stru
|
||||
if(atoi(row+is_valid_offset)==1)
|
||||
{
|
||||
EX_data_rt_row2EX_data(plugin_rt->ex_data_rt, row, row+key_offset, key_len, NULL, logger);
|
||||
table_rt->origin_rule_num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
EX_data_rt_delete_by_row(plugin_rt->ex_data_rt, row, row+key_offset, key_len, logger);
|
||||
table_rt->origin_rule_num--;
|
||||
}
|
||||
}
|
||||
if(plugin_schema->cb_plug_cnt>0)
|
||||
@@ -448,10 +450,12 @@ void Maat_table_runtime_fqdn_plugin_new_row(struct Maat_table_runtime* table_rt,
|
||||
{
|
||||
fqdn_rule=fqdn_rule_new((unsigned int)atoi(row+row_id_offset), row+fqdn_offset, fqdn_len, atoi(row+is_suffix_flag_offset));
|
||||
EX_data_rt_row2EX_data(fqdn_plugin_rt->ex_data_rt, row, row+row_id_offset, row_id_len, fqdn_rule, logger);
|
||||
table_rt->origin_rule_num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
EX_data_rt_delete_by_row(fqdn_plugin_rt->ex_data_rt, row, row+row_id_offset, row_id_len, logger);
|
||||
table_rt->origin_rule_num--;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -683,11 +687,13 @@ void Maat_table_runtime_ip_plugin_new_row(struct Maat_table_runtime* table_rt, s
|
||||
{
|
||||
|
||||
EX_data_rt_row2EX_data(ip_plugin_rt->ex_data_rt, row, row+row_id_offset, row_id_len, ip_rule, logger);
|
||||
table_rt->origin_rule_num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
EX_data_rt_delete_by_row(ip_plugin_rt->ex_data_rt, row, row+row_id_offset, row_id_len, logger);
|
||||
table_rt->origin_rule_num--;
|
||||
free(ip_rule);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ struct Maat_region_inner
|
||||
struct _OUTER_scan_status_t
|
||||
{
|
||||
struct _Maat_feather_t* feather;
|
||||
unsigned short thread_num;
|
||||
signed short thread_num;
|
||||
unsigned char is_set_district;
|
||||
unsigned char is_last_scan;
|
||||
int district_id; //-1: Any District; -2: Unkonwn District;
|
||||
|
||||
Reference in New Issue
Block a user