From 9f9a84f94650712e331f5a458b11007b01a92e12 Mon Sep 17 00:00:00 2001 From: liuwentan Date: Thu, 30 Mar 2023 21:32:58 +0800 Subject: [PATCH] disable ip_matcher log --- scanner/ip_matcher/ip_matcher.cpp | 20 +------------------- scanner/ip_matcher/ip_matcher.h | 3 +-- src/maat_ip.c | 2 +- src/maat_ip_plugin.c | 2 +- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/scanner/ip_matcher/ip_matcher.cpp b/scanner/ip_matcher/ip_matcher.cpp index a410da2..0e09bc5 100644 --- a/scanner/ip_matcher/ip_matcher.cpp +++ b/scanner/ip_matcher/ip_matcher.cpp @@ -57,13 +57,10 @@ CRuleMatch * new_rule_matcher(enum IP_TYPE type) } struct ip_matcher * ip_matcher_new(struct ip_rule * rules, size_t rule_num, - size_t * mem_use, struct log_handle *logger) + size_t * mem_use) { if(rules == NULL || rule_num == 0) { - log_error(logger, MODULE_IP_MATCHER, - "[%s:%d]: ip_matcher_new() failed, for param is wrong!", - __FUNCTION__, __LINE__); return NULL; } @@ -95,9 +92,6 @@ struct ip_matcher * ip_matcher_new(struct ip_rule * rules, size_t rule_num, { delete v4_matcher; v4_matcher=NULL; - log_error(logger, MODULE_IP_MATCHER, - "[%s:%d] ip_matcher_new() failed !", - __FUNCTION__, __LINE__); return NULL; } @@ -114,9 +108,6 @@ struct ip_matcher * ip_matcher_new(struct ip_rule * rules, size_t rule_num, { delete v6_matcher; v6_matcher=NULL; - log_error(logger, MODULE_IP_MATCHER, - "[%s:%d] ip_matcher_new() failed !", - __FUNCTION__, __LINE__); return NULL; } @@ -134,9 +125,6 @@ int ip_matcher_match(struct ip_matcher* matcher, struct ip_data* data, { if(matcher == NULL || data == NULL || result == NULL) { - log_error(matcher->logger, MODULE_IP_MATCHER, - "[%s:%d]: ip_matcher_match() failed, for param is NULL!", - __FUNCTION__, __LINE__); return -1; } @@ -153,18 +141,12 @@ int ip_matcher_match(struct ip_matcher* matcher, struct ip_data* data, if(tmp_matcher==NULL) { - log_error(matcher->logger, MODULE_IP_MATCHER, - "[%s:%d]: ip_matcher_match() failed, for can't find the right rule_matcher!", - __FUNCTION__, __LINE__); return -1; } int ret = tmp_matcher->search_rule(data,result,size); if(ret<0) { - log_error(matcher->logger, MODULE_IP_MATCHER, - "[%s:%d]: ip_matcher_match() failed, for the value returned by search_rule() is wrong!", - __FUNCTION__, __LINE__); return -1; } diff --git a/scanner/ip_matcher/ip_matcher.h b/scanner/ip_matcher/ip_matcher.h index 7eae14a..cc8287c 100644 --- a/scanner/ip_matcher/ip_matcher.h +++ b/scanner/ip_matcher/ip_matcher.h @@ -91,8 +91,7 @@ extern "C" ����ֵ�� ipɨ����,���ؿ�ָ������ɨ����ʧ�� */ - struct ip_matcher* ip_matcher_new(struct ip_rule * rules, size_t rule_num, - size_t * mem_use, struct log_handle *logger); + struct ip_matcher* ip_matcher_new(struct ip_rule * rules, size_t rule_num, size_t * mem_use); /* ���ܣ�����ipɨ�����������ip���ݽ���ɨ�� diff --git a/src/maat_ip.c b/src/maat_ip.c index 7a7a127..8672f0b 100644 --- a/src/maat_ip.c +++ b/src/maat_ip.c @@ -576,7 +576,7 @@ int ip_runtime_commit(void *ip_runtime, const char *table_name) struct interval_matcher *new_intval_matcher = NULL; struct interval_matcher *old_intval_matcher = NULL; if (rule_cnt > 0) { - new_ip_matcher = ip_matcher_new(rules, rule_cnt, &mem_used, ip_rt->logger); + new_ip_matcher = ip_matcher_new(rules, rule_cnt, &mem_used); if (NULL == new_ip_matcher) { log_error(ip_rt->logger, MODULE_IP, "[%s:%d] table[%s] rebuild ip_matcher engine failed when update %zu ip rules", diff --git a/src/maat_ip_plugin.c b/src/maat_ip_plugin.c index 7ef6d93..d346686 100644 --- a/src/maat_ip_plugin.c +++ b/src/maat_ip_plugin.c @@ -473,7 +473,7 @@ int ip_plugin_runtime_commit(void *ip_plugin_runtime, const char *table_name) struct ip_matcher *old_ip_matcher = NULL; if (rule_cnt > 0) { - new_ip_matcher = ip_matcher_new(rules, rule_cnt, &mem_used, ip_plugin_rt->logger); + new_ip_matcher = ip_matcher_new(rules, rule_cnt, &mem_used); if (NULL == new_ip_matcher) { log_error(ip_plugin_rt->logger, MODULE_IP_PLUGIN, "[%s:%d] table[%s] rebuild ip_matcher engine failed when update %zu ip_plugin rules",