TSG-11896: 增加回调表计数统计,便于统计回调表中的配置量、定位内存是否及时释放
This commit is contained in:
@@ -81,7 +81,27 @@ id2field_t g_tsg_fs2_field[TSG_FS2_MAX]={{0, TSG_FS2_TCP_LINKS, "tcp_links"},
|
|||||||
{0, TSG_FS2_SET_TIMOUT_FAILED, "set_timeout_fai"},
|
{0, TSG_FS2_SET_TIMOUT_FAILED, "set_timeout_fai"},
|
||||||
{0, TSG_FS2_SUCESS_TAMPER, "tamper_sucess"},
|
{0, TSG_FS2_SUCESS_TAMPER, "tamper_sucess"},
|
||||||
{0, TSG_FS2_TAMPER_FAILED_PLOAD_LESS_4, "tamper_nopload"},
|
{0, TSG_FS2_TAMPER_FAILED_PLOAD_LESS_4, "tamper_nopload"},
|
||||||
{0, TSG_FS2_TAMPER_FAILED_NOSWAP, "tamper_noswap"}
|
{0, TSG_FS2_TAMPER_FAILED_NOSWAP, "tamper_noswap"},
|
||||||
|
{0, TSG_FS2_ASN_ADD, "asn_add"},
|
||||||
|
{0, TSG_FS2_ASN_DEL, "asn_del"},
|
||||||
|
{0, TSG_FS2_GTPC_ADD, "gtpc_add"},
|
||||||
|
{0, TSG_FS2_GTPC_DEL, "gtpc_del"},
|
||||||
|
{0, TSG_FS2_LOCATION_ADD, "location_add"},
|
||||||
|
{0, TSG_FS2_LOCATION_DEL, "location_del"},
|
||||||
|
{0, TSG_FS2_FQDN_ADD, "fqdn_add"},
|
||||||
|
{0, TSG_FS2_FQDN_DEL, "fqdn_del"},
|
||||||
|
{0, TSG_FS2_SUBSCRIBER_ADD, "subscriber_add"},
|
||||||
|
{0, TSG_FS2_SUBSCRIBER_DEL, "subscriber_del"},
|
||||||
|
{0, TSG_FS2_SECURIRY_ADD, "security_add"},
|
||||||
|
{0, TSG_FS2_SECURIRY_DEL, "security_del"},
|
||||||
|
{0, TSG_FS2_MIRRORED_ADD, "mirrored_add"},
|
||||||
|
{0, TSG_FS2_MIRRORED_DEL, "mirrored_del"},
|
||||||
|
{0, TSG_FS2_HTTP_RES_ADD, "http_res_add"},
|
||||||
|
{0, TSG_FS2_HTTP_RES_DEL, "http_res_del"},
|
||||||
|
{0, TSG_FS2_DNS_RES_ADD, "dns_profile_add"},
|
||||||
|
{0, TSG_FS2_DNS_RES_DEL, "dns_profile_del"},
|
||||||
|
{0, TSG_FS2_APP_ID_ADD, "app_id_add"},
|
||||||
|
{0, TSG_FS2_APP_ID_DEL, "app_id_del"}
|
||||||
};
|
};
|
||||||
|
|
||||||
id2field_t g_tsg_proto_name2id[PROTO_MAX]={{PROTO_UNKONWN, 0, "unknown"},
|
id2field_t g_tsg_proto_name2id[PROTO_MAX]={{PROTO_UNKONWN, 0, "unknown"},
|
||||||
@@ -2349,13 +2369,6 @@ extern "C" int TSG_MASTER_INIT()
|
|||||||
MESA_load_profile_string_def(tsg_conffile, "HTTP_PLUG", "PAGE204", page_path, sizeof(page_path), "./tsgconf/HTTP204.html");
|
MESA_load_profile_string_def(tsg_conffile, "HTTP_PLUG", "PAGE204", page_path, sizeof(page_path), "./tsgconf/HTTP204.html");
|
||||||
g_tsg_para.tpl_204 = ctemplate::Template::GetTemplate(page_path, ctemplate::DO_NOT_STRIP);
|
g_tsg_para.tpl_204 = ctemplate::Template::GetTemplate(page_path, ctemplate::DO_NOT_STRIP);
|
||||||
|
|
||||||
ret=tsg_rule_init(tsg_conffile, g_tsg_para.logger);
|
|
||||||
if(ret<0)
|
|
||||||
{
|
|
||||||
MESA_handle_runtime_log(g_tsg_para.logger, RLOG_LV_FATAL, "INIT_MAAT", "tsg_rule_init failed ...");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
MESA_load_profile_int_def(tsg_conffile, "FIELD_STAT", "CYCLE", &cycle, 30);
|
MESA_load_profile_int_def(tsg_conffile, "FIELD_STAT", "CYCLE", &cycle, 30);
|
||||||
MESA_load_profile_short_nodef(tsg_conffile, "FIELD_STAT","TELEGRAF_PORT", (short *)&(fs_server_port));
|
MESA_load_profile_short_nodef(tsg_conffile, "FIELD_STAT","TELEGRAF_PORT", (short *)&(fs_server_port));
|
||||||
MESA_load_profile_string_nodef(tsg_conffile,"FIELD_STAT","TELEGRAF_IP",fs_server_ip, sizeof(fs_server_ip));
|
MESA_load_profile_string_nodef(tsg_conffile,"FIELD_STAT","TELEGRAF_IP",fs_server_ip, sizeof(fs_server_ip));
|
||||||
@@ -2390,6 +2403,13 @@ extern "C" int TSG_MASTER_INIT()
|
|||||||
{
|
{
|
||||||
g_tsg_para.fs2_field_id[i]=FS_register(g_tsg_para.fs2_handle, FS_STYLE_FIELD, FS_CALC_SPEED, g_tsg_fs2_field[i].name);
|
g_tsg_para.fs2_field_id[i]=FS_register(g_tsg_para.fs2_handle, FS_STYLE_FIELD, FS_CALC_SPEED, g_tsg_fs2_field[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret=tsg_rule_init(tsg_conffile, g_tsg_para.logger);
|
||||||
|
if(ret<0)
|
||||||
|
{
|
||||||
|
MESA_handle_runtime_log(g_tsg_para.logger, RLOG_LV_FATAL, "INIT_MAAT", "tsg_rule_init failed ...");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
g_tsg_log_instance=tsg_sendlog_init(tsg_conffile, g_tsg_para.fs2_handle);
|
g_tsg_log_instance=tsg_sendlog_init(tsg_conffile, g_tsg_para.fs2_handle);
|
||||||
if(g_tsg_log_instance==NULL)
|
if(g_tsg_log_instance==NULL)
|
||||||
|
|||||||
@@ -123,6 +123,26 @@ enum TSG_FS2_TYPE{
|
|||||||
TSG_FS2_SUCESS_TAMPER,
|
TSG_FS2_SUCESS_TAMPER,
|
||||||
TSG_FS2_TAMPER_FAILED_PLOAD_LESS_4,
|
TSG_FS2_TAMPER_FAILED_PLOAD_LESS_4,
|
||||||
TSG_FS2_TAMPER_FAILED_NOSWAP,
|
TSG_FS2_TAMPER_FAILED_NOSWAP,
|
||||||
|
TSG_FS2_ASN_ADD,
|
||||||
|
TSG_FS2_ASN_DEL,
|
||||||
|
TSG_FS2_GTPC_ADD,
|
||||||
|
TSG_FS2_GTPC_DEL,
|
||||||
|
TSG_FS2_LOCATION_ADD,
|
||||||
|
TSG_FS2_LOCATION_DEL,
|
||||||
|
TSG_FS2_FQDN_ADD,
|
||||||
|
TSG_FS2_FQDN_DEL,
|
||||||
|
TSG_FS2_SUBSCRIBER_ADD,
|
||||||
|
TSG_FS2_SUBSCRIBER_DEL,
|
||||||
|
TSG_FS2_SECURIRY_ADD,
|
||||||
|
TSG_FS2_SECURIRY_DEL,
|
||||||
|
TSG_FS2_MIRRORED_ADD,
|
||||||
|
TSG_FS2_MIRRORED_DEL,
|
||||||
|
TSG_FS2_HTTP_RES_ADD,
|
||||||
|
TSG_FS2_HTTP_RES_DEL,
|
||||||
|
TSG_FS2_DNS_RES_ADD,
|
||||||
|
TSG_FS2_DNS_RES_DEL,
|
||||||
|
TSG_FS2_APP_ID_ADD,
|
||||||
|
TSG_FS2_APP_ID_DEL,
|
||||||
TSG_FS2_MAX
|
TSG_FS2_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -386,6 +386,7 @@ void gtp_c_new_data(int table_id, const char* key, const char* table_line, MAAT_
|
|||||||
atomic_inc(&user_info->ref_cnt);
|
atomic_inc(&user_info->ref_cnt);
|
||||||
*ad=(MAAT_PLUGIN_EX_DATA)user_info;
|
*ad=(MAAT_PLUGIN_EX_DATA)user_info;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_GTPC_ADD], 0, FS_OP_ADD, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +404,8 @@ void gtp_c_free_data(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* arg
|
|||||||
|
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_GTPC_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,6 +448,7 @@ void ASN_number_new(int table_id, const char* key, const char* table_line, MAAT_
|
|||||||
atomic_inc(&asn->ref_cnt);
|
atomic_inc(&asn->ref_cnt);
|
||||||
*ad=(MAAT_PLUGIN_EX_DATA)asn;
|
*ad=(MAAT_PLUGIN_EX_DATA)asn;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_ASN_ADD], 0, FS_OP_ADD, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,6 +463,8 @@ void ASN_number_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* arg
|
|||||||
_free_field(asn->organization);
|
_free_field(asn->organization);
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_ASN_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,6 +504,7 @@ void location_new_data(int table_id, const char* key, const char* table_line, MA
|
|||||||
atomic_inc(&location->ref_cnt);
|
atomic_inc(&location->ref_cnt);
|
||||||
*ad=(MAAT_PLUGIN_EX_DATA)location;
|
*ad=(MAAT_PLUGIN_EX_DATA)location;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_LOCATION_ADD], 0, FS_OP_ADD, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,6 +522,8 @@ void location_free_data(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void*
|
|||||||
|
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_LOCATION_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,6 +557,7 @@ void fqdn_category_new(int table_id, const char* key, const char* table_line, MA
|
|||||||
atomic_inc(&fqdn_cat->ref_cnt);
|
atomic_inc(&fqdn_cat->ref_cnt);
|
||||||
*ad=(MAAT_PLUGIN_EX_DATA)fqdn_cat;
|
*ad=(MAAT_PLUGIN_EX_DATA)fqdn_cat;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_FQDN_ADD], 0, FS_OP_ADD, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,7 +569,8 @@ void fqdn_category_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void*
|
|||||||
if((__sync_sub_and_fetch(&fqdn_cat->ref_cnt, 1) == 0))
|
if((__sync_sub_and_fetch(&fqdn_cat->ref_cnt, 1) == 0))
|
||||||
{
|
{
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_FQDN_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,6 +606,7 @@ void subscriber_id_new(int table_id, const char* key, const char* table_line, MA
|
|||||||
atomic_inc(&subscriber->ref_cnt);
|
atomic_inc(&subscriber->ref_cnt);
|
||||||
*ad=(MAAT_PLUGIN_EX_DATA)subscriber;
|
*ad=(MAAT_PLUGIN_EX_DATA)subscriber;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SUBSCRIBER_ADD], 0, FS_OP_ADD, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,6 +620,8 @@ void subscriber_id_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void*
|
|||||||
_free_field(subscriber->subscribe_id);
|
_free_field(subscriber->subscribe_id);
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SUBSCRIBER_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,6 +748,7 @@ static void app_id_dict_new(int table_id, const char* key, const char* table_lin
|
|||||||
atomic_inc(&dict->ref_cnt);
|
atomic_inc(&dict->ref_cnt);
|
||||||
*ad=(MAAT_PLUGIN_EX_DATA)dict;
|
*ad=(MAAT_PLUGIN_EX_DATA)dict;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_APP_ID_ADD], 0, FS_OP_ADD, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,6 +768,8 @@ void app_id_dict_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* ar
|
|||||||
_free_field(dict->characteristics);
|
_free_field(dict->characteristics);
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_APP_ID_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -1196,6 +1213,7 @@ void security_compile_new(int idx, const struct Maat_rule_t* rule, const char* s
|
|||||||
}
|
}
|
||||||
|
|
||||||
*ad=(MAAT_RULE_EX_DATA)user_region;
|
*ad=(MAAT_RULE_EX_DATA)user_region;
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SECURIRY_ADD], 0, FS_OP_ADD, 1);
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -1292,6 +1310,8 @@ void security_compile_free(int idx, const struct Maat_rule_t* rule, const char*
|
|||||||
|
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SECURIRY_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1397,6 +1417,8 @@ void http_response_pages_new(int table_id, const char* key, const char* table_li
|
|||||||
_free_field((char *)res_pages);
|
_free_field((char *)res_pages);
|
||||||
res_pages=NULL;
|
res_pages=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_HTTP_RES_ADD], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void http_response_pages_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp)
|
void http_response_pages_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp)
|
||||||
@@ -1408,7 +1430,9 @@ void http_response_pages_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl,
|
|||||||
{
|
{
|
||||||
_free_field(res_pages->content);
|
_free_field(res_pages->content);
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_HTTP_RES_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1484,6 +1508,8 @@ void dns_profile_records_new(int table_id, const char* key, const char* table_li
|
|||||||
profile_records=NULL;
|
profile_records=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_DNS_RES_ADD], 0, FS_OP_ADD, 1);
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1516,6 +1542,8 @@ void dns_profile_records_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl,
|
|||||||
|
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_DNS_RES_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1555,6 +1583,8 @@ void mirrored_profile_new(int table_id, const char* key, const char* table_line,
|
|||||||
_free_field(vlan_ids_str);
|
_free_field(vlan_ids_str);
|
||||||
vlan_ids_str=NULL;
|
vlan_ids_str=NULL;
|
||||||
|
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_MIRRORED_ADD], 0, FS_OP_ADD, 1);
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1578,7 +1608,8 @@ void mirrored_profile_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, voi
|
|||||||
if((__sync_sub_and_fetch(&mirror_profile->ref_cnt, 1) == 0))
|
if((__sync_sub_and_fetch(&mirror_profile->ref_cnt, 1) == 0))
|
||||||
{
|
{
|
||||||
_free_field((char *)(*ad));
|
_free_field((char *)(*ad));
|
||||||
*ad=NULL;
|
*ad=NULL;
|
||||||
|
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_MIRRORED_DEL], 0, FS_OP_ADD, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user