From 0ef167555a2f5027b638fa20aab5e5c3e0a22146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E4=B8=80=E9=B8=A3?= Date: Tue, 5 Nov 2019 14:50:53 +0800 Subject: [PATCH] =?UTF-8?q?fs=E5=A2=9E=E5=8A=A0=E8=BE=93=E5=87=BA=E9=97=B4?= =?UTF-8?q?=E9=9A=94=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/sapp/kni/kni.conf | 1 + entry/src/kni_entry.cpp | 5 +++-- entry/src/kni_maat.cpp | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/sapp/kni/kni.conf b/conf/sapp/kni/kni.conf index 71e0ce6..4c1edc1 100644 --- a/conf/sapp/kni/kni.conf +++ b/conf/sapp/kni/kni.conf @@ -99,3 +99,4 @@ remote_switch = 1 remote_ip = 192.168.10.152 remote_port = 8125 local_path = ./fs2_kni.status +stat_cycle = 2 \ No newline at end of file diff --git a/entry/src/kni_entry.cpp b/entry/src/kni_entry.cpp index 0f2bc1d..fd13b1d 100644 --- a/entry/src/kni_entry.cpp +++ b/entry/src/kni_entry.cpp @@ -1906,7 +1906,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){ struct kni_field_stat_handle *fs_handle = NULL; screen_stat_handle_t handle = NULL; const char *app_name = "fs2_kni"; - int value = 0, ret; + int value = 0, ret, stat_cycle; int remote_switch = 0; char remote_ip[INET_ADDRSTRLEN]; int remote_port; @@ -1935,6 +1935,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){ value=FS_OUTPUT_STATSD; FS_set_para(handle, STATS_FORMAT, &value, sizeof(value)); } + MESA_load_profile_int_def(profile, section, "stat_cycle", &stat_cycle, 5); fs_handle = ALLOC(struct kni_field_stat_handle, 1); fs_handle->handle = handle; FS_set_para(handle, APP_NAME, app_name, strlen(app_name) + 1); @@ -1945,7 +1946,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){ FS_set_para(handle, PRINT_MODE, &value, sizeof(value)); value = 1; FS_set_para(handle, CREATE_THREAD, &value, sizeof(value)); - value = 5; + value = stat_cycle; FS_set_para(handle, STAT_CYCLE, &value, sizeof(value)); value = 4096; FS_set_para(handle, MAX_STAT_FIELD_NUM, &value, sizeof(value)); diff --git a/entry/src/kni_maat.cpp b/entry/src/kni_maat.cpp index ed4d115..8a667db 100644 --- a/entry/src/kni_maat.cpp +++ b/entry/src/kni_maat.cpp @@ -317,11 +317,14 @@ enum kni_action intercept_policy_scan(struct kni_maat_handle* handle, struct ipa char* source_subscribe_id = NULL, *dest_subscribe_id = NULL; source_subscribe_id = (char*)Maat_plugin_get_EX_data(handle->dynamic_maat, handle->subscriber_id_tableid, sip); dest_subscribe_id = (char*)Maat_plugin_get_EX_data(handle->dynamic_maat, handle->subscriber_id_tableid, dip); + KNI_LOG_DEBUG(handle->logger, "sip = %s, source_subscribe_id = %s", sip, source_subscribe_id == NULL ? "null" : source_subscribe_id); + KNI_LOG_DEBUG(handle->logger, "dip = %s, dest_subscribe_id = %s", dip, dest_subscribe_id == NULL ? "null" : dest_subscribe_id); if(source_subscribe_id != NULL){ scan_ret = Maat_full_scan_string(handle->static_maat, handle->scan_tableid[TSG_OBJ_SUBSCRIBER_ID], CHARSET_UTF8, source_subscribe_id, strlen(source_subscribe_id), result+hit_policy_cnt, NULL, KNI_MAAT_RULE_NUM_MAX-hit_policy_cnt, &scan_mid, thread_seq); + KNI_LOG_DEBUG(handle->logger, "source_subscribe_id = %s, scan_ret = %d", source_subscribe_id, scan_ret); if(scan_ret > 0){ hit_policy_cnt += scan_ret; } @@ -332,6 +335,7 @@ enum kni_action intercept_policy_scan(struct kni_maat_handle* handle, struct ipa CHARSET_UTF8, dest_subscribe_id, strlen(dest_subscribe_id), result+hit_policy_cnt, NULL, KNI_MAAT_RULE_NUM_MAX-hit_policy_cnt, &scan_mid, thread_seq); + KNI_LOG_DEBUG(handle->logger, "dest_subscribe_id = %s, scan_ret = %d", dest_subscribe_id, scan_ret); if(scan_ret > 0){ hit_policy_cnt += scan_ret; }