From e92fd7c9df8db4e50b73c0015688c7d82586dacd Mon Sep 17 00:00:00 2001 From: liuxueli Date: Fri, 13 Aug 2021 19:35:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AEFQDN=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E5=88=86=E7=B1=BBID=E5=88=B0=E6=B5=81=E6=A0=87?= =?UTF-8?q?=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fw_dns_plug.cpp | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/src/fw_dns_plug.cpp b/src/fw_dns_plug.cpp index 157325b..d78a93f 100644 --- a/src/fw_dns_plug.cpp +++ b/src/fw_dns_plug.cpp @@ -130,7 +130,7 @@ static int fw_dns_send_log(struct streaminfo *a_stream, dns_info_t *dns_info, st extern "C" char FW_DNS_PLUG_ENTRY(stSessionInfo* session_info, void **pme, int thread_seq,struct streaminfo *a_stream,const void *a_packet) { - int i=0,ret=0,hit_num=0; + int ret=0,hit_num=0; scan_status_t mid=NULL; int category_id_num=0; char state=PROT_STATE_GIVEME; @@ -227,39 +227,8 @@ extern "C" char FW_DNS_PLUG_ENTRY(stSessionInfo* session_info, void **pme, int } category_id_num=tsg_get_fqdn_category_id(g_tsg_maat_feather, (char *)dns_info->query_question.qname, category_id, MAX_CATEGORY_ID_NUM, g_fw_dns_plug_info.logger, thread_seq); - for(i=0; i< category_id_num; i++) - { - ret=Maat_scan_intval(g_tsg_maat_feather, g_fw_dns_plug_info.table_qname_id, (unsigned int)category_id[i], result+hit_num,MAX_RESULT_NUM-hit_num, &mid, thread_seq); - if(ret>0) - { - MESA_handle_runtime_log(g_fw_dns_plug_info.logger, - RLOG_LV_DEBUG, - "SCAN_FQDN_CAT_ID", - "Hit qname: %s category id: %d policy_id: %d service: %d action: %d addr: %s", - (char *)dns_info->query_question.qname, - category_id[i], - result[hit_num].config_id, - result[hit_num].service_id, - result[hit_num].action, - PRINTADDR(a_stream, g_fw_dns_plug_info.level) - ); - hit_num+=ret; - } - else - { - MESA_handle_runtime_log(g_fw_dns_plug_info.logger, - RLOG_LV_DEBUG, - "SCAN_DOMAIN", - "Scan domain: %s category id: %d ret: %d addr: %s", - (char *)dns_info->query_question.qname, - category_id[i], - ret, - PRINTADDR(a_stream, g_fw_dns_plug_info.level) - ); - - } - } - + tsg_set_fqdn_category_id(a_stream, category_id, category_id_num, thread_seq); + hit_num+=tsg_scan_fqdn_category_id(g_tsg_maat_feather, a_stream, result+hit_num,MAX_RESULT_NUM-hit_num, &mid, g_fw_dns_plug_info.table_qname_id, category_id, category_id_num, thread_seq); if(hit_num>0) { p_result=tsg_fetch_deny_rule(result, hit_num);