Optimize log output
This commit is contained in:
parent
fea2273660
commit
cd9b4ce3ed
@ -173,7 +173,6 @@ void flush_expired_visit_info(af_client_info_t *node)
|
||||
}
|
||||
|
||||
if (cur_timep - node->visit_info[i].latest_time > timeout){
|
||||
// <20>،ت<D88C>ام<D8A7><D985><EFBFBD>اآ<D8A7>
|
||||
memset(&node->visit_info[i], 0x0, sizeof(app_visit_info_t));
|
||||
count++;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ int add_app_feature(int appid, char *name, char *feature)
|
||||
begin = p + 1;
|
||||
}
|
||||
if (AF_DICT_PARAM_INDEX != param_num && strlen(feature) > MIN_FEATURE_STR_LEN) {
|
||||
AF_ERROR("22 invalid feature:%s\n", feature);
|
||||
AF_ERROR("invalid feature:%s\n", feature);
|
||||
return -1;
|
||||
}
|
||||
strncpy(dict, begin, p - begin);
|
||||
@ -281,7 +281,7 @@ void load_feature_buf_from_file(char **config_buf)
|
||||
|
||||
inode = fp->f_inode;
|
||||
size = inode->i_size;
|
||||
printk("feature file size: %u\n", size);
|
||||
AF_DEBUG("feature file size: %u\n", size);
|
||||
if (size == 0) {
|
||||
AF_WARN("warning, file size = %u\n", size);
|
||||
return;
|
||||
@ -655,7 +655,6 @@ int af_match_one(flow_info_t *flow, af_feature_node_t *node)
|
||||
if (flow->l4_len == 0)
|
||||
return AF_FALSE;
|
||||
|
||||
// 匹配端口
|
||||
if (node->sport != 0 && flow->sport != node->sport ){
|
||||
return AF_FALSE;
|
||||
}
|
||||
@ -781,9 +780,6 @@ void af_update_client_app_info(flow_info_t *flow)
|
||||
AF_CLIENT_UNLOCK_W();
|
||||
}
|
||||
|
||||
/* 在netfilter框架注册的钩子 */
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
|
||||
static u_int32_t app_filter_hook(void *priv,
|
||||
struct sk_buff *skb,
|
||||
@ -941,9 +937,6 @@ void fini_port_timer(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
模块初始化
|
||||
*/
|
||||
static int __init app_filter_init(void)
|
||||
{
|
||||
AF_INFO("appfilter version:"AF_VERSION"\n");
|
||||
@ -957,7 +950,6 @@ static int __init app_filter_init(void)
|
||||
af_init_app_status();
|
||||
|
||||
init_af_client_procfs();
|
||||
// show_feature_list();
|
||||
af_client_init();
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0)
|
||||
nf_register_net_hooks(&init_net, app_filter_ops, ARRAY_SIZE(app_filter_ops));
|
||||
@ -969,9 +961,6 @@ static int __init app_filter_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
模块退出
|
||||
*/
|
||||
static void app_filter_fini(void)
|
||||
{
|
||||
AF_INFO("app filter module exit\n");
|
||||
|
@ -1,9 +1,4 @@
|
||||
|
||||
/*
|
||||
author: destan19@126.com
|
||||
΢ĐĹšŤÖÚşĹ: OpenWrt
|
||||
date:2019/1/10
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <net/tcp.h>
|
||||
@ -59,19 +54,19 @@ char g_app_id_array[AF_MAX_APP_TYPE_NUM][AF_MAX_APP_NUM] = {0};
|
||||
void af_show_app_status(void)
|
||||
{
|
||||
int i, j;
|
||||
printk("#########show app status##########\n");
|
||||
AF_DEBUG("#########show app status##########\n");
|
||||
for (i = 0; i < AF_MAX_APP_TYPE_NUM; i++) {
|
||||
for (j = 0; j < AF_MAX_APP_NUM; j++) {
|
||||
|
||||
af_rule_read_lock();
|
||||
if (g_app_id_array[i][j] == AF_TRUE) {
|
||||
printk("%d, %d\n", i, j);
|
||||
AF_DEBUG("%d, %d\n", i, j);
|
||||
}
|
||||
af_rule_read_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
printk("\n\n\n");
|
||||
AF_DEBUG("\n\n\n");
|
||||
}
|
||||
|
||||
int af_change_app_status(cJSON * data_obj, int status)
|
||||
@ -243,7 +238,7 @@ int af_set_mac_list(cJSON * data_obj)
|
||||
}
|
||||
af_mac_add(mac_hex);
|
||||
}
|
||||
printk("## mac num = %d\n", total_mac);
|
||||
AF_DEBUG("## mac num = %d\n", total_mac);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -351,7 +346,7 @@ static ssize_t af_cdev_read(struct file *filp, char *buf, size_t count, loff_t *
|
||||
static int af_cdev_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct af_cdev_file *file = filp->private_data;
|
||||
printk("config size: %d,data = %s\n", (int)file->size, file->buf);
|
||||
AF_DEBUG("config size: %d,data = %s\n", (int)file->size, file->buf);
|
||||
af_config_handle(file->buf, file->size);
|
||||
filp->private_data = NULL;
|
||||
mutex_unlock(&af_cdev_mutex);
|
||||
@ -364,7 +359,7 @@ static ssize_t af_cdev_write(struct file *filp, const char *buffer, size_t count
|
||||
struct af_cdev_file *file = filp->private_data;
|
||||
int ret;
|
||||
if (file->size + count > sizeof(file->buf)) {
|
||||
printk("config overflow, cur_size: %d, block_size: %d, max_size: %d",
|
||||
AF_ERROR("config overflow, cur_size: %d, block_size: %d, max_size: %d",
|
||||
(int)file->size, (int)count, (int)sizeof(file->buf));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user