From 80a86aa90da73821c394f6fd699598ff6bf72895 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Wed, 19 Jun 2019 22:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=98=E8=AE=A4=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E7=AD=96=E7=95=A5=E4=B8=8D=E5=8F=91=E9=80=81=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=9A=84bug=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=98=8E?= =?UTF-8?q?=E6=96=87http=E5=8D=8F=E8=AE=AE=E8=A2=AB=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=90=8Eintercept=20state=E4=B8=BA0=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/kni_entry.cpp | 4 +++- entry/src/kni_maat.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/entry/src/kni_entry.cpp b/entry/src/kni_entry.cpp index 7195cc1..661ba14 100644 --- a/entry/src/kni_entry.cpp +++ b/entry/src/kni_entry.cpp @@ -991,8 +991,10 @@ static char data_opstate(const struct streaminfo *stream, struct pme_info *pmein case KNI_ACTION_BYPASS: FS_operate(g_kni_fs_handle->handle, g_kni_fs_handle->fields[KNI_FIELD_POLICY_BYP], 0, FS_OP_ADD, 1); FS_operate(g_kni_fs_handle->handle, g_kni_fs_handle->fields[KNI_FIELD_BYP_STM], 0, FS_OP_ADD, 1); + pmeinfo->intercept_state=0; return APP_STATE_FAWPKT | APP_STATE_GIVEME; - case KNI_ACTION_INTERCEPT: + case KNI_ACTION_INTERCEPT: + pmeinfo->intercept_state=1; return first_data_intercept(stream, pmeinfo, &pktinfo, stream_addr, thread_seq); default: //action != intercept && action != bypass,bypass and dropme diff --git a/entry/src/kni_maat.cpp b/entry/src/kni_maat.cpp index 84887b1..701623b 100644 --- a/entry/src/kni_maat.cpp +++ b/entry/src/kni_maat.cpp @@ -10,7 +10,7 @@ extern int g_iThreadNum; */ enum kni_action g_maat_default_action; - +int g_maat_default_log_option=1; struct kni_maat_handle{ Maat_feather_t feather; int tableid_intercept_ip; @@ -45,6 +45,7 @@ void compile_ex_param_new(int idx, const struct Maat_rule_t* rule, const char* s g_maat_default_action = KNI_ACTION_BYPASS; KNI_LOG_INFO(logger, "Set default intercept action to bypass."); } + g_maat_default_log_option=rule->do_log; } return; } @@ -242,6 +243,8 @@ enum kni_action intercept_policy_scan(struct kni_maat_handle* handle, struct ipa } else { + *policy_id=0; + *do_log=g_maat_default_log_option; return g_maat_default_action; } }