From 0421c297d8888ed064262b28fb09d8266be63f76 Mon Sep 17 00:00:00 2001 From: liuxueli Date: Wed, 7 Jul 2021 18:13:09 +0800 Subject: [PATCH] =?UTF-8?q?TSG-6937:=20=E5=8D=95=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E6=89=AB=E6=8F=8F=E5=A4=9A=E5=91=BD=E4=B8=AD?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E7=AD=96=E7=95=A5=E6=97=B6=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=BB=93=E6=9E=9C=E5=88=B0=E6=B5=81=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=97=B6=E5=AF=BC=E8=87=B4=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tsg_entry.cpp | 99 ++++++++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/src/tsg_entry.cpp b/src/tsg_entry.cpp index 64fa751..689dda1 100644 --- a/src/tsg_entry.cpp +++ b/src/tsg_entry.cpp @@ -471,7 +471,24 @@ static void copy_intercept_result(const struct streaminfo *a_stream, struct mast int ret=0; policy_priority_label_t *priority_label=NULL; - priority_label=(policy_priority_label_t *)dictator_malloc(thread_seq, sizeof(policy_priority_label_t)); + priority_label=(policy_priority_label_t *)project_req_get_struct((struct streaminfo *)a_stream, g_tsg_para.priority_project_id); + if(priority_label==NULL) + { + priority_label=(policy_priority_label_t *)dictator_malloc(thread_seq, sizeof(policy_priority_label_t)); + } + else + { + MESA_handle_runtime_log(g_tsg_para.logger, + RLOG_LV_FATAL, + "DUP_HIT_INTERCEPT", + "Hit intercept policy, domain: %s policy_id: %d action: %d addr: %s", + (domain!=NULL ? domain : ""), + p_result->config_id, + (unsigned char)p_result->action, + PRINTADDR(a_stream, g_tsg_para.level) + ); + } + memset(priority_label, 0, sizeof(policy_priority_label_t)); priority_label->proto=proto; @@ -490,23 +507,25 @@ static void copy_intercept_result(const struct streaminfo *a_stream, struct mast { free_policy_label(thread_seq, (void *)priority_label); MESA_handle_runtime_log(g_tsg_para.logger, - RLOG_LV_FATAL, - "PROJECT_ADD", - "Add policy_priority_label failed, intercept policy, policy_id: %d action: %d addr: %s", - priority_label->result[0].config_id, - (unsigned char)priority_label->result[0].action, - PRINTADDR(a_stream, g_tsg_para.level) - ); - } + RLOG_LV_FATAL, + "PROJECT_ADD", + "Add policy_priority_label failed, intercept policy, domain: %s policy_id: %d action: %d addr: %s", + (domain!=NULL ? domain : ""), + priority_label->result[0].config_id, + (unsigned char)priority_label->result[0].action, + PRINTADDR(a_stream, g_tsg_para.level) + ); + } MESA_handle_runtime_log(g_tsg_para.logger, - RLOG_LV_DEBUG, - "INTERCEPT", - "Hit intercept policy, policy_id: %d action: %d addr: %s", - priority_label->result[0].config_id, - (unsigned char)priority_label->result[0].action, - PRINTADDR(a_stream, g_tsg_para.level) - ); + RLOG_LV_DEBUG, + "INTERCEPT", + "Hit intercept policy, domain: %s policy_id: %d action: %d addr: %s", + (domain!=NULL ? domain : ""), + priority_label->result[0].config_id, + (unsigned char)priority_label->result[0].action, + PRINTADDR(a_stream, g_tsg_para.level) + ); return ; } @@ -527,14 +546,14 @@ static void copy_deny_result(const struct streaminfo *a_stream, struct master_co } MESA_handle_runtime_log(g_tsg_para.logger, - RLOG_LV_DEBUG, - "DENY", - "Hit deny policy, policy_id: %d service: %d action: %d addr: %s", - p_result[0].config_id, - p_result[0].service_id, - (unsigned char)p_result[0].action, - PRINTADDR(a_stream, g_tsg_para.level) - ); + RLOG_LV_DEBUG, + "DENY", + "Hit deny policy, policy_id: %d service: %d action: %d addr: %s", + p_result[0].config_id, + p_result[0].service_id, + (unsigned char)p_result[0].action, + PRINTADDR(a_stream, g_tsg_para.level) + ); return ; } @@ -566,14 +585,14 @@ static void copy_bypass_result(const struct streaminfo *a_stream, struct master_ } MESA_handle_runtime_log(g_tsg_para.logger, - RLOG_LV_DEBUG, - "ALLOW", - "Hit allow policy, policy_id: %d service: %d action: %d addr: %s", - p_result[0].config_id, - p_result[0].service_id, - (unsigned char)p_result[0].action, - PRINTADDR(a_stream, g_tsg_para.level) - ); + RLOG_LV_DEBUG, + "ALLOW", + "Hit allow policy, policy_id: %d service: %d action: %d addr: %s", + p_result[0].config_id, + p_result[0].service_id, + (unsigned char)p_result[0].action, + PRINTADDR(a_stream, g_tsg_para.level) + ); return ; } @@ -616,14 +635,14 @@ static unsigned char deal_deny_action(const struct streaminfo *a_stream, struct if(ret<0) { MESA_handle_runtime_log(g_tsg_para.logger, - RLOG_LV_FATAL, - "RST_TCP", - "Send RST failed policy_id: %d service: %d action: %d addr: %s", - p_result->config_id, - p_result->service_id, - (unsigned char)p_result->action, - PRINTADDR(a_stream, g_tsg_para.level) - ); + RLOG_LV_FATAL, + "RST_TCP", + "Send RST failed policy_id: %d service: %d action: %d addr: %s", + p_result->config_id, + p_result->service_id, + (unsigned char)p_result->action, + PRINTADDR(a_stream, g_tsg_para.level) + ); } opt_value=1;